Inside the setup.py script I need to create some temporary files for the installation. The natural place to put them would be the “build/” directory.
Is there a way to retrieve its path that works if installing via pypi, from source, easy_install, pip, …?
Thanks a lot!
By default distutils create
build/in current working dir, but it can be changed by argument--build-base. Seems like distutils parses it when executingsetupand parsed argument does not accessible from outside, but you can cut it yourself:This naive version of parser still shorter than
optparse‘s version with proper error handling for unknown flags. Also you can useargparse‘s parser, which havetry_parsemethod.