[Distutils] In using bdist_rpm, how do I get documentation files to go where they belong?

Stanley A. Klein sklein at cpcug.org
Fri Jul 13 21:33:40 CEST 2007


Now that I understand how to prepare the setup.cfg for Fedora, I have been
able to generate some rpms for Python packages using bdist_rpm.

However, using only find_packages() causes only the executable part to be
packaged.  I have made various attempts to get the documentation packaged
without success.

1.  The first issue is that I get a peculiar error that may be an
incorrect setup.py/setup.cfg or may be a bug.  The result of the attempt
is an error in copying a file called "d" that I didn't declare and doesn't
exist.  I did declare a directory called "docs".

2.  The second issue is that Fedora wants to put documentation files in
/usr/share/doc/package_name_and_version and I can't figure out how to make
that happen.  This placement of documentation is specified under the Unix
Filesystem Hierarchy Standard referenced under the Linux Standards Base. 
The same standard specifies configuration files going under /etc, and the
same issue applies if there are any such files.

Below is an example from an attempt to package MojoView (from the Python
Cheeseshop) with a modified setup.py.

I would appreciate any help.

Thanks.


Stan Klein

------------------------- MojoView packaging attempt  -----------------

My setup.py is:

from setuptools import setup, find_packages

setup(name="MojoView",
      version="1.0",
      description="Simple framwork for building PyGTK database applications",
      author="Jamey Cribbs",
      author_email="jcribbs at twmi.rr.com",
      url="http://www.netpromi.com/mojoview.html",
      packages = find_packages(),
      data_files = [("docs", "docs/*"),
                    ("examples", "examples/*"),
                    ("gtk", "gtk/*"),
                    ("readme.txt", "readme.txt")]
     )

The setup.cfg is:

#setup.cfg to get proper rpms

[install]
optimize = 1

[bdist_rpm]
doc_files = readme.txt
            docs/
            gtk/
            examples/

The output from the attempt is:


