diff options
author | Tarek Ziade <tarek@ziade.org> | 2010-05-25 10:52:23 +0200 |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2010-05-25 10:52:23 +0200 |
commit | 17502a06524accaf75c09baa817592bd0d38e75b (patch) | |
tree | 616907116868dafdaf1fd6e041ffba9d3ead9349 | |
parent | 0c8f3ad99a9b8d4a11e32ecf841df428a1cc7fa2 (diff) | |
download | external_python_setuptools-17502a06524accaf75c09baa817592bd0d38e75b.tar.gz external_python_setuptools-17502a06524accaf75c09baa817592bd0d38e75b.tar.bz2 external_python_setuptools-17502a06524accaf75c09baa817592bd0d38e75b.zip |
changed test locally so distribute.egg-info/entry_points.txt is not changed when running tests
--HG--
branch : distribute
extra : rebase_source : ae42d5a7c843fb5dd3bede9ba44ece9742075cbf
-rwxr-xr-x | setup.py | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -41,6 +41,8 @@ VERSION = "0.6.13" from setuptools import setup, find_packages from setuptools.command.build_py import build_py as _build_py +from setuptools.command.test import test as _test + scripts = [] # specific command that is used to generate windows .exe files @@ -64,6 +66,36 @@ class build_py(_build_py): if copied and srcfile in self.distribution.convert_2to3_doctests: self.__doctests_2to3.append(outf) +class test(_test): + """Specific test class to avoid rewriting the entry_points.txt""" + def run(self): + entry_points = os.path.join('distribute.egg-info', 'entry_points.txt') + + if not os.path.exists(entry_points): + try: + _test.run(self) + finally: + return + + f = open(entry_points) + + # running the test + try: + ep_content = f.read() + finally: + f.close() + + try: + _test.run(self) + finally: + # restoring the file + f = open(entry_points, 'w') + try: + f.write(ep_content) + finally: + f.close() + + # if we are installing Distribute using "python setup.py install" # we need to get setuptools out of the way def _easy_install_marker(): @@ -90,6 +122,7 @@ if _being_installed(): from distribute_setup import _before_install _before_install() + dist = setup( name="distribute", version=VERSION, @@ -110,6 +143,7 @@ dist = setup( zip_safe = (sys.version>="2.5"), # <2.5 needs unzipped for -m to work + cmdclass = {'test': test}, entry_points = { "distutils.commands" : [ |