@@ -52,7 +52,7 @@ def wait(self):
52
52
elif os .WIFEXITED (status ):
53
53
self .returncode = os .WEXITSTATUS (status )
54
54
elif os .WIFSTOPPED (status ):
55
- self .returncode = - os .WSTOPSIG (sts )
55
+ self .returncode = - os .WSTOPSIG (status )
56
56
else :
57
57
# Should never happen
58
58
raise Exception ("Unknown child exit status!" )
@@ -364,16 +364,14 @@ def __init__(self, dist):
364
364
def add (self , ext ):
365
365
self .extensions .append (ext )
366
366
367
- def build_extensions (self ):
367
+ def set_srcdir (self ):
368
368
self .srcdir = sysconfig .get_config_var ('srcdir' )
369
369
if not self .srcdir :
370
370
# Maybe running on Windows but not using CYGWIN?
371
371
raise ValueError ("No source directory; cannot proceed." )
372
372
self .srcdir = os .path .abspath (self .srcdir )
373
373
374
- # Detect which modules should be compiled
375
- self .detect_modules ()
376
-
374
+ def remove_disabled (self ):
377
375
# Remove modules that are present on the disabled list
378
376
extensions = [ext for ext in self .extensions
379
377
if ext .name not in DISABLED_MODULE_LIST ]
@@ -384,6 +382,7 @@ def build_extensions(self):
384
382
extensions .append (ctypes )
385
383
self .extensions = extensions
386
384
385
+ def update_sources_depends (self ):
387
386
# Fix up the autodetected modules, prefixing all the source files
388
387
# with Modules/.
389
388
moddirlist = [os .path .join (self .srcdir , 'Modules' )]
@@ -396,14 +395,6 @@ def build_extensions(self):
396
395
headers = [sysconfig .get_config_h_filename ()]
397
396
headers += glob (os .path .join (sysconfig .get_path ('include' ), "*.h" ))
398
397
399
- # The sysconfig variables built by makesetup that list the already
400
- # built modules and the disabled modules as configured by the Setup
401
- # files.
402
- sysconf_built = sysconfig .get_config_var ('MODBUILT_NAMES' ).split ()
403
- sysconf_dis = sysconfig .get_config_var ('MODDISABLED_NAMES' ).split ()
404
-
405
- mods_built = []
406
- mods_disabled = []
407
398
for ext in self .extensions :
408
399
ext .sources = [ find_module_file (filename , moddirlist )
409
400
for filename in ext .sources ]
@@ -415,6 +406,16 @@ def build_extensions(self):
415
406
# re-compile extensions if a header file has been changed
416
407
ext .depends .extend (headers )
417
408
409
+ def remove_configured_extensions (self ):
410
+ # The sysconfig variables built by makesetup that list the already
411
+ # built modules and the disabled modules as configured by the Setup
412
+ # files.
413
+ sysconf_built = sysconfig .get_config_var ('MODBUILT_NAMES' ).split ()
414
+ sysconf_dis = sysconfig .get_config_var ('MODDISABLED_NAMES' ).split ()
415
+
416
+ mods_built = []
417
+ mods_disabled = []
418
+ for ext in self .extensions :
418
419
# If a module has already been built or has been disabled in the
419
420
# Setup files, don't build it here.
420
421
if ext .name in sysconf_built :
@@ -432,6 +433,9 @@ def build_extensions(self):
432
433
if os .path .exists (fullpath ):
433
434
os .unlink (fullpath )
434
435
436
+ return (mods_built , mods_disabled )
437
+
438
+ def set_compiler_executables (self ):
435
439
# When you run "make CC=altcc" or something similar, you really want
436
440
# those environment variables passed into the setup.py phase. Here's
437
441
# a small set of useful ones.
@@ -444,6 +448,18 @@ def build_extensions(self):
444
448
args ['compiler_so' ] = compiler + ' ' + ccshared + ' ' + cflags
445
449
self .compiler .set_executables (** args )
446
450
451
+ def build_extensions (self ):
452
+ self .set_srcdir ()
453
+
454
+ # Detect which modules should be compiled
455
+ self .detect_modules ()
456
+
457
+ self .remove_disabled ()
458
+
459
+ self .update_sources_depends ()
460
+ mods_built , mods_disabled = self .remove_configured_extensions ()
461
+ self .set_compiler_executables ()
462
+
447
463
build_ext .build_extensions (self )
448
464
449
465
if SUBPROCESS_BOOTSTRAP :
@@ -454,6 +470,9 @@ def build_extensions(self):
454
470
for ext in self .extensions :
455
471
self .check_extension_import (ext )
456
472
473
+ self .summary (mods_built , mods_disabled )
474
+
475
+ def summary (self , mods_built , mods_disabled ):
457
476
longest = max ([len (e .name ) for e in self .extensions ], default = 0 )
458
477
if self .failed or self .failed_on_import :
459
478
all_failed = self .failed + self .failed_on_import
0 commit comments