~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Martin Pool
  • Date: 2008-10-08 05:33:53 UTC
  • mto: (3763.3.2 1.8)
  • mto: This revision was merged to the branch mainline in revision 3779.
  • Revision ID: mbp@sourcefrog.net-20081008053353-aqjccu3zsifjz0f1
Review feedback on add_pyrex_extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
unavailable_files = []
202
202
 
203
203
 
204
 
def add_pyrex_extension(module_name, define_macros=[], **kwargs):
 
204
def add_pyrex_extension(module_name, libraries=None):
205
205
    """Add a pyrex module to build.
206
206
 
207
207
    This will use Pyrex to auto-generate the .c file if it is available.
217
217
    path = module_name.replace('.', '/')
218
218
    pyrex_name = path + '.pyx'
219
219
    c_name = path + '.c'
 
220
    define_macros = []
220
221
    if sys.platform == 'win32':
221
222
        # pyrex uses the macro WIN32 to detect the platform, even though it should
222
223
        # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
224
225
        define_macros.append(('WIN32', None))
225
226
    if have_pyrex:
226
227
        ext_modules.append(Extension(module_name, [pyrex_name],
227
 
            define_macros=define_macros, **kwargs))
 
228
            define_macros=define_macros, libraries=libraries))
228
229
    else:
229
230
        if not os.path.isfile(c_name):
230
231
            unavailable_files.append(c_name)
231
232
        else:
232
233
            ext_modules.append(Extension(module_name, [c_name],
233
 
                define_macros=define_macros,  **kwargs))
 
234
                define_macros=define_macros, libraries=libraries))
234
235
 
235
236
 
236
237
add_pyrex_extension('bzrlib._btree_serializer_c')