[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Post install setup does not work as expected with pip install"

I am able to get this to work.
I had to invoke parent's run before my post install logic could kick.

From: Saba Kauser
Sent: Tuesday, March 12, 2019 6:01 PM
To: python-list at python.org
Subject: "Post install setup does not work as expected with pip install"


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))
    cmd_class = dict(install = PostInstall)

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

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.
Howeever, when I run "pip install ibm_db" or "pip install .",
the execution order looks like this:
    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?

Saba Kauser
Db2 Connect development and support.

Rocket Software Development India Pvt Ltd
Karle Town Centre - SEZ,
HUB 1 building, 4th Floor (North West Wing),
100 ft. Kempapura road, adjacent to Nagawara lake,
Nagawara, Bangalore - 560 045
E: skauser at rocketsoftware.com<mailto:skauser at rocketsoftware.com>

Rocket Software, Inc. and subsidiaries ? 77 Fourth Avenue, Waltham MA 02451 ? Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy

This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.