[New-bugs-announce] [issue36269] post install in setup.py does not work when executed through pip

Saba Kauser report at bugs.python.org
Tue Mar 12 08:29:27 EDT 2019


New submission from Saba Kauser <skauseribmdb at gmail.com>:

Hello,

I have a post install class that looks like this:
if('darwin' in sys.platform):
    class PostInstall(install):
        """ Post installation - run install_name_tool on Darwin """
        def run(self):
            clipath = os.getenv('IBM_DB_HOME', '@loader_path/clidriver')
            print("in PostInstall with {}".format(clipath))
            for so in glob.glob(r'build/lib*/ibm_db*.so'):
                os.system("install_name_tool -change libdb2.dylib {}/lib/libdb2.dylib {}".format(clipath, so))
            install.run(self)
    cmd_class = dict(install = PostInstall)

	
And I pass cmd_class to setup(..) as:
setup(..
      include_package_data = True,
       cmdclass = cmd_class,
       **extra
     )

When I execute setup.py as "python setup.py install", then the PostInstall operation is executed after the ibm_db.so is built and installed and I see the intended result. 
However, when I run "pip install ibm_db" or "pip install .",
the execution order looks like this:
    warnings.warn(notifyString)
    running install
    in PostInstall with /Applications/dsdriver/  ==> this is my post install script
    running build
    running build_py
    creating build	
    creating build/lib.macosx-10.9-x86_64-3.7	 ==> I need to traverse to this folder to find my shared library
	
I would expect it to be run post the ibm_db is installed, not before it gets built. 

Can you please let me know how can this be fixed. Is this a bug with pip?

----------
components: Build
messages: 337736
nosy: sabakauser
priority: normal
severity: normal
status: open
title: post install in setup.py does not work when executed through pip
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36269>
_______________________________________


More information about the New-bugs-announce mailing list