##// END OF EJS Templates
Fix how setup.py identifies the Mercurial version....
Jeremy Whitlock -
r8493:4c030ada default
parent child Browse files
Show More
@@ -97,10 +97,7 b' try:'
97 except ImportError:
97 except ImportError:
98 pass
98 pass
99
99
100 def getversion():
100 if os.path.exists('.hg'):
101 if not os.path.exists('.hg'):
102 return None # not in a repository
103
104 # execute hg out of this directory with a custom environment which
101 # execute hg out of this directory with a custom environment which
105 # includes the pure Python modules in mercurial/pure
102 # includes the pure Python modules in mercurial/pure
106 pypath = os.environ.get('PYTHONPATH', '')
103 pypath = os.environ.get('PYTHONPATH', '')
@@ -108,6 +105,7 b' def getversion():'
108 os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
105 os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
109 os.environ['HGRCPATH'] = '' # do not read any config file
106 os.environ['HGRCPATH'] = '' # do not read any config file
110 cmd = '%s hg id -it' % sys.executable
107 cmd = '%s hg id -it' % sys.executable
108 version = None
111
109
112 try:
110 try:
113 l = os.popen(cmd).read().split()
111 l = os.popen(cmd).read().split()
@@ -122,16 +120,18 b' def getversion():'
122 version = l[-1] # latest tag or revision number
120 version = l[-1] # latest tag or revision number
123 if version.endswith('+'):
121 if version.endswith('+'):
124 version += time.strftime('%Y%m%d')
122 version += time.strftime('%Y%m%d')
125 return version
126
123
127 version = getversion()
124 if version:
128 if version:
125 f = file("mercurial/__version__.py", "w")
129 f = file("mercurial/__version__.py", "w")
126 f.write('# this file is autogenerated by setup.py\n')
130 f.write('# this file is autogenerated by setup.py\n')
127 f.write('version = "%s"\n' % version)
131 f.write('version = "%s"\n' % version)
128 f.close()
132 f.close()
129
133 else:
130 try:
134 version = "unknown"
131 from mercurial import __version__
132 version = __version__.version
133 except ImportError:
134 version = 'unknown'
135
135
136 class install_package_data(install_data):
136 class install_package_data(install_data):
137 def finalize_options(self):
137 def finalize_options(self):
General Comments 0
You need to be logged in to leave comments. Login now