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

Skip to content

Commit 09e532b

Browse files
committed
Add a new definition to Extension objects: depends.
depends is a list of files that the target depends, but aren't direct sources of the target. think .h files.
1 parent aa6a664 commit 09e532b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/distutils/command/build_ext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ def build_extension(self, ext):
422422
ext_filename = os.path.join(self.build_lib,
423423
self.get_ext_filename(fullname))
424424

425-
if not (self.force or newer_group(sources, ext_filename, 'newer')):
425+
depends = sources + ext.depends
426+
if not (self.force or newer_group(depends, ext_filename, 'newer')):
426427
log.debug("skipping '%s' extension (up-to-date)", ext.name)
427428
return
428429
else:

Lib/distutils/extension.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class Extension:
7373
used on all platforms, and not generally necessary for Python
7474
extensions, which typically export exactly one symbol: "init" +
7575
extension_name.
76+
depends : [string]
77+
list of files that the extension depends on
7678
"""
7779

7880
def __init__ (self, name, sources,
@@ -86,6 +88,7 @@ def __init__ (self, name, sources,
8688
extra_compile_args=None,
8789
extra_link_args=None,
8890
export_symbols=None,
91+
depends=None,
8992
):
9093

9194
assert type(name) is StringType, "'name' must be a string"
@@ -105,6 +108,7 @@ def __init__ (self, name, sources,
105108
self.extra_compile_args = extra_compile_args or []
106109
self.extra_link_args = extra_link_args or []
107110
self.export_symbols = export_symbols or []
111+
self.depends = depends or []
108112

109113
# class Extension
110114

0 commit comments

Comments
 (0)