New submission from Sean Carolan:
I'm attempting to build a Python 2.7.3 RPM but the build command from the
documentation fails. My platform is RHEL 5.9, x86_64
http://docs.python.org/2/distutils/builtdist.html#creating-rpm-packages
Steps to reproduce:
1. Download latest Python tarball to home directory.
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
2. Unpack it, configure and install it:
[scarolan@titania:~/Python-2.7.3]$ make clean; ./configure
--with-zlib=/usr/include; make; sudo make install
3. Attempt to run command in the documentation, build fails.
[scarolan@titania:~/Python-2.7.3]$ python -V
Python 2.7.3
[scarolan@titania:~/Python-2.7.3]$ python setup.py bdist_rpm
running bdist_rpm
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/rpm
creating build/bdist.linux-x86_64/rpm/SOURCES
creating build/bdist.linux-x86_64/rpm/SPECS
creating build/bdist.linux-x86_64/rpm/BUILD
creating build/bdist.linux-x86_64/rpm/RPMS
creating build/bdist.linux-x86_64/rpm/SRPMS
writing 'build/bdist.linux-x86_64/rpm/SPECS/Python.spec'
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default
file list)
writing manifest file 'MANIFEST'
creating Python-2.7.3
creating Python-2.7.3/Lib
creating Python-2.7.3/Tools
creating Python-2.7.3/Tools/scripts
making hard links in Python-2.7.3...
hard linking README - Python-2.7.3
'_struct.c' not a regular file -- skipping
hard linking setup.py - Python-2.7.3
hard linking Lib/smtpd.py - Python-2.7.3/Lib
hard linking Tools/scripts/2to3 - Python-2.7.3/Tools/scripts
hard linking Tools/scripts/idle - Python-2.7.3/Tools/scripts
hard linking Tools/scripts/pydoc - Python-2.7.3/Tools/scripts
creating dist
Creating tar archive
removing 'Python-2.7.3' (and everything under it)
copying dist/Python-2.7.3.tar.gz - build/bdist.linux-x86_64/rpm/SOURCES
building RPMs
rpmbuild -ba --define _topdir
/home/scarolan/Python-2.7.3/build/bdist.linux-x86_64/rpm --clean
build/bdist.linux-x86_64/rpm/SPECS/Python.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.64365
+ umask 022
+ cd /home/scarolan/Python-2.7.3/build/bdist.linux-x86_64/rpm/BUILD
+ cd /home/scarolan/Python-2.7.3/build/bdist.linux-x86_64/rpm/BUILD
+ rm -rf Python-2.7.3
+ /bin/gzip -dc
/home/scarolan/Python-2.7.3/build/bdist.linux-x86_64/rpm/SOURCES/Python-2.7.3.tar.gz
+ tar -xvvf -
drwxrwxr-x scarolan/scarolan 0 2013-03-26 15:26:01 Python-2.7.3/
-rw-rw-r-- scarolan/scarolan 1524 2013-03-26 15:26:01 Python-2.7.3/PKG-INFO
-rw-r--r-- scarolan/scarolan 90350 2012-04-09 18:07:36 Python-2.7.3/setup.py
-rw-r--r-- scarolan/scarolan 53744 2012-04-09 18:07:35 Python-2.7.3/README
drwxrwxr-x scarolan/scarolan 0 2013-03-26 15:26:01 Python-2.7.3/Tools/
drwxrwxr-x scarolan/scarolan 0 2013-03-26 15:26:01
Python-2.7.3/Tools/scripts/
-rwxr-xr-x scarolan/scarolan79 2012-04-09 18:07:35
Python-2.7.3/Tools/scripts/pydoc
-rwxr-xr-x scarolan/scarolan95 2012-04-09 18:07:35
Python-2.7.3/Tools/scripts/idle
-rwxr-xr-x scarolan/scarolan96 2012-04-09 18:07:35
Python-2.7.3/Tools/scripts/2to3
drwxrwxr-x scarolan/scarolan 0 2013-03-26 15:26:01 Python-2.7.3/Lib/
-rwxr-xr-x scarolan/scarolan 18543 2012-04-09 18:07:31 Python-2.7.3/Lib/smtpd.py
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Python-2.7.3
++ /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.64365
+ umask 022
+ cd /home/scarolan/Python-2.7.3/build/bdist.linux-x86_64/rpm/BUILD
+ cd Python-2.7.3
+ env 'CFLAGS=-O2 -g -m64 -mtune=generic' python setup.py build
running build
running build_ext
error: pyconfig.h: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.64365 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.64365 (%build)
error: command 'rpmbuild' failed with exit status 1
If I hard-code the location of pyconfig.h into setup.py, it still fails:
data = open('/home/scarolan/Python-2.7.3/pyconfig.h').read()
[scarolan@titania:~/Python-2.7.3]$ python setup.py bdist_rpm
running bdist_rpm
writing 'build/bdist.linux-x86_64/rpm/SPECS/Python.spec'
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default
file list)
writing manifest file 'MANIFEST'
creating Python-2.7.3
creating Python-2.7.3/Lib
creating Python-2.7.3/Tools
creating Python-2.7.3/Tools/scripts
making hard links in Python-2.7.3...
hard linking README - Python-2.7.3
'_struct.c' not a regular file -- skipping
hard linking setup.py - Python-2.7.3
hard linking Lib/smtpd.py - Python-2.7.3/Lib
hard linking Tools/scripts/2to3 - Python-2.7.3/Tools/scripts
hard linking Tools/scripts/idle - Python-2.7.3/Tools/scripts
hard linking Tools/scripts/pydoc - Python-2.7.3/Tools/scripts
Creating tar archive
removing 'Python-2.7.3' (and everything under it)
copying dist/Python-2.7.3.tar.gz - build/bdist.linux-x86_64/rpm/SOURCES
building RPMs
rpmbuild -ba --define _topdir