[Distutils] Appears bdist_rpm completely broken

Uche Ogbuji uche.ogbuji@fourthought.com
Wed Sep 20 14:29:03 2000

Andrew Kuchling wrote:

> >line 3, in ?
> >ImportError: cannot import name XPathParserBase
> >>>>
> What exactly is the bug? Do you not expect that ImportError to be
> raised?  Or is it just that the path names shown in tracebacks are
> wrong?

The ImportError is being raised _because_ of the wrong pathnames.  If I
perform the exact same procedure on the exact same machine with a 4Suite
installed from the distutils sdist, I get no such ImportError.

> >Further investigation turns up the culprit:  The generated pyc files
> >from the RPM have the "/var/tmp/..." hard-coded in to their imports.
> Presumably bdist_rpm shouldn't contain .pyc files, and should instead
> use a postinstall script to compile the .py files.

Incorrect.  Here is the .spec that bdist_rpm generates:

%define name 4Suite
%define version 0.9.0
%define release 1

Summary: 4Suite Description
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
Copyright: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
Vendor: Fourthought, Inc. <support@4suite.org>
Url: http://www.4suite.org

4Suite is a collection of Python tools for XML processing and

4Suite is an integrated packaging of 4DOM, 4XPath, 4XSLT, 4RDF, and


env CFLAGS="$RPM_OPT_FLAGS" python setup.py build

python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES



As you can see, there is no post-installation script registration.

Note that I can probably solve this probblem by building the RPM by hand
without the BuildRoot line or the "--root=$RPM_BUILD_ROOT" argument in
the "python setup.py...".  Of course I'll need a smarter %clean section
as well.

If so, I'll post a working .spec file for additional data.

In case it helps anyone to look at the package, there is a 4Suite sdist
available at


Note the prerequisite of


Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python