Setuptools : how to use the setup() function within a script (no setup specific command line argument)
I'm writing a tool to automatically generate .egg files from python projects. The tool basically discovers some properties to guess the setup options (such as ver开发者_如何学JAVAsion number etc).
Now I would like to call the setup()
function, with the context bdist_egg
.
I do as such :
if __name__ == '__main__'
project_dir = _get_dir(sys.argv)
os.chdir(project_dir)
config = _guess_configuration(project_dir) # returns a dict
sys.argv = ['', 'bdist_egg']
setup(**config)
And then I can call my script
python make_egg.py /path/to/project
What I would like is to skip the sys.argv = ['', 'bdist_egg']
part. Is there a way to have the setup command passed to the setup function?
Thanks
setup(script_args=['bdist_egg'], **config)
精彩评论