setup.py: reload __version__.py after writing it.
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Tue, 06 Feb 2007 15:55:20 -0200
changeset 4066 cff3e4b4a8de
parent 4065 8ee983e3d461
child 4067 c620376b8fd6
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.
mercurial/version.py
--- 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."""