Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python bdist_rpm not using install_requires?

I've created a new RPM using python bdist_rpm . Normally python setup.py install would install python dependencies like websocket-client or any other package. But the RPM just refuses to install anything.

Apparently the suggestion from various other posts seem to be in the line of just requiring them in setup.cfg as rpm packages. This doesn't make sense to me since most of the rpm packages seem to be on really old version and I can't possibly create rpms for all the python packages i require. I need a much recent version and it doesn't make sense that the yum installs don't actually install the packages.

What is the right (clean and easiest) way to do it ? I believe if a setup.py has something like

install_requires=[
    "validictory",
    "requests",
    "netlogger>=4.3.0",
    "netifaces",
    "pyzmq",
    "psutil",
    "docopt"
],

Then it should try to either include them in the rpm or try to install it. I am trying on a clean centos vm using vagrant which I keep destroying and then install the rpm.

like image 915
Prakash Rajagaopal Avatar asked Nov 10 '22 01:11

Prakash Rajagaopal


1 Answers

Well the super hack way i used was to just add a post install script with all the requirements as easy_install installation (instead of pip because older versions may not have pip and even after installing pip, the approach failed on systems with python 2.6)

#Adding this in setup.py
options = {'bdist_rpm':{'post_install' : 'scripts/rpm_postinstall.sh'}},

Then the script is as follows:

easy_install -U <pkgnames>

Of course a post_uninstall can also be added if you want to clean up which I wouldn't because you have no clue what is using the packages installed apart from this app. The logic of the rpm approach seems to be for this but its honestly over engineering and I'd rather package all the modules with the rpm to ensure it always works. ** Screaming out for a cleaner solution **

like image 111
Prakash Rajagaopal Avatar answered Nov 14 '22 22:11

Prakash Rajagaopal