Mercurial > hg-stable
changeset 1977:7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
This fixes issue159: "python setup.py install" shouldn't write new files
in the working dir if one has done "python setup.py build" first.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 19 Mar 2006 21:26:58 +0100 |
parents | df8416346bb7 |
children | 10606ee61107 |
files | mercurial/version.py setup.py |
diffstat | 2 files changed, 38 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/version.py Sun Mar 19 14:53:58 2006 +0100 +++ b/mercurial/version.py Sun Mar 19 21:26:58 2006 +0100 @@ -28,8 +28,15 @@ def write_version(version): """Overwrite version file.""" - filename = os.path.join(os.path.dirname(__file__), '__version__.py') - f = open(filename, 'w') + if version == get_version(): + return + directory = os.path.dirname(__file__) + for suffix in ['py', 'pyc', 'pyo']: + try: + os.unlink(os.path.join(directory, '__version__.%s' % suffix)) + except OSError: + pass + f = open(os.path.join(directory, '__version__.py'), 'w') f.write("# This file is auto-generated.\n") f.write("version = %r\n" % version) f.close()
--- a/setup.py Sun Mar 19 14:53:58 2006 +0100 +++ b/setup.py Sun Mar 19 21:26:58 2006 +0100 @@ -72,35 +72,32 @@ ('install_lib', 'install_dir')) install_data.finalize_options(self) -try: - mercurial.version.remember_version(version) - cmdclass = {'install_data': install_package_data} - py2exe_opts = {} - if py2exe_for_demandload is not None: - cmdclass['py2exe'] = py2exe_for_demandload - py2exe_opts['console'] = ['hg'] - setup(name='mercurial', - version=mercurial.version.get_version(), - author='Matt Mackall', - author_email='mpm@selenic.com', - url='http://selenic.com/mercurial', - description='Scalable distributed SCM', - license='GNU GPL', - packages=['mercurial', 'hgext'], - ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), - Extension('mercurial.bdiff', ['mercurial/bdiff.c'])], - data_files=[('mercurial/templates', - ['templates/map'] + - glob.glob('templates/map-*') + - glob.glob('templates/*.tmpl')), - ('mercurial/templates/static', - glob.glob('templates/static/*'))], - cmdclass=cmdclass, - scripts=['hg', 'hgmerge'], - options=dict(bdist_mpkg=dict(zipdist=True, - license='COPYING', - readme='contrib/macosx/Readme.html', - welcome='contrib/macosx/Welcome.html')), - **py2exe_opts) -finally: - mercurial.version.forget_version() +mercurial.version.remember_version(version) +cmdclass = {'install_data': install_package_data} +py2exe_opts = {} +if py2exe_for_demandload is not None: + cmdclass['py2exe'] = py2exe_for_demandload + py2exe_opts['console'] = ['hg'] +setup(name='mercurial', + version=mercurial.version.get_version(), + author='Matt Mackall', + author_email='mpm@selenic.com', + url='http://selenic.com/mercurial', + description='Scalable distributed SCM', + license='GNU GPL', + packages=['mercurial', 'hgext'], + ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), + Extension('mercurial.bdiff', ['mercurial/bdiff.c'])], + data_files=[('mercurial/templates', + ['templates/map'] + + glob.glob('templates/map-*') + + glob.glob('templates/*.tmpl')), + ('mercurial/templates/static', + glob.glob('templates/static/*'))], + cmdclass=cmdclass, + scripts=['hg', 'hgmerge'], + options=dict(bdist_mpkg=dict(zipdist=True, + license='COPYING', + readme='contrib/macosx/Readme.html', + welcome='contrib/macosx/Welcome.html')), + **py2exe_opts)