Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using setuptools with post-install and python dependencies

This is somewhat related to this question. Let's say I have a package that I want to deploy via rpm because I need to do some file copying on post-install and I have some non-python dependencies I want to declare. But let's also say I have some python dependencies that are easily available in PyPI. It seems like if I just package as an egg, an unzip followed by python setup.py install will automatically take care of my python dependencies, at the expense of losing any post-install functionality and non-python dependencies.

Is there any recommended way of doing this? I suppose I could specify this in a pre-install script, but then I'm getting into information duplication and not really using setuptools for much of anything.

(My current setup involves passing install_requires = ['dependency_name'] to setup, which works for python setup.py bdist_egg and unzip my_package.egg; python my_package/setup.py install, but not for python setup.py bdist_rpm --post-install post-install.sh and rpm --install my_package.rpm.)

like image 943
David Berger Avatar asked Aug 11 '09 18:08

David Berger


People also ask

Does pip install setuptools?

Method 1: Using pip to install Setuptools Package Step 1: Install the current version of Python3 in Linux. Step 3: Upgrade pip3 to avoid errors occurring during the installation process. Step 4: Enter the following command to install Setuptools using pip3.

Does Python include setuptools?

the setuptools is not part of the python vanilla codebase, hence not a vanilla modules. python.org installers or mac homebrew will install it for you, but if someone compile the python by himself or install it on some linux distribution he may not get it and will need to install it by himself.

What is Python setuptools used for?

Setuptools is a package development process library designed to facilitate packaging Python projects by enhancing the Python standard library distutils (distribution utilities). Essentially, if you are working with creating and distributing Python packages, it is very helpful.


1 Answers

I think it would be best if your python dependencies were available as RPMs also, and declared as dependencies in the RPM. If they aren't available elsewhere, create them yourself, and put them in your yum repository.

Running PyPI installations as a side effect of RPM installation is evil, as it won't support proper uninstallation (i.e. uninstalling your RPM will remove your package, but leave the dependencies behind, with no proper removal procedure).

like image 72
Martin v. Löwis Avatar answered Sep 26 '22 12:09

Martin v. Löwis