Finding setup.py installation dir within setup.py

566 views Asked by At

I'm writing a Python setup.py script that needs to fix up directory permissions after the installation is complete. I'm using the _postInstall() hook mechanism to give me a place to invoke some final permission-setting code as the last thing in the installation.

However, I can't find any programmatic way to determine where in the file system the package was actually installed, e.g., /usr/local/lib/python2.7/dist-packages or something. setup.py can install your package in a vast number of different places depending on site, version, and command-line options. (Interestingly, it turns out that the current directory in effect when the _postInstall() hook runs is actually a temp directory, not the install location, so no clue there.)

It seems amazing and astonishing that there isn't something in the Python environment I can reference to obtain this crucial info, but I am at a loss.

0

There are 0 answers