Mercurial > hg
comparison mercurial/version.py @ 427:36e644d28edf
Make it possible to specify a version number in setup.py.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Make it possible to specify a version number in setup.py.
manifest hash: 905feb305205801eb3833e5a84161fb57b83c86e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCtc/QW7P1GVgWeRoRAlCaAJ9G2GRf0wIEVEbYNoV4PjV4b024bQCfcUFf
WVYQlTXqninDXyKas2yQYdo=
=ofg/
-----END PGP SIGNATURE-----
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 19 Jun 2005 21:04:32 +0100 |
parents | 719663b7f235 |
children | 688d03d6997a |
comparison
equal
deleted
inserted
replaced
426:8c90ab5644c9 | 427:36e644d28edf |
---|---|
31 f = open(filename, 'w') | 31 f = open(filename, 'w') |
32 f.write("# This file is auto-generated.\n") | 32 f.write("# This file is auto-generated.\n") |
33 f.write("version = %r\n" % version) | 33 f.write("version = %r\n" % version) |
34 f.close() | 34 f.close() |
35 | 35 |
36 def remember_version(): | 36 def remember_version(version=None): |
37 """Store version information.""" | 37 """Store version information.""" |
38 global remembered_version | 38 global remembered_version |
39 if os.access(".hg", os.F_OK): | 39 if not version and os.path.isdir(".hg"): |
40 f = os.popen("hg identify 2>/dev/null") # use real hg installation | 40 f = os.popen("hg identify 2>/dev/null") # use real hg installation |
41 ident = f.read()[:-1] | 41 ident = f.read()[:-1] |
42 if not f.close() and ident: | 42 if not f.close() and ident: |
43 ids = ident.split(' ', 1) | 43 ids = ident.split(' ', 1) |
44 version = ids.pop(0) | 44 version = ids.pop(0) |
53 if re.match(r'^(\d+\.)+[\w.-]+$', tag): | 53 if re.match(r'^(\d+\.)+[\w.-]+$', tag): |
54 version = tag | 54 version = tag |
55 break | 55 break |
56 if modified: | 56 if modified: |
57 version += time.strftime('+%Y%m%d') | 57 version += time.strftime('+%Y%m%d') |
58 remembered_version = True | 58 if version: |
59 write_version(version) | 59 remembered_version = True |
60 write_version(version) | |
60 | 61 |
61 def forget_version(): | 62 def forget_version(): |
62 """Remove version information.""" | 63 """Remove version information.""" |
63 if remembered_version: | 64 if remembered_version: |
64 write_version(unknown_version) | 65 write_version(unknown_version) |