source: spec/trunk/SPECS/python.spec@ 163

Last change on this file since 163 was 163, checked in by Yuri Dario, 14 years ago

spec: python build requires updates.

  • Property svn:eol-style set to native
File size: 15.4 KB
Line 
1%{!?__python_ver:%global __python_ver EMPTY}
2#global __python_ver 26
3%global unicode ucs4
4
5%global _default_patch_fuzz 2
6
7%if "%{__python_ver}" != "EMPTY"
8%global main_python 0
9%global python python%{__python_ver}
10%global tkinter tkinter%{__python_ver}
11%else
12%global main_python 1
13%global python python
14%global tkinter tkinter
15%endif
16
17%global pybasever 2.6
18%global pybasever_cond 26
19%global pylibdir %{_libdir}/python%{pybasever}
20%global tools_dir %{pylibdir}/Tools
21%global demo_dir %{pylibdir}/Demo
22%global doc_tools_dir %{pylibdir}/Doc/tools
23%global dynload_dir %{pylibdir}/lib-dynload
24%global site_packages %{pylibdir}/site-packages
25
26%global with_gdb_hooks 0
27
28%global with_systemtap 0
29
30%global with_valgrind 0
31
32# Some of the files below /usr/lib/pythonMAJOR.MINOR/test (e.g. bad_coding.py)
33# are deliberately invalid, leading to SyntaxError exceptions if they get
34# byte-compiled.
35#
36# These errors are ignored by the normal python build, and aren't normally a
37# problem in the buildroots since /usr/bin/python isn't present.
38#
39# However, for the case where we're rebuilding the python srpm on a machine
40# that does have python installed we need to set this to avoid
41# brp-python-bytecompile treating these as fatal errors:
42#
43%global _python_bytecompile_errors_terminate_build 0
44
45Summary: An interpreted, interactive, object-oriented programming language
46Name: %{python}
47Version: 2.6.5
48Release: 3%{?dist}
49License: Python
50Group: Development/Languages
51Provides: python-abi = %{pybasever}
52Provides: python(abi) = %{pybasever}
53Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tgz
54
55Patch0: Python-%{version}-os2.diff
56Patch1: Python-%{version}-os2knix.diff
57
58%if %{main_python}
59Obsoletes: Distutils
60Provides: Distutils
61Obsoletes: python2
62Provides: python2 = %{version}
63Obsoletes: python-elementtree <= 1.2.6
64Obsoletes: python-sqlite < 2.3.2
65Provides: python-sqlite = 2.3.2
66Obsoletes: python-ctypes < 1.0.1
67Provides: python-ctypes = 1.0.1
68Obsoletes: python-hashlib < 20081120
69Provides: python-hashlib = 20081120
70Obsoletes: python-uuid < 1.31
71Provides: python-uuid = 1.31
72%endif
73
74# YD unix adds this automatically by parsing elf binaries
75Requires: %{name}-libs = %{version}-%{release}
76Requires: pthread
77Requires: gettext-libs
78
79BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
80#BuildRequires: readline-devel, openssl-devel, gmp-devel
81BuildRequires: readline-devel, openssl-devel
82#BuildRequires: gdbm-devel, zlib-devel, expat-devel
83BuildRequires: ncurses-devel, zlib-devel
84#BuildRequires: libGL-devel tk tix gcc-c++ libX11-devel glibc-devel
85#BuildRequires: tar findutils pkgconfig tcl-devel tk-devel
86BuildRequires: bzip2 pkgconfig tcl-devel
87#BuildRequires: tix-devel
88BuildRequires: bzip2-devel sqlite-devel
89#BuildRequires: autoconf
90BuildRequires: db4-devel >= 4.8
91#BuildRequires: libffi-devel
92%if 0%{?with_valgrind}
93BuildRequires: valgrind-devel
94%endif
95
96%if 0%{?with_systemtap}
97BuildRequires: systemtap-sdt-devel
98%global tapsetdir /usr/share/systemtap/tapset
99%endif
100
101URL: http://www.python.org/
102
103%description
104Python is an interpreted, interactive, object-oriented programming
105language often compared to Tcl, Perl, Scheme or Java. Python includes
106modules, classes, exceptions, very high level dynamic data types and
107dynamic typing. Python supports interfaces to many system calls and
108libraries, as well as to various windowing systems (X11, Motif, Tk,
109Mac and MFC).
110
111Programmers can write new built-in modules for Python in C or C++.
112Python can be used as an extension language for applications that need
113a programmable interface. This package contains most of the standard
114Python modules, as well as modules for interfacing to the Tix widget
115set for Tk and RPM.
116
117Note that documentation for Python is provided in the python-docs
118package.
119
120%package libs
121Summary: The libraries for python runtime
122Group: Applications/System
123Requires: %{name} = %{version}-%{release}
124# Needed for ctypes, to load libraries, worked around for Live CDs size
125# Requires: binutils
126
127%description libs
128The python interpreter can be embedded into applications wanting to
129use python as an embedded scripting language. The python-libs package
130provides the libraries needed for this.
131
132%package devel
133Summary: The libraries and header files needed for Python development
134Group: Development/Libraries
135Requires: %{python}%{?_isa} = %{version}-%{release}
136# Needed here because of the migration of Makefile from -devel to the main
137# package
138Conflicts: %{python} < %{version}-%{release}
139%if %{main_python}
140Obsoletes: python2-devel
141Provides: python2-devel = %{version}-%{release}
142%endif
143
144%description devel
145The Python programming language's interpreter can be extended with
146dynamically loaded extensions and can be embedded in other programs.
147This package contains the header files and libraries needed to do
148these types of tasks.
149
150Install python-devel if you want to develop Python extensions. The
151python package will also need to be installed. You'll probably also
152want to install the python-docs package, which contains Python
153documentation.
154
155%package tools
156Summary: A collection of development tools included with Python
157Group: Development/Tools
158Requires: %{name} = %{version}-%{release}
159Requires: %{tkinter} = %{version}-%{release}
160%if %{main_python}
161Obsoletes: python2-tools
162Provides: python2-tools = %{version}
163%endif
164
165%description tools
166This package includes several tools to help with the development of Python
167programs, including IDLE (an IDE with editing and debugging facilities), a
168color editor (pynche), and a python gettext program (pygettext.py).
169
170%package -n %{tkinter}
171Summary: A graphical user interface for the Python scripting language
172Group: Development/Languages
173#BuildRequires: tcl, tk
174Requires: %{name} = %{version}-%{release}
175%if %{main_python}
176Obsoletes: tkinter2
177Provides: tkinter2 = %{version}
178%endif
179
180%description -n %{tkinter}
181
182The Tkinter (Tk interface) program is an graphical user interface for
183the Python scripting language.
184
185You should install the tkinter package if you'd like to use a graphical
186user interface for Python programming.
187
188%package test
189Summary: The test modules from the main python package
190Group: Development/Languages
191Requires: %{name} = %{version}-%{release}
192
193%description test
194
195The test modules from the main python package: %{name}
196These have been removed to save space, as they are never or almost
197never used in production.
198
199You might want to install the python-test package if you're developing python
200code that uses more than just unittest and/or test_support.py.
201
202%prep
203%setup -q -n Python-%{version}
204
205%if 0%{?with_systemtap}
206# Provide an example of usage of the tapset:
207cp -a %{SOURCE4} .
208cp -a %{SOURCE5} .
209%endif # with_systemtap
210
211# Ensure that we're using the system copy of various libraries, rather than
212# copies shipped by upstream in the tarball:
213# Remove embedded copy of expat:
214#rm -r Modules/expat || exit 1
215# Remove embedded copy of libffi:
216#for SUBDIR in darwin libffi libffi_arm_wince libffi_msvc libffi_osx ; do
217# rm -r Modules/_ctypes/$SUBDIR || exit 1 ;
218#done
219# Remove embedded copy of zlib:
220#rm -r Modules/zlib || exit 1
221
222#
223# Apply patches:
224#
225%patch0 -p1 -b .os2~
226%patch1 -p1 -b .os2knix~
227
228mkdir Lib/plat-os2knix
229
230# This shouldn't be necesarry, but is right now (2.2a3)
231find -name "*~" |xargs rm -f
232
233%build
234CONFIG_SHELL=/bin/sh
235export CONFIG_SHELL
236LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
237export LDFLAGS
238LIBS="-lssl -lcrypto -lurpo -lmmap -lpthread"
239export LIBS
240%configure \
241 --enable-shared --disable-static \
242 "--cache-file=%{_topdir}/cache/%{name}-%{_target_cpu}.cache"
243
244make OPT="$CFLAGS" %{?_smp_mflags}
245
246%install
247rm -rf %{buildroot}
248mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}
249
250make install DESTDIR=%{buildroot}
251
252# YD fix binaries
253cp %{buildroot}%{_bindir}/python.exe %{buildroot}%{_bindir}/python
254rm -f %{buildroot}%{_bindir}/python%{pybasever_cond}.dll
255
256# Junk, no point in putting in -test sub-pkg
257rm -f %{buildroot}/%{pylibdir}/idlelib/testcode.py*
258
259# don't include tests that are run at build time in the package
260# This is documented, and used: rhbz#387401
261if /bin/false; then
262 # Move this to -test subpackage.
263mkdir save_bits_of_test
264for i in test_support.py __init__.py; do
265 cp -a %{buildroot}/%{pylibdir}/test/$i save_bits_of_test
266done
267rm -rf %{buildroot}/%{pylibdir}/test
268mkdir %{buildroot}/%{pylibdir}/test
269cp -a save_bits_of_test/* %{buildroot}/%{pylibdir}/test
270fi
271
272#%if %{main_python}
273#ln -s python %{buildroot}%{_bindir}/python2
274#%else
275#mv %{buildroot}%{_bindir}/python %{buildroot}%{_bindir}/%{python}
276#mv %{buildroot}/%{_mandir}/man1/python.1 %{buildroot}/%{_mandir}/man1/python%{pybasever}.1
277#%endif
278
279# tools
280
281mkdir -p ${RPM_BUILD_ROOT}%{site_packages}
282
283#gettext
284install -m755 Tools/i18n/pygettext.py %{buildroot}%{_bindir}/
285install -m755 Tools/i18n/msgfmt.py %{buildroot}%{_bindir}/
286
287# Useful development tools
288install -m755 -d %{buildroot}%{tools_dir}/scripts
289install Tools/README %{buildroot}%{tools_dir}/
290install Tools/scripts/*py %{buildroot}%{tools_dir}/scripts/
291
292# Documentation tools
293install -m755 -d %{buildroot}%{doc_tools_dir}
294#install -m755 Doc/tools/mkhowto %{buildroot}%{doc_tools_dir}
295
296# Useful demo scripts
297install -m755 -d %{buildroot}%{demo_dir}
298cp -ar Demo/* %{buildroot}%{demo_dir}
299
300# Get rid of crap
301find %{buildroot}/ -name "*~"|xargs rm -f
302find %{buildroot}/ -name ".cvsignore"|xargs rm -f
303find . -name "*~"|xargs rm -f
304find . -name ".cvsignore"|xargs rm -f
305#zero length
306rm -f %{buildroot}%{site_packages}/modulator/Templates/copyright
307
308rm -f %{buildroot}%{pylibdir}/LICENSE.txt
309
310
311#make the binaries install side by side with the main python
312#%if !%{main_python}
313#pushd %{buildroot}%{_bindir}
314#mv idle idle%{__python_ver}
315#mv modulator modulator%{__python_ver}
316#mv pynche pynche%{__python_ver}
317#mv pygettext.py pygettext%{__python_ver}.py
318#mv msgfmt.py msgfmt%{__python_ver}.py
319#mv smtpd.py smtpd%{__python_ver}.py
320#mv pydoc pydoc%{__python_ver}
321#popd
322#%endif
323
324# Fix for bug #136654
325rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au
326
327%global _pyconfig_h pyconfig.h
328
329# Get rid of egg-info files (core python modules are installed through rpms)
330rm %{buildroot}%{pylibdir}/*.egg-info
331
332%clean
333rm -fr %{buildroot}
334
335#%post libs -p /sbin/ldconfig
336
337#%postun libs -p /sbin/ldconfig
338
339
340%files
341%defattr(-, root, root, -)
342%doc LICENSE README
343%{_bindir}/pydoc*
344%{_bindir}/%{python}
345%{_bindir}/%{python}.exe
346%if %{main_python}
347#%{_bindir}/python2
348%endif
349%{_bindir}/python%{pybasever}.exe
350%{_mandir}/*/*
351
352%dir %{pylibdir}
353%dir %{dynload_dir}
354%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info
355%{dynload_dir}/_bisect.pyd
356%{dynload_dir}/_bsddb.pyd
357%{dynload_dir}/_bytesio.pyd
358%{dynload_dir}/_codecs_.pyd
359#%{dynload_dir}/_codecs_hk.pyd
360#%{dynload_dir}/_codecs_iso2022.pyd
361#%{dynload_dir}/_codecs_jp.pyd
362#%{dynload_dir}/_codecs_kr.pyd
363#%{dynload_dir}/_codecs_tw.pyd
364%{dynload_dir}/_collect.pyd
365%{dynload_dir}/_csv.pyd
366#%{dynload_dir}/_ctypes.pyd
367%{dynload_dir}/_curses.pyd
368%{dynload_dir}/_curses_.pyd
369%{dynload_dir}/_element.pyd
370%{dynload_dir}/_fileio.pyd
371%{dynload_dir}/_functoo.pyd
372%{dynload_dir}/_hashlib.pyd
373%{dynload_dir}/_heapq.pyd
374%{dynload_dir}/_hotshot.pyd
375%{dynload_dir}/_json.pyd
376%{dynload_dir}/_locale.pyd
377%{dynload_dir}/_lsprof.pyd
378#%{dynload_dir}/_md5.pyd
379%{dynload_dir}/_multiby.pyd
380%{dynload_dir}/_multipr.pyd
381%{dynload_dir}/_random.pyd
382#%{dynload_dir}/_sha256.pyd
383#%{dynload_dir}/_sha512.pyd
384#%{dynload_dir}/_sha.pyd
385%{dynload_dir}/_socket.pyd
386%{dynload_dir}/_sqlite3.pyd
387%{dynload_dir}/_ssl.pyd
388%{dynload_dir}/_struct.pyd
389%{dynload_dir}/_weakref.pyd
390%{dynload_dir}/array.pyd
391%{dynload_dir}/audioop.pyd
392%{dynload_dir}/binascii.pyd
393%{dynload_dir}/bz2.pyd
394%{dynload_dir}/cPickle.pyd
395%{dynload_dir}/cStringI.pyd
396%{dynload_dir}/cmath.pyd
397%{dynload_dir}/crypt.pyd
398%{dynload_dir}/datetime.pyd
399%{dynload_dir}/dbm.pyd
400%{dynload_dir}/dl.pyd
401%{dynload_dir}/fcntl.pyd
402%{dynload_dir}/future_b.pyd
403#%{dynload_dir}/gdbm.pyd
404%{dynload_dir}/grp.pyd
405%{dynload_dir}/imageop.pyd
406%{dynload_dir}/itertool.pyd
407#%{dynload_dir}/linuxaudiodev.pyd
408%{dynload_dir}/math.pyd
409#%{dynload_dir}/mmap.pyd
410#%{dynload_dir}/nis.pyd
411%{dynload_dir}/operator.pyd
412#%{dynload_dir}/ossaudiodev.pyd
413%{dynload_dir}/parser.pyd
414%{dynload_dir}/pyexpat.pyd
415%{dynload_dir}/readline.pyd
416%{dynload_dir}/resource.pyd
417%{dynload_dir}/select.pyd
418#%{dynload_dir}/spwd.pyd
419%{dynload_dir}/strop.pyd
420%{dynload_dir}/syslog.pyd
421%{dynload_dir}/termios.pyd
422%{dynload_dir}/time.pyd
423#%{dynload_dir}/timing.pyd
424%{dynload_dir}/unicoded.pyd
425#%{dynload_dir}/xxsubtype.pyd
426%{dynload_dir}/zlib.pyd
427
428%dir %{site_packages}
429%{site_packages}/README
430%{pylibdir}/*.py*
431%{pylibdir}/*.doc
432%dir %{pylibdir}/bsddb
433%{pylibdir}/bsddb/*.py*
434%{pylibdir}/compiler
435%dir %{pylibdir}/ctypes
436%{pylibdir}/ctypes/*.py*
437%{pylibdir}/ctypes/macholib
438%{pylibdir}/curses
439%dir %{pylibdir}/distutils
440%{pylibdir}/distutils/*.py*
441%{pylibdir}/distutils/README
442%{pylibdir}/distutils/command
443%dir %{pylibdir}/email
444%{pylibdir}/email/*.py*
445%{pylibdir}/email/mime
446%{pylibdir}/encodings
447%{pylibdir}/hotshot
448%{pylibdir}/idlelib
449%dir %{pylibdir}/json
450%{pylibdir}/json/*.py*
451%{pylibdir}/lib2to3
452%{pylibdir}/logging
453%{pylibdir}/multiprocessing
454%{pylibdir}/plat-os2knix
455%dir %{pylibdir}/sqlite3
456%{pylibdir}/sqlite3/*.py*
457%dir %{pylibdir}/test
458%{pylibdir}/test/test_support.py*
459%{pylibdir}/test/__init__.py*
460%{pylibdir}/wsgiref
461%{pylibdir}/xml
462
463# "Makefile" and the config-32/64.h file are needed by
464# distutils/sysconfig.py:_init_posix(), so we include them in the core
465# package, along with their parent directories (bug 531901):
466%dir %{pylibdir}/config
467%{pylibdir}/config/Makefile
468%dir %{_includedir}/python%{pybasever}
469%{_includedir}/python%{pybasever}/%{_pyconfig_h}
470
471%files libs
472%defattr(-,root,root,-)
473#%doc LICENSE README
474%{_libdir}/python%{pybasever_cond}.dll
475%if 0%{?with_systemtap}
476%{tapsetdir}/%{libpython_stp}
477%doc systemtap-example.stp pyfuntop.stp
478%endif
479
480%files devel
481%defattr(-,root,root,-)
482%{pylibdir}/config/*
483%exclude %{pylibdir}/config/Makefile
484%{_includedir}/python%{pybasever}/*.h
485%exclude %{_includedir}/python%{pybasever}/%{_pyconfig_h}
486%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
487%if %{main_python}
488%{_bindir}/python-config
489%endif
490%{_bindir}/python%{pybasever}-config
491#%{_libdir}/libpython%{pybasever}.pyd
492%{_libdir}/python%{pybasever}_dll.a
493
494%files tools
495%defattr(-,root,root,755)
496#%doc Tools/modulator/README.modulator
497#%doc Tools/pynche/README.pynche
498#%{site_packages}/modulator
499#%{site_packages}/pynche
500%{_bindir}/smtpd*.py*
501%{_bindir}/2to3*
502%{_bindir}/idle*
503#%{_bindir}/modulator*
504#%{_bindir}/pynche*
505%{_bindir}/pygettext*.py*
506%{_bindir}/msgfmt*.py*
507%{tools_dir}
508%{demo_dir}
509%{pylibdir}/Doc
510
511%files -n %{tkinter}
512%defattr(-,root,root,755)
513%{pylibdir}/lib-tk
514#%{dynload_dir}/_tkinter.pyd
515
516%files test
517%defattr(-, root, root, -)
518%{pylibdir}/bsddb/test
519%{pylibdir}/ctypes/test
520%{pylibdir}/distutils/tests
521%{pylibdir}/email/test
522%{pylibdir}/json/tests
523%{pylibdir}/sqlite3/test
524%{pylibdir}/test/*
525# These two are shipped in the main subpackage:
526%exclude %{pylibdir}/test/test_support.py*
527%exclude %{pylibdir}/test/__init__.py*
528%{dynload_dir}/_ctypes_.pyd
529%{dynload_dir}/_testcap.pyd
530
531# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from
532# ldconfig (rhbz:562980).
533#
534# The /usr/lib/rpm/redhat/macros defines %__debug_package to use
535# debugfiles.list, and it appears that everything below /usr/lib/debug and
536# (/usr/src/debug) gets added to this file (via LISTFILES) in
537# /usr/lib/rpm/find-debuginfo.sh
538#
539# Hence by installing it below /usr/lib/debug we ensure it is added to the
540# -debuginfo subpackage
541# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
542# payload file would be unpackaged)
543
544%changelog
Note: See TracBrowser for help on using the repository browser.