aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub/setup.py
blob: a6a8d50d03c3bdc3fab914b2976885b09a8db6bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from distutils.core import setup, Extension
from distutils.ccompiler import new_compiler
import os
import sys

extra_compile_args  = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]

fsys_mods = []
fsys_pkgs = []

if os.path.exists("/usr/include/ext2fs/ext2_fs.h"):
    ext2defines = []
    cc = new_compiler()
    cc.add_library("ext2fs")
    if hasattr(cc, "has_function") and cc.has_function("ext2fs_open2"):
        ext2defines.append( ("HAVE_EXT2FS_OPEN2", None) )
    else:
        sys.stderr.write("WARNING: older version of e2fsprogs installed, not building full\n")
        sys.stderr.write("         disk support for ext2.\n")
        
    ext2 = Extension("grub.fsys.ext2._pyext2",
                     extra_compile_args = extra_compile_args,
                     libraries = ["ext2fs"],
                     define_macros = ext2defines,
                     sources = ["src/fsys/ext2/ext2module.c"])
    fsys_mods.append(ext2)
    fsys_pkgs.append("grub.fsys.ext2")

if os.path.exists("/usr/include/reiserfs/reiserfs.h"):
    reiser = Extension("grub.fsys.reiser._pyreiser",
                     extra_compile_args = extra_compile_args,
                     libraries = ["reiserfs"],
                     sources = ["src/fsys/reiser/reisermodule.c"])
    fsys_mods.append(reiser)
    fsys_pkgs.append("grub.fsys.reiser")

pkgs = ['grub', 'grub.fsys']
pkgs.extend(fsys_pkgs)
setup(name='pygrub',
      version='0.3',
      description='Boot loader that looks a lot like grub for Xen',
      author='Jeremy Katz',
      author_email='katzj@redhat.com',
      license='GPL',
      package_dir={'grub': 'src'},
      scripts = ["src/pygrub"],
      packages=pkgs,
      ext_modules = fsys_mods
      )