0

I am trying to create a rpm using setup.py bdist_rpm.

Python version is 2.6.6

My project structure looks like

ncm
  - __init__.py
  - some_thing.py
     ...
     ...
setup.py
setup.cfg

setup.py looks like:

from setuptools import setup, find_packages

setup(name='name of module',
      version='1.0',
      install_requires=[
          'IPy',
          'pyro'
      ],
      author = 'author',
      long_description = "description of module ",
      author_email='support@mycompany.com',
      packages=find_packages(),
      description = "long description of module",
      license = 'GPLv2+'
      )

setup.cfg contains:

[bdist_rpm]
requires = python >= 2.6, iscsi-initiator-utils, sg3_utils, device-mapper-multipath
release = 1
group = "Applications/Tools"

If IPy and pyro are not installed in the system where the generated RPM is being installed then they should be downloaded and installed automatically right?... This doesn't happen and also, I don't see setup.py getting put on the machine where RPM is being installed. This file, I guess, should be there cause in the %INSTALL section of .spec I can see

python setup.py intall ...

I got the spec file by doing cpio on the src.rpm

I am new to Python, as well as packaging.... Please help!!

  • The `%install` section of a spec file is run at RPM build not on the machine where the RPM gets installed. – Etan Reisner Oct 30 '14 at 02:50
  • oh... I told you I was new :) Thanks... Then where should I put the script I want to be run on the client machine? should it be in the post install section? Any tips on how to do this using setup.py? – Manu Mehrotra Oct 30 '14 at 02:55
  • `%post` is run on the client machine, yes. Generally though RPMs don't go about installing things *after* they've been installed though. Generally they contain the things *to be installed*. – Etan Reisner Oct 30 '14 at 03:08
  • ok... then suppose I want to install IPy and pyro on the clients machine before launching my daemons then what options do I have? 1) I can call setup.py install in %post.. apart from this can you suggest any other option? (IPy and Pyro are python modules that easy_install needs to download and install) – Manu Mehrotra Oct 30 '14 at 03:15
  • I'm not sure how best to approach that from an RPM perspective. Unless those have RPM packages themselves (or you build ones for them also). Does the bdist_rpm built RPM have dependencies on either of those packages listed in its metadata (`rpm -qpR `)? – Etan Reisner Oct 30 '14 at 03:17
  • actually no it doesn't... I was planning to run a post install script which will get the IPy and Pyro from pypi... install_requires=['IPy','pyro'] in the script above tells easy_install to get IPy and pyro from pypi when "setup.py install" is executed... – Manu Mehrotra Oct 30 '14 at 03:21
  • Yeah, I'm not at all sure what the expected design is here for bdist_rpm. I think either skipping an rpm entirely or packaging the deps as RPMs also is likely the right solution. Though which is better depends on a number of things. – Etan Reisner Oct 30 '14 at 03:22

0 Answers0