changeset 3932:cff3e4b4a8de

setup.py: reload __version__.py after writing it. write_version loads __version__.py before writing it (see 7eb694a1c1af), so we have to explicitly reload it to use the correct version. Problem diagnosed by Christian Ebert.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 06 Feb 2007 15:55:20 -0200
parents 8ee983e3d461
children c620376b8fd6
files mercurial/version.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/version.py	Tue Feb 06 15:54:58 2007 -0200
+++ b/mercurial/version.py	Tue Feb 06 15:55:20 2007 -0200
@@ -18,10 +18,13 @@
 unknown_version = 'unknown'
 remembered_version = False
 
-def get_version():
+def get_version(doreload=False):
     """Return version information if available."""
     try:
-        from mercurial.__version__ import version
+        import mercurial.__version__
+        if doreload:
+            reload(mercurial.__version__)
+        version = mercurial.__version__.version
     except ImportError:
         version = unknown_version
     return version
@@ -40,6 +43,8 @@
     f.write("# This file is auto-generated.\n")
     f.write("version = %r\n" % version)
     f.close()
+    # reload the file we've just written
+    get_version(True)
 
 def remember_version(version=None):
     """Store version information."""