[Distutils] docs on using setuptools in a release cycle with RPMS

Noah Gift noah.gift at gmail.com
Thu Jan 17 15:54:06 CET 2008


On Jan 17, 2008, at 9:32 AM, Phillip J. Eby wrote:

> At 04:16 AM 1/17/2008 -0500, Noah Gift wrote:
>> I am trying to get egg generation entry points integrated with
>> building RPM's, and hopefully debian packages too.  I haven't had  
>> much
>> luck finding any documentation on this though.  My specific  
>> question is:
>>
>> Can I use:
>>
>> python2.5 ./setup.py bdist_rpm --binary-only --release=py25 -- 
>> python=/
>> usr/local/bin/python2.5
>>
>>
>> and expect that an console script entry point I define in setup.py
>> will install to the bin directory for an rpm as well?
>
> Give it a try and see.  :)  (Yes, setuptools does support bdist_rpm.)

I knew you were going to say that :)  I was actually struggling a bit  
early this morning trying to figure out exactly how it works.  I was  
hoping I wouldn't have to actually give a traceback and reveal a  
stupid mistake :)

My, for now, build cycle, until I automate it, is that I create a  
build/lib directory:

Step 1:

mkdir -p build/lib

Step 2:

Place script inside of build/lib

cp script.py build/lib

Step 3:

In current directory run:

python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/ 
usr/local/bin/python2.4

Step 4:

Grab rpm out of newly created dist directory:

This process works just fine if I substitute:

python2.4 ./setup.py bdist_egg


In my setup.py I have an entry point as follows:

  entry_points="""
       [console_scripts]
       liten = liten:main
       """,
       )

I can easy install a python2.4 or a python 2.5 egg without a glitch,  
but when I install the rpm I created I am able to run my script, but I  
get this traceback:

[robroy at giftcsllc02 ~]$ liten
Traceback (most recent call last):
   File "/usr/bin/liten", line 7, in ?
     sys.exit(
   File "/usr/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/ 
pkg_resources.py", line 277, in load_entry_point
     return get_distribution(dist).load_entry_point(group, name)
   File "/usr/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/ 
pkg_resources.py", line 2179, in load_entry_point
     return ep.load()
   File "/usr/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/ 
pkg_resources.py", line 1912, in load
     entry = __import__(self.module_name, globals(),globals(),  
['__name__'])
ImportError: No module named liten

My guess is that somehow I am not creating the RPM properly, and I  
need to have a different directly structure then when creating an egg?

Thanks,


Noah





More information about the Distutils-SIG mailing list