today I attempted to remove a file after my package (a python wheel) was installed via pip with the -t --target option. Post-install script with Python setuptools I am subclassing install in my setup.py like this:
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
# here I am using
p = os.path.join(self.install_libbase,"myPackage/folder/removeThisPyc.pyc")
if os.path.isfile(p):
os.unlink(p)
#there is also self.install_platlib and
#self.install_purelib which seem to be used by pip distutil scheme
#Have not tested those yet
when running
python setup.py install
this works the file is removed upon install. But through
pip install path-to-my-wheel.whl
this does not work and the file is still there.
pip install -t /target/dir path-to-my-wheel.whl
does not work either... So question is, what is pip doing with distutils and or setuptools and how can make this work? Another thing I noticed is that pip does not seem to be printing anything, I am printing in my setup.py in verbose mode? Is there away to see the full output from python instead of the "pip" only stuff?