Show More
@@ -97,10 +97,7 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 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 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() |
|
|||
128 | if version: |
|
124 | if version: | |
129 | f = file("mercurial/__version__.py", "w") |
|
125 | f = file("mercurial/__version__.py", "w") | |
130 | f.write('# this file is autogenerated by setup.py\n') |
|
126 | f.write('# this file is autogenerated by setup.py\n') | |
131 | f.write('version = "%s"\n' % version) |
|
127 | f.write('version = "%s"\n' % version) | |
132 | f.close() |
|
128 | f.close() | |
133 | else: |
|
129 | ||
134 | version = "unknown" |
|
130 | try: | |
|
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