Custom package installation commands

I am trying to run some commands before installing for the pips library that I am writing. My setup file looks like this:

from setuptools import setup                                                        

from setuptools.command.install import install                                      

class CustomInstall(install):                                                       
    def run(self):                                                                  
        install.run(self)                                                           
        print "TEST"                                                           

setup(                                                                              
      ...                                      
      cmdclass={'install': CustomInstall},
      ...) 

Based On starting a user task when calling `pip install .

However, pip installation does not print "TEST". Is there something wrong I'm doing here? How can I get this setup.py file for actual printing?

UPDATE: The following, FYI, raises an attribute error:

from setuptools import setup                                                        

from setuptools.command.install import install                                      

class CustomInstall(install):                                                       
    def run(self):                                                                  
        install.run(self)                                                           
        raise AttributeError                                                        

setup(                                                                              
      ...                                      
      cmdclass={'install': CustomInstall},
      ...) 
+4
source share
1 answer

All Articles