Mercurial > public > mercurial-scm > hg-stable
diff mercurial/version.py @ 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 | 50da4bb9cab6 |
children | 345bac2bc4ec |
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()