diff setup.py @ 19724:2b2a2e858fb7

setup: check if mercurial/util.h has been modified Before, if mercurial/util.h was modified but *.c wasn't, no extension was rebuilt.
author Wei, Elson <elson.wei@gmail.com>
date Fri, 13 Sep 2013 10:00:57 +0800
parents 012780620d4f
children 352abbb0be88
line wrap: on
line diff
--- a/setup.py	Fri Sep 13 09:54:43 2013 +0800
+++ b/setup.py	Fri Sep 13 10:00:57 2013 +0800
@@ -423,14 +423,21 @@
 
 pymodules = []
 
+common_depends = ['mercurial/util.h']
+
 extmodules = [
-    Extension('mercurial.base85', ['mercurial/base85.c']),
-    Extension('mercurial.bdiff', ['mercurial/bdiff.c']),
-    Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']),
-    Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
+    Extension('mercurial.base85', ['mercurial/base85.c'],
+              depends=common_depends),
+    Extension('mercurial.bdiff', ['mercurial/bdiff.c'],
+              depends=common_depends),
+    Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
+              depends=common_depends),
+    Extension('mercurial.mpatch', ['mercurial/mpatch.c'],
+              depends=common_depends),
     Extension('mercurial.parsers', ['mercurial/dirs.c',
                                     'mercurial/parsers.c',
-                                    'mercurial/pathencode.c']),
+                                    'mercurial/pathencode.c'],
+              depends=common_depends),
     ]
 
 osutil_ldflags = []
@@ -443,7 +450,8 @@
     pymodules.append('mercurial.pure.osutil')
 else:
     extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
-                                extra_link_args=osutil_ldflags))
+                                extra_link_args=osutil_ldflags,
+                                depends=common_depends))
 
 # the -mno-cygwin option has been deprecated for years
 Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
@@ -467,7 +475,8 @@
     if hasfunction(cc, 'inotify_add_watch'):
         inotify = Extension('hgext.inotify.linux._inotify',
                             ['hgext/inotify/linux/_inotify.c'],
-                            ['mercurial'])
+                            ['mercurial'],
+                            depends=common_depends)
         inotify.optional = True
         extmodules.append(inotify)
         packages.extend(['hgext.inotify', 'hgext.inotify.linux'])