`python setup.py bdist_rpm` fails

Bug #175839 reported by Alexander Belchenko on 2007-12-12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Joe Julian
Joe Julian

Bug Description

I want to create RPM package for my custom Linux configuration. I ran `python setup.py bdist_rpm` (standard python distutils action) but it fails due missing manpage file.

This bug directly related to https://bugs.launchpad.net/bzr/+bug/125521.

For setuptools I wrote hackish workaround, but now problem arise again (for RPM).

There is some problematic points in current setup.py re bdist_rpm.

1) manpage created automatically when someone run `python setup.py build` but this target missed in the case of setuptools.
2) bdist_rpm uses `python setup.py sdist` command to create source tarball first, and this tarball contains only bzrlib-python sources, bzr script, README and setup.py script.
  a) I want to note that auto-generated C-extensions sources (from Pyrex code) is not included to sdist tarball, and header file (bzrlib/_dirstate_helper_c.h) too. Therefore bdist_rpm can't build C-extensions.
  b) sdist tarball misses generate_docs.py script and related tools/doc_generate package, therefore building manpage from scratch is impossible. Furthermore, setup.py try to import generate_docs unconditionally and raise ImportError as result.
3) main function setup() try to install manpage conditionally if target is not bdist_eggs. And because previous steps fails, this step fails as well.

To fix this issues we should:

1) Create valid MANIFEST.in to include all required non-python sources and files into sdist tarball
2) Ship bzr-release.tar,gz with manpage inside
3) Make import of generate_docs conditional and catch ImportError
4) Factor out manpage generation from custom build command to build_man subcommand of build to provide compatibility with setuptools and bdist_rpm

We should not put generate_docs.py and tools/doc_generate to sdist tarball, because it's not intended to install to python/site-packages libraries.

Related branches

Martin Pool (mbp) wrote :

That sounds like a good plan to me.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Joe Julian (joe.julian) wrote :

The attached MANIFEST.in works to build bdist_rpm with one caveat. There's a bug in distutils on distros that compress man pages: http://bugs.python.org/issue644744

After applying the bdist_rpm.py patch on the bug page to my python 2.6.2-2.fc12 and adding the attached MANIFEST.in to revno 4947, I was able to successfully build an RPM package.

Per Johansson (per.j) wrote :

Here's the rather convoluted command I use to build 2.0.x rpms on CentOS 5 (python 2.4). Not sure if it helps or not...

echo 'python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES ; sed -i -e "s,man/man\([[:digit:]]\)/\(.\+\.[[:digit:]]\)$,man/man\1/\2.gz,g" INSTALLED_FILES' > rpm-install.sh ; env PYTHONPATH=`pwd` CPPFLAGS="-I`pwd`/bzrlib" python setup.py bdist_rpm --install-script=`pwd`/rpm-install.sh --doc-files=

John A Meinel (jameinel) on 2010-01-13
Changed in bzr:
assignee: nobody → Joe Julian (joe-julianfamily)
milestone: none → 2.1.0rc1
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.