[Distutils] how to build an rpm with Egg-ified projects?
Pau Aliagas
pau at newtral.org
Tue Sep 13 13:06:38 CEST 2005
Hi all.
I've posted this question to the sqlobject list, as sqlobject has moved to
an easy-setup intallation to include formencode (also egg-ified) and take
advantage of setuptools.
I'm trying to build Fedora rpms for sqlobect as I have been doing lately, using
the "usual" python templates, but I see no way to achieve it since the
setuptools change, pardon my ignorance, and I've tried really hard.
I attach the 2 self-made spec files I use, that used to build as a non-root
user just executing:
$ rpmbuild -ba python-sqlobject.spec
Now I get these errors:
---8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<---
Traceback (most recent call last):
File "setup.py", line 47, in ?
extras_require={
File "/usr/lib/python2.3/site-packages/PIL/__init__.py", line 51, in setup
File "/usr/lib/python2.3/distutils/core.py", line 149, in setup
dist.run_commands()
File
"/home/pau/LnxZip/RPM/BUILD/SQLObject-0.6.1/setuptools-0.5a13-py2.3.egg/setuptools/dist.py",
line 417, in run_commands
File
"/home/pau/LnxZip/RPM/BUILD/SQLObject-0.6.1/setuptools-0.5a13-py2.3.egg/setuptools/dist.py",
line 426, in install_eggs
File "/usr/lib/python2.3/distutils/dist.py", line 927, in run_command
cmd_obj.run()
File
"/home/pau/LnxZip/RPM/BUILD/SQLObject-0.6.1/setuptools-0.5a13-py2.3.egg/setuptools/command/bdist_egg.py",
line 173, in run
File
"/home/pau/LnxZip/RPM/BUILD/SQLObject-0.6.1/setuptools-0.5a13-py2.3.egg/setuptools/command/bdist_egg.py",
line 161, in call_command
File "/usr/lib/python2.3/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.3/distutils/dist.py", line 927, in run_command
cmd_obj.run()
File "/usr/lib/python2.3/distutils/command/install_lib.py", line 92, in run
self.byte_compile(outfiles)
File "/usr/lib/python2.3/distutils/command/install_lib.py", line 128, in
byte_compile
dry_run=self.dry_run)
File "/usr/lib/python2.3/distutils/util.py", line 434, in byte_compile
raise ValueError, \
ValueError: invalid prefix: filename
'build/bdist.linux-i686/egg/sqlobject/boundattributes.py' doesn't start with
'/home/pau/LnxZip/tmp/python-sqlobject-0.6.1-94.pau-root-pau'
error: Bad exit status from /home/pau/LnxZip/tmp/rpm-tmp.54280 (%install)
---8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<---
What I want is a way to distribute an rpm, no need to be able o hae multiple
versions. I can make and require the needed RPMS, like formecode
Can anybody enlighten me on how to do it? I'll really appreciate it as I want
to upgrade and contribute, if possible.
Pau
-------------- next part --------------
# TemplateVer: 0.4
%{?!python:%define python python}
%{?!pybasever:%{expand:%%define pybasever %(%{__python} -c "import sys ; print sys.version[:3]")}}
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define origname SQLObject
Name: %{python}-sqlobject
Version: 0.6.1
Release: 94.pau
Summary: SQLObject is an object-relational mapper.
Group: Development/Libraries
License: LGPL
URL: http://sqlobject.org
Source0: %{origname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: %{python}-devel
Requires: python-abi = %{pybasever}
%description
SQLObject is an *object-relational mapper*. It allows you to
translate RDBMS table rows into Python objects, and manipulate those
objects to transparently manipulate the database.
In using SQLObject, you will create a class definition that will
describe how the object translates to the database table. SQLObject
will produce the code to access the database, and update the database
with your changes. The generated interface looks similar to any other
interface, and callers need not be aware of the database backend.
%prep
%setup -n %{origname}-%{version} -q
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT --record=INSTALLED_FILES.tmp
# Ghost optimized
sed 's/\(.*\.pyo\)/%ghost \1/' < INSTALLED_FILES.tmp > INSTALLED_FILES
find $RPM_BUILD_ROOT%{python_sitearch} -type d \
| sed "s|^$RPM_BUILD_ROOT|%dir |" >> INSTALLED_FILES
%clean
rm -rf $RPM_BUILD_ROOT
%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%doc README.txt docs/*
%changelog
* Mon Aug 29 2005 Pau Aliagas <pau at newtral.org> 0.6.1-94.pau
- latest CVS
- require FormEncode
* Mon Jul 4 2005 Pau Aliagas <pau at newtral.org> 0.6.1-93.pau
- latest CVS
* Wed Jun 1 2005 Pau Aliagas <pau at newtral.org> 0.6.1-92.pau
- latest CVS with SingleJoin
- update spec file
* Wed May 25 2005 Pau Aliagas <pau at newtral.org> 0.6.1-91.pau
- modify installed files to fix x86_64 version
* Tue May 24 2005 Pau Aliagas <pau at newtral.org> 0.6.1-91
- svn version
- try to update to MySQL-python-1.2.0 to access mysql-4.1
* Wed Apr 24 2005 Pau Aliagas <pau at newtral.org> 0.6.1-90
- svn version
* Wed Apr 20 2005 Pau Aliagas <pau at newtral.org> 0.6.1-1
- new version
* Wed Sep 22 2004 Jeff Pitman <symbiont+pyvault at berlios.de> 0.6-1
- new version
* Tue Sep 07 2004 Jeff Pitman <symbiont+pyvault at berlios.de> 0.5.2-1
- new version
-------------- next part --------------
# TemplateVer: 0.4
%{?!python:%define python python}
%{?!pybasever:%{expand:%%define pybasever %(%{__python} -c "import sys ; print sys.version[:3]")}}
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define origname FormEncode
Name: %{python}-formencode
Version: 0.2.2
Release: 2088.1
Summary: HTML form validation, generation, and convertion package
Group: Development/Libraries
License: Python Software Foundation License
URL: http://formencode.org/
Source0: %{origname}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: %{python}-devel
Requires: python-abi = %{pybasever}
%description
FormEncode performs look-before-you-leap validation. The idea being that you check all the data related to an operation, then apply it.
%prep
%setup -n %{origname}-%{version} -q
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT --record=INSTALLED_FILES.tmp
# Ghost optimized
sed 's/\(.*\.pyo\)/%ghost \1/' < INSTALLED_FILES.tmp > INSTALLED_FILES
find $RPM_BUILD_ROOT%{python_sitearch} -type d \
| sed "s|^$RPM_BUILD_ROOT|%dir |" >> INSTALLED_FILES
%clean
rm -rf $RPM_BUILD_ROOT
%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%doc docs/*
%changelog
* Tue Sep 13 2005 Pau Aliagas <pau at newtral.org> 0.2.2-2088.1
- updated version from svn trunk
* Mon Aug 29 2005 Pau Aliagas <pau at newtral.org> 1.0-763
- first version from svn trunk
More information about the Distutils-SIG
mailing list