[Distutils] Extending distutils with 3rd party build commands?

Bob Ippolito bob at redivi.com
Thu Oct 21 18:16:38 CEST 2004

On Oct 21, 2004, at 11:50, Phillip J. Eby wrote:

> At 11:02 PM 10/20/04 -0400, Bob Ippolito wrote:
>> On Oct 20, 2004, at 22:19, Phillip J. Eby wrote:
>>> Another possibility: create a script that does the import, then 
>>> calls execfile() on 'setup.py' in the current directory, so that you 
>>> can just run that script instead of setup.py.  You can then install 
>>> that script, so users can run it against any setup.py.
>> Yeah, I guess that's the only reasonable thing to do until Python 2.5 
>> :)
> Well, in 2.4, your script can be a module, and executed with '-m'.  :)

 From python-dev it sounded like that feature might not make it into 

I did make it a script though, I'm not sure why I didn't think of that 

#!/usr/bin/env python
import sys, os
import bdist_mpkg
del sys.argv[0]
if not sys.argv:
     sys.argv[:0] = ['setup.py', '--open']
elif sys.argv[0].startswith('-'):
     sys.argv[:0] = ['setup.py']
elif len(sys.argv) == 1:
     sys.argv[1:1] = ['--open']
sys.argv.insert(1, 'bdist_mpkg')
if os.path.dirname(sys.argv[0]):
     path,name = os.path.split(sys.argv[0])
     sys.argv[0] = name
__file__ = sys.argv[0]
execfile(sys.argv[0], globals(), locals())


More information about the Distutils-SIG mailing list