Do not delete the builtin_version.py file after setup
authorCatalin Marinas <catalin.marinas@gmail.com>
Sat, 17 Oct 2009 21:34:10 +0000 (22:34 +0100)
committerCatalin Marinas <cmarinas@toshiba-laptop.(none)>
Sat, 17 Oct 2009 22:25:19 +0000 (23:25 +0100)
If setup is run in a directory without .git, setup.py deletes the
stgit/builtin_version.py file and subsequent commands no longer have a
version. See bug #14480.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
setup.py
stgit/.gitignore
stgit/version.py

index 73ce2e5..3f5ccb2 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -70,11 +70,8 @@ if sys.argv[1] in ['install', 'build']:
 # ensure readable template files
 old_mask = os.umask(0022)
 
-try:
-    version.write_builtin_version()
-    __run_setup()
-finally:
-    version.delete_builtin_version()
+version.write_builtin_version()
+__run_setup()
 
 # restore the old mask
 os.umask(old_mask)
index 0d20b64..9e7f713 100644 (file)
@@ -1 +1,2 @@
 *.pyc
+builtin_version.py
index 948a70b..94f89a8 100644 (file)
@@ -43,12 +43,6 @@ def write_builtin_version():
     f.write('# This file was generated automatically. Do not edit by hand.\n'
             'version = %r\n' % v)
 
-def delete_builtin_version():
-    for ext in ['py', 'pyc', 'pyo']:
-        fn = _builtin_version_file(ext)
-        if os.path.exists(fn):
-            os.remove(fn)
-
 def get_version():
     for v in [builtin_version, git_describe_version]:
         try: