~statik/ubuntu/hardy/lxml/backport-from-karmic

« back to all changes in this revision

Viewing changes to setupinfo.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-06-06 01:46:44 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080606014644-2mqv6s46xjcgtuub
Tags: 2.0.6-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
EXT_MODULES = ["lxml.etree", "lxml.objectify","lxml.pyclasslookup"]
12
12
 
 
13
PACKAGE_PATH = "src/lxml/"
 
14
 
13
15
def env_var(name):
14
16
    value = os.getenv(name, '')
15
17
    return value.split(os.pathsep)
20
22
        print("Building with Cython %s." % Cython.Compiler.Version.version)
21
23
    else:
22
24
        print ("NOTE: Trying to build without Cython, pre-generated "
23
 
               "'src/lxml/etree.c' needs to be available.")
 
25
               "'%slxml.etree.c' needs to be available." % PACKAGE_PATH)
24
26
        source_extension = ".c"
25
27
 
26
28
    if OPTION_WITHOUT_OBJECTIFY:
27
29
        modules = [ entry for entry in EXT_MODULES
28
 
                    if 'objectify' not in entry[0] ]
 
30
                    if 'objectify' not in entry ]
29
31
    else:
30
32
        modules = EXT_MODULES
31
33
 
60
62
    
61
63
    result = []
62
64
    for module in modules:
 
65
        main_module_source = PACKAGE_PATH + module + source_extension
63
66
        result.append(
64
67
            Extension(
65
68
            module,
66
 
            sources = ["src/lxml/" + module + source_extension],
 
69
            sources = [main_module_source],
67
70
            extra_compile_args = ['-w'] + _cflags,
68
71
            define_macros = _define_macros,
69
72
            include_dirs = _include_dirs,
109
112
    if OPTION_STATIC:
110
113
        if not static_include_dirs:
111
114
            static_include_dirs = env_var('INCLUDE')
112
 
        assert static_include_dirs, "Static build not configured, see doc/build.txt"
113
115
        return static_include_dirs
114
116
    # filter them from xslt-config --cflags
115
117
    result = []
127
129
    if OPTION_STATIC:
128
130
        if not static_cflags:
129
131
            static_cflags = env_var('CFLAGS')
130
 
        assert static_cflags, "Static build not configured, see doc/build.txt"
131
132
        result.extend(static_cflags)
132
 
        return result
133
 
 
134
 
    # anything from xslt-config --cflags that doesn't start with -I
135
 
    possible_cflags = flags('cflags')
136
 
    for possible_cflag in possible_cflags:
137
 
        if not possible_cflag.startswith('-I'):
138
 
            result.append(possible_cflag)
 
133
    else:
 
134
        # anything from xslt-config --cflags that doesn't start with -I
 
135
        possible_cflags = flags('cflags')
 
136
        for possible_cflag in possible_cflags:
 
137
            if not possible_cflag.startswith('-I'):
 
138
                result.append(possible_cflag)
 
139
 
 
140
    if sys.platform in ('darwin',):
 
141
        for opt in result:
 
142
            if 'flat_namespace' in opt:
 
143
                break
 
144
        else:
 
145
            result.append('-flat_namespace')
 
146
 
139
147
    return result
140
148
 
141
149
def define_macros():