Meine bisherige Lösung sieht so aus:
Code: Alles auswählen
from setuptools.command.develop import develop
from setuptools.command.install import install
#...
def after_install_callback(bin_dir):
"""
:param bin_dir: e.g.: /home/<username>/DjangoForRunnersEnv/bin
Note: print outputs can only be seen in "--verbose" mode!
"""
print("\nafter_install_callback()", file=sys.stderr)
print("*** script_dir:", bin_dir)
class CustomInstallCommand(install):
"""
e.g.: ./setup.py install --verbose
"""
def run(self):
super().run()
after_install_callback(self.install_scripts)
class CustomDevelopCommand(develop):
"""
e.g.: pip install --verbose -e .
"""
def run(self):
super().run()
after_install_callback(self.script_dir)
setup(
#...
cmdclass={
'install': CustomInstallCommand, # normal install e.g.: ./setup.py install
'develop': CustomDevelopCommand, # setuptools "develop mode" e.g.: pip install -e .
},
#...
)