~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-17 19:58:53 UTC
  • mfrom: (3783 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3785.
  • Revision ID: john@arbash-meinel.com-20081017195853-i31d3g7sur1prgvi
Merge bzr.dev 3783, resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
unavailable_files = []
225
225
 
226
226
 
227
 
def add_pyrex_extension(module_name, **kwargs):
 
227
def add_pyrex_extension(module_name, libraries=None):
228
228
    """Add a pyrex module to build.
229
229
 
230
230
    This will use Pyrex to auto-generate the .c file if it is available.
240
240
    path = module_name.replace('.', '/')
241
241
    pyrex_name = path + '.pyx'
242
242
    c_name = path + '.c'
 
243
    define_macros = []
 
244
    if sys.platform == 'win32':
 
245
        # pyrex uses the macro WIN32 to detect the platform, even though it should
 
246
        # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
 
247
        # right value.
 
248
        define_macros.append(('WIN32', None))
243
249
    if have_pyrex:
244
 
        ext_modules.append(Extension(module_name, [pyrex_name], **kwargs))
 
250
        ext_modules.append(Extension(module_name, [pyrex_name],
 
251
            define_macros=define_macros, libraries=libraries))
245
252
    else:
246
253
        if not os.path.isfile(c_name):
247
254
            unavailable_files.append(c_name)
248
255
        else:
249
 
            ext_modules.append(Extension(module_name, [c_name], **kwargs))
 
256
            ext_modules.append(Extension(module_name, [c_name],
 
257
                define_macros=define_macros, libraries=libraries))
250
258
 
251
259
 
252
260
add_pyrex_extension('bzrlib._btree_serializer_c')
253
261
add_pyrex_extension('bzrlib._knit_load_data_c')
254
262
if sys.platform == 'win32':
255
263
    add_pyrex_extension('bzrlib._dirstate_helpers_c',
256
 
                         libraries=['Ws2_32']
257
 
                       )
258
 
    # pyrex uses the macro WIN32 to detect the platform, even though it should
259
 
    # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
260
 
    # right value.
261
 
    add_pyrex_extension('bzrlib._walkdirs_win32',
262
 
                        define_macros=[('WIN32', None)])
 
264
                        libraries=['Ws2_32'])
 
265
    add_pyrex_extension('bzrlib._walkdirs_win32')
263
266
else:
264
267
    if have_pyrex and pyrex_version == '0.9.4.1':
265
268
        # Pyrex 0.9.4.1 fails to compile this extension correctly