[Python-checkins] release: Use "hg touch" where available to update generated file timestamps. Fixes

georg.brandl python-checkins at python.org
Sun May 19 07:19:39 CEST 2013


http://hg.python.org/release/rev/2dd672c67008
changeset:   63:2dd672c67008
user:        Georg Brandl <georg at python.org>
date:        Sun May 19 07:20:25 2013 +0200
summary:
  Use "hg touch" where available to update generated file timestamps. Fixes #18008.

files:
  release.py |  27 +++++++++++++++++----------
  1 files changed, 17 insertions(+), 10 deletions(-)


diff --git a/release.py b/release.py
--- a/release.py
+++ b/release.py
@@ -264,6 +264,23 @@
         run_cmd(['hg', 'archive', '--config', 'ui.archivemeta=off',
                  '-r', tag.hgname, archivename])
         with changed_dir(archivename):
+            # Touch a few files that get generated so they're up-to-date in
+            # the tarball.
+            if os.path.isfile('.hgtouch'):
+                # Use "hg touch" if available
+                run_cmd(['hg', '-v', 'touch', '--config',
+                         'extensions.touch=Tools/hg/hgtouch.py'])
+            else:
+                touchables = ['Include/Python-ast.h', 'Python/Python-ast.c']
+                if os.path.exists('Python/opcode_targets.h'):
+                    # This file isn't in Python < 3.1
+                    touchables.append('Python/opcode_targets.h')
+                print('Touching:', COMMASPACE.join(name.rsplit('/', 1)[-1]
+                                                   for name in touchables))
+                for name in touchables:
+                    os.utime(name, None)
+
+            # Remove files we don't want to ship in tarballs.
             print('Removing VCS .*ignore and .hg*')
             for name in ('.hgignore', '.hgeol', '.hgtags', '.hgtouch',
                          '.bzrignore', '.gitignore'):
@@ -271,16 +288,6 @@
                     os.unlink(name)
                 except OSError:
                     pass
-            # Touch a few files that get generated so they're up-to-date in
-            # the tarball.
-            touchables = ['Include/Python-ast.h', 'Python/Python-ast.c']
-            if os.path.exists('Python/opcode_targets.h'):
-                # This file isn't in Python < 3.1
-                touchables.append('Python/opcode_targets.h')
-            print('Touching:', COMMASPACE.join(name.rsplit('/', 1)[-1]
-                                               for name in touchables))
-            for name in touchables:
-                os.utime(name, None)
 
             if tag.is_final:
                 docdist = build_docs()

-- 
Repository URL: http://hg.python.org/release


More information about the Python-checkins mailing list