[stan at localhost MojoView-1.0]$ python setup.py bdist_rpm
running bdist_rpm
running egg_info
writing MojoView.egg-info/PKG-INFO
writing top-level names to MojoView.egg-info/top_level.txt
writing dependency_links to MojoView.egg-info/dependency_links.txt
reading manifest file 'MojoView.egg-info/SOURCES.txt'
writing manifest file 'MojoView.egg-info/SOURCES.txt'
writing 'build/bdist.linux-i686/rpm/SPECS/MojoView.spec'
running sdist
warning: sdist: standard file not found: should have one of README,
README.txt
creating MojoView-1.0
creating MojoView-1.0/MojoView.egg-info
creating MojoView-1.0/mojoview
making hard links in MojoView-1.0...
hard linking setup.cfg -> MojoView-1.0
hard linking setup.py -> MojoView-1.0
hard linking MojoView.egg-info/PKG-INFO -> MojoView-1.0/MojoView.egg-info
hard linking MojoView.egg-info/SOURCES.txt -> MojoView-1.0/MojoView.egg-info
hard linking MojoView.egg-info/dependency_links.txt ->
MojoView-1.0/MojoView.egg-info
hard linking MojoView.egg-info/top_level.txt ->
MojoView-1.0/MojoView.egg-info
hard linking mojoview/__init__.py -> MojoView-1.0/mojoview
hard linking mojoview/aboutwin.py -> MojoView-1.0/mojoview
hard linking mojoview/browse.py -> MojoView-1.0/mojoview
hard linking mojoview/busycursor.py -> MojoView-1.0/mojoview
hard linking mojoview/clist.py -> MojoView-1.0/mojoview
hard linking mojoview/editdaterange.py -> MojoView-1.0/mojoview
hard linking mojoview/editrec.py -> MojoView-1.0/mojoview
hard linking mojoview/editwin.py -> MojoView-1.0/mojoview
hard linking mojoview/errorwin.py -> MojoView-1.0/mojoview
hard linking mojoview/guierror.py -> MojoView-1.0/mojoview
hard linking mojoview/mainmenu.py -> MojoView-1.0/mojoview
hard linking mojoview/mv.py -> MojoView-1.0/mojoview
hard linking mojoview/notebookwin.py -> MojoView-1.0/mojoview
hard linking mojoview/toolbar.py -> MojoView-1.0/mojoview
copying setup.cfg -> MojoView-1.0
Writing MojoView-1.0/setup.cfg
tar -cf dist/MojoView-1.0.tar MojoView-1.0
gzip -f9 dist/MojoView-1.0.tar
removing 'MojoView-1.0' (and everything under it)
copying dist/MojoView-1.0.tar.gz -> build/bdist.linux-i686/rpm/SOURCES
building RPMs
rpmbuild -ba --define _topdir
/home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm --clean
build/bdist.linux-i686/rpm/SPECS/MojoView.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.61946
+ umask 022
+ cd /home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm/BUILD
+ rm -rf MojoView-1.0
+ /bin/gzip -dc
/home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm/SOURCES/MojoView-1.0.tar.gz
+ tar -xvvf -
drwxrwxr-x stan/stan         0 2007-07-13 14:37 MojoView-1.0/
drwxrwxr-x stan/stan         0 2007-07-13 14:37
MojoView-1.0/MojoView.egg-info/
-rw-rw-r-- stan/stan         9 2007-07-13 14:37
MojoView-1.0/MojoView.egg-info/top_level.txt
-rw-rw-r-- stan/stan       437 2007-07-13 14:37
MojoView-1.0/MojoView.egg-info/SOURCES.txt
-rw-rw-r-- stan/stan       276 2007-07-13 14:37
MojoView-1.0/MojoView.egg-info/PKG-INFO
-rw-rw-r-- stan/stan         1 2007-07-13 14:37
MojoView-1.0/MojoView.egg-info/dependency_links.txt
-rw-rw-rw- stan/stan       519 2007-07-12 17:00 MojoView-1.0/setup.py
drwxrwxr-x stan/stan         0 2007-07-13 14:37 MojoView-1.0/mojoview/
-rw-rw-rw- stan/stan      2034 2003-08-21 14:17
MojoView-1.0/mojoview/editdaterange.py
-rw-rw-rw- stan/stan     23415 2003-09-02 16:51
MojoView-1.0/mojoview/browse.py
-rw-rw-rw- stan/stan      2212 2003-09-02 16:38
MojoView-1.0/mojoview/notebookwin.py
-rw-rw-rw- stan/stan      1477 2003-08-08 15:41
MojoView-1.0/mojoview/editwin.py-rw-rw-rw- stan/stan       593 2003-08-08
15:41 MojoView-1.0/mojoview/busycursor.py
-rw-rw-rw- stan/stan      1829 2003-09-02 16:29
MojoView-1.0/mojoview/toolbar.py-rw-rw-rw- stan/stan     16470 2003-09-02
16:50 MojoView-1.0/mojoview/clist.py
-rw-rw-rw- stan/stan       373 2003-08-08 15:42
MojoView-1.0/mojoview/errorwin.py
-rw-rw-rw- stan/stan        26 2003-08-08 15:39
MojoView-1.0/mojoview/__init__.py
-rw-rw-rw- stan/stan       520 2003-08-12 08:56
MojoView-1.0/mojoview/aboutwin.py
-rw-rw-rw- stan/stan      3675 2003-09-02 16:39
MojoView-1.0/mojoview/mainmenu.py
-rw-rw-rw- stan/stan       317 2003-08-28 14:31 MojoView-1.0/mojoview/mv.py
-rw-rw-rw- stan/stan      1983 2003-09-03 13:18
MojoView-1.0/mojoview/guierror.py
-rw-rw-rw- stan/stan      2849 2003-09-02 16:27
MojoView-1.0/mojoview/editrec.py-rw-rw-r-- stan/stan       143 2007-07-13
14:37 MojoView-1.0/setup.cfg
-rw-rw-r-- stan/stan       276 2007-07-13 14:37 MojoView-1.0/PKG-INFO
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd MojoView-1.0
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.61946
+ umask 022
+ cd /home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm/BUILD
+ cd MojoView-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ python setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/mojoview
copying mojoview/editdaterange.py -> build/lib/mojoview
copying mojoview/browse.py -> build/lib/mojoview
copying mojoview/notebookwin.py -> build/lib/mojoview
copying mojoview/editwin.py -> build/lib/mojoview
copying mojoview/busycursor.py -> build/lib/mojoview
copying mojoview/toolbar.py -> build/lib/mojoview
copying mojoview/clist.py -> build/lib/mojoview
copying mojoview/errorwin.py -> build/lib/mojoview
copying mojoview/__init__.py -> build/lib/mojoview
copying mojoview/aboutwin.py -> build/lib/mojoview
copying mojoview/mainmenu.py -> build/lib/mojoview
copying mojoview/mv.py -> build/lib/mojoview
copying mojoview/guierror.py -> build/lib/mojoview
copying mojoview/editrec.py -> build/lib/mojoview
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.75576
+ umask 022
+ cd /home/stan/exper/mojoview/MojoView-1.0/build/bdist.linux-i686/rpm/BUILD
+ cd MojoView-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ python setup.py install --single-version-externally-managed
--root=/var/tmp/MojoView-1.0-1-buildroot --record=INSTALLED_FILES
running install
running build
running build_py
running install_lib
writing byte-compilation script '/tmp/tmp0s5onf.py'
/usr/bin/python -O /tmp/tmp0s5onf.py
removing /tmp/tmp0s5onf.py
running install_data
error: can't copy 'd': doesn't exist or not a regular file
error: Bad exit status from /var/tmp/rpm-tmp.75576 (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.75576 (%install)
error: command 'rpmbuild' failed with exit status 1








More information about the Distutils-SIG mailing list