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

Peter Otten __peter__ at web.de
Tue Mar 12 09:27:01 EDT 2019


Saba Kauser wrote:

> 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)

I know nothing about what you are up to, but this looks odd to me. Wouldn't 
you need to call the superclass method install.run(self) *before* your 
custom code with the for loop?


>     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. Howeever, 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?
> 
> --------------------------------------------------------------------
> 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.





More information about the Python-list mailing list