Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9028d0a

Browse files
committed
Visious hackery to solve a build-control problem related to our use of
distutils for the library modules built as shared objects. A better solution appears possible, but with the threat that the distutils becomes more magical ("complex"). This closes SF bug #458343.
1 parent e3d7622 commit 9028d0a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lib/distutils/command/build_ext.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,17 @@ def build_extension(self, ext):
456456
debug=self.debug,
457457
extra_postargs=extra_args)
458458

459+
# XXX -- this is a Vile HACK!
460+
#
461+
# The setup.py script for Python on Unix needs to be able to
462+
# get this list so it can perform all the clean up needed to
463+
# avoid keeping object files around when cleaning out a failed
464+
# build of an extension module. Since Distutils does not
465+
# track dependencies, we have to get rid of intermediates to
466+
# ensure all the intermediates will be properly re-built.
467+
#
468+
self._built_objects = objects[:]
469+
459470
# Now link the object files together into a "shared object" --
460471
# of course, first we have to figure out all the other things
461472
# that go into the mix.

setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ def build_extension(self, ext):
172172
self.get_ext_filename(fullname))
173173
os.remove(ext_filename)
174174

175+
# XXX -- This relies on a Vile HACK in
176+
# distutils.command.build_ext.build_extension(). The
177+
# _built_objects attribute is stored there strictly for
178+
# use here.
179+
for filename in self._built_objects:
180+
os.remove(filename)
181+
175182
def get_platform (self):
176183
# Get value of sys.platform
177184
platform = sys.platform

0 commit comments

Comments
 (0)