/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Martin Pool
  • Date: 2008-10-08 01:16:05 UTC
  • mto: (3763.3.2 1.8)
  • mto: This revision was merged to the branch mainline in revision 3779.
  • Revision ID: mbp@sourcefrog.net-20081008011605-tzgv9owfn2wde4cg
Set -DWIN32 for all pyrex extensions, not one by one

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, **kwargs):
 
204
def add_pyrex_extension(module_name, define_macros=[], **kwargs):
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
    if sys.platform == 'win32':
 
221
        # pyrex uses the macro WIN32 to detect the platform, even though it should
 
222
        # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
 
223
        # right value.
 
224
        define_macros.append(('WIN32', None))
220
225
    if have_pyrex:
221
 
        ext_modules.append(Extension(module_name, [pyrex_name], **kwargs))
 
226
        ext_modules.append(Extension(module_name, [pyrex_name],
 
227
            define_macros=define_macros, **kwargs))
222
228
    else:
223
229
        if not os.path.isfile(c_name):
224
230
            unavailable_files.append(c_name)
225
231
        else:
226
 
            ext_modules.append(Extension(module_name, [c_name], **kwargs))
227
 
 
228
 
 
 
232
            ext_modules.append(Extension(module_name, [c_name],
 
233
                define_macros=define_macros,  **kwargs))
 
234
 
 
235
 
 
236
add_pyrex_extension('bzrlib._btree_serializer_c')
229
237
add_pyrex_extension('bzrlib._knit_load_data_c')
230
238
if sys.platform == 'win32':
231
 
    # pyrex uses the macro WIN32 to detect the platform, even though it should
232
 
    # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
233
 
    # right value.
234
 
    add_pyrex_extension('bzrlib._btree_serializer_c',
235
 
                        define_macros=[('WIN32', None)])
236
239
    add_pyrex_extension('bzrlib._dirstate_helpers_c',
237
 
                         libraries=['Ws2_32'],
238
 
                         define_macros=[('WIN32', None)],
239
 
                       )
240
 
    add_pyrex_extension('bzrlib._walkdirs_win32',
241
 
                        define_macros=[('WIN32', None)])
 
240
                        libraries=['Ws2_32'])
 
241
    add_pyrex_extension('bzrlib._walkdirs_win32')
242
242
else:
243
 
    add_pyrex_extension('bzrlib._btree_serializer_c')
244
243
    if have_pyrex and pyrex_version == '0.9.4.1':
245
244
        # Pyrex 0.9.4.1 fails to compile this extension correctly
246
245
        # The code it generates re-uses a "local" pointer and