Fix packaging.

Submitted by:	Yuri Ryazantsev <yuri@unix.ru> (slightly modified)
This commit is contained in:
Ollivier Robert 2009-05-17 22:34:44 +00:00
parent 77090027c8
commit 2210cd6d32
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=234116
2 changed files with 54 additions and 1 deletions

View file

@ -16,7 +16,9 @@ COMMENT= A fast, lightweight source control management system
USE_GETTEXT= yes
USE_PYTHON= 2.3+
USE_PYDISTUTILS=yes
PYDISTUTILS_NOEGGINFO= yes
PYDISTUTILS_PKGNAME= ${PORTNAME}
PYDISTUTILS_PKGVERSION= ${PORTVERSION}
PYDISTUTILS_EGGINFO= ${PORTNAME}-${PORTVERSION}-${PYTHON_VERSION:S/thon//}.egg-info
CONTRIB_FILES= bash_completion \
convert-repo \

View file

@ -0,0 +1,51 @@
diff -r 4d79ed5b9ecd mercurial-1.2.1/setup.py
--- setup.py Fri May 15 13:58:32 2009 +0400
+++ setup.py Fri May 15 14:02:00 2009 +0400
@@ -97,10 +97,7 @@
except ImportError:
pass
-def getversion():
- if not os.path.exists('.hg'):
- return None # not in a repository
-
+if os.path.exists('.hg'):
# execute hg out of this directory with a custom environment which
# includes the pure Python modules in mercurial/pure
pypath = os.environ.get('PYTHONPATH', '')
@@ -108,6 +105,7 @@
os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
os.environ['HGRCPATH'] = '' # do not read any config file
cmd = '%s hg id -it' % sys.executable
+ version = None
try:
l = os.popen(cmd).read().split()
@@ -122,16 +120,18 @@
version = l[-1] # latest tag or revision number
if version.endswith('+'):
version += time.strftime('%Y%m%d')
- return version
-version = getversion()
-if version:
- f = file("mercurial/__version__.py", "w")
- f.write('# this file is autogenerated by setup.py\n')
- f.write('version = "%s"\n' % version)
- f.close()
-else:
- version = "unknown"
+ if version:
+ f = file("mercurial/__version__.py", "w")
+ f.write('# this file is autogenerated by setup.py\n')
+ f.write('version = "%s"\n' % version)
+ f.close()
+
+try:
+ from mercurial import __version__
+ version = __version__.version
+except ImportError:
+ version = 'unknown'
class install_package_data(install_data):
def finalize_options(self):