##// END OF EJS Templates
setup: read .hg_archival.txt for version info (issue1670)...
Jeremy Whitlock -
r8548:3ccbe42f default
parent child Browse files
Show More
@@ -97,6 +97,8 b' try:'
97 except ImportError:
97 except ImportError:
98 pass
98 pass
99
99
100 version = None
101
100 if os.path.isdir('.hg'):
102 if os.path.isdir('.hg'):
101 # execute hg out of this directory with a custom environment which
103 # execute hg out of this directory with a custom environment which
102 # includes the pure Python modules in mercurial/pure
104 # includes the pure Python modules in mercurial/pure
@@ -105,7 +107,6 b" if os.path.isdir('.hg'):"
105 os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
107 os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
106 os.environ['HGRCPATH'] = '' # do not read any config file
108 os.environ['HGRCPATH'] = '' # do not read any config file
107 cmd = [sys.executable, 'hg', 'id', '-i', '-t']
109 cmd = [sys.executable, 'hg', 'id', '-i', '-t']
108 version = None
109
110
110 l, e = subprocess.Popen(cmd, stdout=subprocess.PIPE,
111 l, e = subprocess.Popen(cmd, stdout=subprocess.PIPE,
111 stderr=subprocess.PIPE).communicate()
112 stderr=subprocess.PIPE).communicate()
@@ -122,12 +123,19 b" if os.path.isdir('.hg'):"
122 version = l[-1] # latest tag or revision number
123 version = l[-1] # latest tag or revision number
123 if version.endswith('+'):
124 if version.endswith('+'):
124 version += time.strftime('%Y%m%d')
125 version += time.strftime('%Y%m%d')
126 elif os.path.exists('.hg_archival.txt'):
127 hgarchival = open('.hg_archival.txt')
128 for line in hgarchival:
129 if line.startswith('node:'):
130 version = line.split(':')[1].strip()[:12]
131 break
125
132
126 if version:
133 if version:
127 f = file("mercurial/__version__.py", "w")
134 f = file("mercurial/__version__.py", "w")
128 f.write('# this file is autogenerated by setup.py\n')
135 f.write('# this file is autogenerated by setup.py\n')
129 f.write('version = "%s"\n' % version)
136 f.write('version = "%s"\n' % version)
130 f.close()
137 f.close()
138
131
139
132 try:
140 try:
133 from mercurial import __version__
141 from mercurial import __version__
General Comments 0
You need to be logged in to leave comments. Login now