Mercurial > hg
comparison mercurial/version.py @ 4066: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 | 345bac2bc4ec |
children | 003d1f174fe1 |
comparison
equal
deleted
inserted
replaced
4065:8ee983e3d461 | 4066:cff3e4b4a8de |
---|---|
16 import util | 16 import util |
17 | 17 |
18 unknown_version = 'unknown' | 18 unknown_version = 'unknown' |
19 remembered_version = False | 19 remembered_version = False |
20 | 20 |
21 def get_version(): | 21 def get_version(doreload=False): |
22 """Return version information if available.""" | 22 """Return version information if available.""" |
23 try: | 23 try: |
24 from mercurial.__version__ import version | 24 import mercurial.__version__ |
25 if doreload: | |
26 reload(mercurial.__version__) | |
27 version = mercurial.__version__.version | |
25 except ImportError: | 28 except ImportError: |
26 version = unknown_version | 29 version = unknown_version |
27 return version | 30 return version |
28 | 31 |
29 def write_version(version): | 32 def write_version(version): |
38 pass | 41 pass |
39 f = open(os.path.join(directory, '__version__.py'), 'w') | 42 f = open(os.path.join(directory, '__version__.py'), 'w') |
40 f.write("# This file is auto-generated.\n") | 43 f.write("# This file is auto-generated.\n") |
41 f.write("version = %r\n" % version) | 44 f.write("version = %r\n" % version) |
42 f.close() | 45 f.close() |
46 # reload the file we've just written | |
47 get_version(True) | |
43 | 48 |
44 def remember_version(version=None): | 49 def remember_version(version=None): |
45 """Store version information.""" | 50 """Store version information.""" |
46 global remembered_version | 51 global remembered_version |
47 if not version and os.path.isdir(".hg"): | 52 if not version and os.path.isdir(".hg"): |