From e8303d57192bd59642f14206c0b6a6bf99f92097 2010-01-13 05:03:16 From: Fernando Perez Date: 2010-01-13 05:03:16 Subject: [PATCH] Move cleanup to main setup.py, where it belongs. Distutils now generates .egg-info stuff even without setuptools, so we should do the cleanup in the main script. --- diff --git a/IPython/core/release.py b/IPython/core/release.py index c2d7bae..3464fda 100644 --- a/IPython/core/release.py +++ b/IPython/core/release.py @@ -23,7 +23,7 @@ name = 'ipython' development = True # change this to False to do a release version_base = '0.11' branch = 'ipython' -revision = '1312' +revision = '1313' if development: if branch == 'ipython': diff --git a/setup.py b/setup.py index e4047b2..c81f2a3 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ requires utilities which are not available under Windows.""" # Stdlib imports import os +import shutil import sys from glob import glob @@ -43,6 +44,21 @@ from setupbase import ( isfile = os.path.isfile pjoin = os.path.join +#----------------------------------------------------------------------------- +# Function definitions +#----------------------------------------------------------------------------- + +def cleanup(): + """Clean up the junk left around by the build process""" + if "develop" not in sys.argv: + try: + shutil.rmtree('ipython.egg-info') + except: + try: + os.unlink('ipython.egg-info') + except: + pass + #------------------------------------------------------------------------------- # Handle OS specific things #------------------------------------------------------------------------------- @@ -144,7 +160,6 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): ) [ target_update(*t) for t in to_update ] - #--------------------------------------------------------------------------- # Find all the packages, package data, scripts and data_files @@ -203,7 +218,6 @@ else: # just to make life easy for users. check_for_dependencies() - #--------------------------------------------------------------------------- # Do the actual setup now #--------------------------------------------------------------------------- @@ -214,5 +228,7 @@ setup_args['scripts'] = scripts setup_args['data_files'] = data_files setup_args.update(setuptools_extra_args) + if __name__ == '__main__': setup(**setup_args) + cleanup() diff --git a/setupegg.py b/setupegg.py index d3d7643..d9c31b9 100755 --- a/setupegg.py +++ b/setupegg.py @@ -1,20 +1,6 @@ #!/usr/bin/env python """Wrapper to run setup.py using setuptools.""" -import os -import shutil -import sys - -# now, import setuptools and call the actual setup +# Import setuptools and call the actual setup import setuptools execfile('setup.py') - -# clean up the junk left around by setuptools -if "develop" not in sys.argv: - try: - shutil.rmtree('ipython.egg-info') - except: - try: - os.unlink('ipython.egg-info') - except: - pass