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

Last change on this file since 387 was 387, checked in by Yuri Dario, 11 years ago

spec: python, r385 and others, added support for virtualenv, added debug package.

  • Property svn:eol-style set to native
File size: 16.2 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: 9%{?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%package debug
203Summary: HLL debug data for exception handling support.
204
205%description debug
206HLL debug data for exception handling support.
207
208%prep
209%setup -q -n Python-%{version}
210
211%if 0%{?with_systemtap}
212# Provide an example of usage of the tapset:
213cp -a %{SOURCE4} .
214cp -a %{SOURCE5} .
215%endif # with_systemtap
216
217# Ensure that we're using the system copy of various libraries, rather than
218# copies shipped by upstream in the tarball:
219# Remove embedded copy of expat:
220#rm -r Modules/expat || exit 1
221# Remove embedded copy of libffi:
222#for SUBDIR in darwin libffi libffi_arm_wince libffi_msvc libffi_osx ; do
223# rm -r Modules/_ctypes/$SUBDIR || exit 1 ;
224#done
225# Remove embedded copy of zlib:
226#rm -r Modules/zlib || exit 1
227
228#
229# Apply patches:
230#
231%patch0 -p1 -b .os2~
232%patch1 -p1 -b .os2knix~
233
234mkdir Lib/plat-os2knix
235
236# This shouldn't be necesarry, but is right now (2.2a3)
237find -name "*~" |xargs rm -f
238
239%build
240export CONFIG_SHELL="/@unixroot/usr/bin/sh.exe"
241export LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
242export LIBS="-lssl -lcrypto -lurpo -lmmap -lpthread -lintl"
243%configure \
244 --enable-shared --disable-static \
245 --with-system-ffi --with-libs='-lmmap' \
246 "--cache-file=%{_topdir}/cache/%{name}-%{_target_cpu}.cache"
247
248make OPT="$CFLAGS" %{?_smp_mflags}
249
250%install
251rm -rf %{buildroot}
252mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}
253
254make install DESTDIR=%{buildroot}
255
256# YD fix binaries
257cp %{buildroot}%{_bindir}/python.exe %{buildroot}%{_bindir}/python
258rm -f %{buildroot}%{_bindir}/python%{pybasever_cond}.dll
259
260# Junk, no point in putting in -test sub-pkg
261rm -f %{buildroot}/%{pylibdir}/idlelib/testcode.py*
262
263# don't include tests that are run at build time in the package
264# This is documented, and used: rhbz#387401
265if /bin/false; then
266 # Move this to -test subpackage.
267mkdir save_bits_of_test
268for i in test_support.py __init__.py; do
269 cp -a %{buildroot}/%{pylibdir}/test/$i save_bits_of_test
270done
271rm -rf %{buildroot}/%{pylibdir}/test
272mkdir %{buildroot}/%{pylibdir}/test
273cp -a save_bits_of_test/* %{buildroot}/%{pylibdir}/test
274fi
275
276#%if %{main_python}
277#ln -s python %{buildroot}%{_bindir}/python2
278#%else
279#mv %{buildroot}%{_bindir}/python %{buildroot}%{_bindir}/%{python}
280#mv %{buildroot}/%{_mandir}/man1/python.1 %{buildroot}/%{_mandir}/man1/python%{pybasever}.1
281#%endif
282
283# tools
284
285mkdir -p ${RPM_BUILD_ROOT}%{site_packages}
286
287#gettext
288install -m755 Tools/i18n/pygettext.py %{buildroot}%{_bindir}/
289install -m755 Tools/i18n/msgfmt.py %{buildroot}%{_bindir}/
290
291# Useful development tools
292install -m755 -d %{buildroot}%{tools_dir}/scripts
293install Tools/README %{buildroot}%{tools_dir}/
294install Tools/scripts/*py %{buildroot}%{tools_dir}/scripts/
295
296# Documentation tools
297install -m755 -d %{buildroot}%{doc_tools_dir}
298#install -m755 Doc/tools/mkhowto %{buildroot}%{doc_tools_dir}
299
300# Useful demo scripts
301install -m755 -d %{buildroot}%{demo_dir}
302cp -ar Demo/* %{buildroot}%{demo_dir}
303
304# Get rid of crap
305find %{buildroot}/ -name "*~"|xargs rm -f
306find %{buildroot}/ -name ".cvsignore"|xargs rm -f
307find . -name "*~"|xargs rm -f
308find . -name ".cvsignore"|xargs rm -f
309#zero length
310rm -f %{buildroot}%{site_packages}/modulator/Templates/copyright
311
312rm -f %{buildroot}%{pylibdir}/LICENSE.txt
313
314
315#make the binaries install side by side with the main python
316#%if !%{main_python}
317#pushd %{buildroot}%{_bindir}
318#mv idle idle%{__python_ver}
319#mv modulator modulator%{__python_ver}
320#mv pynche pynche%{__python_ver}
321#mv pygettext.py pygettext%{__python_ver}.py
322#mv msgfmt.py msgfmt%{__python_ver}.py
323#mv smtpd.py smtpd%{__python_ver}.py
324#mv pydoc pydoc%{__python_ver}
325#popd
326#%endif
327
328# Fix for bug #136654
329rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au
330
331%global _pyconfig_h pyconfig.h
332
333# Get rid of egg-info files (core python modules are installed through rpms)
334rm %{buildroot}%{pylibdir}/*.egg-info
335
336%clean
337rm -fr %{buildroot}
338
339#%post libs -p /sbin/ldconfig
340
341#%postun libs -p /sbin/ldconfig
342
343
344%post
345if [ "$1" = 1 ] ; then
346#execute only on first install
347%cube {DELLINE "SET PYTHONPATH="} c:\config.sys > NUL
348%cube {DELLINE "SET PYTHONHOME="} c:\config.sys > NUL
349fi
350
351
352%files
353%defattr(-, root, root, -)
354%doc LICENSE README
355%{_bindir}/pydoc*
356%{_bindir}/%{python}
357%{_bindir}/%{python}.exe
358%if %{main_python}
359#%{_bindir}/python2
360%endif
361%{_bindir}/python%{pybasever}.exe
362%{_mandir}/*/*
363%exclude %{_bindir}/*.dbg
364
365%dir %{pylibdir}
366%dir %{dynload_dir}
367%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info
368%{dynload_dir}/_bisect.pyd
369%{dynload_dir}/_bsddb.pyd
370%{dynload_dir}/_bytesio.pyd
371%{dynload_dir}/_codecs_.pyd
372#%{dynload_dir}/_codecs_hk.pyd
373#%{dynload_dir}/_codecs_iso2022.pyd
374#%{dynload_dir}/_codecs_jp.pyd
375#%{dynload_dir}/_codecs_kr.pyd
376#%{dynload_dir}/_codecs_tw.pyd
377%{dynload_dir}/_collect.pyd
378%{dynload_dir}/_csv.pyd
379#%{dynload_dir}/_ctypes.pyd
380%{dynload_dir}/_curses.pyd
381%{dynload_dir}/_curses_.pyd
382%{dynload_dir}/_element.pyd
383%{dynload_dir}/_fileio.pyd
384#%{dynload_dir}/_functoo.pyd
385%{dynload_dir}/_hashlib.pyd
386%{dynload_dir}/_heapq.pyd
387%{dynload_dir}/_hotshot.pyd
388%{dynload_dir}/_json.pyd
389#%{dynload_dir}/_locale.pyd
390%{dynload_dir}/_lsprof.pyd
391#%{dynload_dir}/_md5.pyd
392%{dynload_dir}/_multiby.pyd
393%{dynload_dir}/_multipr.pyd
394%{dynload_dir}/_random.pyd
395#%{dynload_dir}/_sha256.pyd
396#%{dynload_dir}/_sha512.pyd
397#%{dynload_dir}/_sha.pyd
398%{dynload_dir}/_socket.pyd
399%{dynload_dir}/_sqlite3.pyd
400%{dynload_dir}/_ssl.pyd
401%{dynload_dir}/_struct.pyd
402%{dynload_dir}/_weakref.pyd
403%{dynload_dir}/array.pyd
404%{dynload_dir}/audioop.pyd
405%{dynload_dir}/binascii.pyd
406%{dynload_dir}/bz2.pyd
407%{dynload_dir}/cPickle.pyd
408%{dynload_dir}/cStringI.pyd
409%{dynload_dir}/cmath.pyd
410%{dynload_dir}/crypt.pyd
411%{dynload_dir}/datetime.pyd
412%{dynload_dir}/dbm.pyd
413%{dynload_dir}/dl.pyd
414%{dynload_dir}/fcntl.pyd
415%{dynload_dir}/future_b.pyd
416#%{dynload_dir}/gdbm.pyd
417%{dynload_dir}/grp.pyd
418%{dynload_dir}/imageop.pyd
419%{dynload_dir}/itertool.pyd
420#%{dynload_dir}/linuxaudiodev.pyd
421%{dynload_dir}/math.pyd
422#%{dynload_dir}/mmap.pyd
423#%{dynload_dir}/nis.pyd
424#%{dynload_dir}/operator.pyd
425#%{dynload_dir}/ossaudiodev.pyd
426%{dynload_dir}/parser.pyd
427%{dynload_dir}/pyexpat.pyd
428%{dynload_dir}/readline.pyd
429%{dynload_dir}/resource.pyd
430%{dynload_dir}/select.pyd
431#%{dynload_dir}/spwd.pyd
432%{dynload_dir}/strop.pyd
433%{dynload_dir}/syslog.pyd
434%{dynload_dir}/termios.pyd
435%{dynload_dir}/time.pyd
436#%{dynload_dir}/timing.pyd
437%{dynload_dir}/unicoded.pyd
438#%{dynload_dir}/xxsubtype.pyd
439%{dynload_dir}/zlib.pyd
440
441%dir %{site_packages}
442%{site_packages}/README
443%{pylibdir}/*.py*
444%{pylibdir}/*.doc
445%dir %{pylibdir}/bsddb
446%{pylibdir}/bsddb/*.py*
447%{pylibdir}/compiler
448%dir %{pylibdir}/ctypes
449%{pylibdir}/ctypes/*.py*
450%{pylibdir}/ctypes/macholib
451%{pylibdir}/curses
452%dir %{pylibdir}/distutils
453%{pylibdir}/distutils/*.py*
454%{pylibdir}/distutils/README
455%{pylibdir}/distutils/command
456%dir %{pylibdir}/email
457%{pylibdir}/email/*.py*
458%{pylibdir}/email/mime
459%{pylibdir}/encodings
460%{pylibdir}/hotshot
461%{pylibdir}/idlelib
462%dir %{pylibdir}/json
463%{pylibdir}/json/*.py*
464%{pylibdir}/lib2to3
465%{pylibdir}/logging
466%{pylibdir}/multiprocessing
467%{pylibdir}/plat-os2knix
468%dir %{pylibdir}/sqlite3
469%{pylibdir}/sqlite3/*.py*
470%dir %{pylibdir}/test
471%{pylibdir}/test/test_support.py*
472%{pylibdir}/test/__init__.py*
473%{pylibdir}/wsgiref
474%{pylibdir}/xml
475
476# "Makefile" and the config-32/64.h file are needed by
477# distutils/sysconfig.py:_init_posix(), so we include them in the core
478# package, along with their parent directories (bug 531901):
479%dir %{pylibdir}/config
480%{pylibdir}/config/Makefile
481%dir %{_includedir}/python%{pybasever}
482%{_includedir}/python%{pybasever}/%{_pyconfig_h}
483
484%files libs
485%defattr(-,root,root,-)
486#%doc LICENSE README
487%{_libdir}/python%{pybasever_cond}.dll
488%if 0%{?with_systemtap}
489%{tapsetdir}/%{libpython_stp}
490%doc systemtap-example.stp pyfuntop.stp
491%endif
492%exclude %{_libdir}/*.dbg
493
494%files devel
495%defattr(-,root,root,-)
496%{pylibdir}/config/*
497%exclude %{pylibdir}/config/Makefile
498%{_includedir}/python%{pybasever}/*.h
499%exclude %{_includedir}/python%{pybasever}/%{_pyconfig_h}
500%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
501%if %{main_python}
502%{_bindir}/python-config
503%endif
504%{_bindir}/python%{pybasever}-config
505#%{_libdir}/libpython%{pybasever}.pyd
506%{_libdir}/python%{pybasever}_dll.a
507
508%files tools
509%defattr(-,root,root,755)
510#%doc Tools/modulator/README.modulator
511#%doc Tools/pynche/README.pynche
512#%{site_packages}/modulator
513#%{site_packages}/pynche
514%{_bindir}/smtpd*.py*
515%{_bindir}/2to3*
516%{_bindir}/idle*
517#%{_bindir}/modulator*
518#%{_bindir}/pynche*
519%{_bindir}/pygettext*.py*
520%{_bindir}/msgfmt*.py*
521%{tools_dir}
522%{demo_dir}
523%{pylibdir}/Doc
524
525%files -n %{tkinter}
526%defattr(-,root,root,755)
527%{pylibdir}/lib-tk
528#%{dynload_dir}/_tkinter.pyd
529
530%files test
531%defattr(-, root, root, -)
532%{pylibdir}/bsddb/test
533%{pylibdir}/ctypes/test
534%{pylibdir}/distutils/tests
535%{pylibdir}/email/test
536%{pylibdir}/json/tests
537%{pylibdir}/sqlite3/test
538%{pylibdir}/test/*
539# These two are shipped in the main subpackage:
540%exclude %{pylibdir}/test/test_support.py*
541%exclude %{pylibdir}/test/__init__.py*
542%{dynload_dir}/_ctypes_.pyd
543%{dynload_dir}/_testcap.pyd
544
545# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from
546# ldconfig (rhbz:562980).
547#
548# The /usr/lib/rpm/redhat/macros defines %__debug_package to use
549# debugfiles.list, and it appears that everything below /usr/lib/debug and
550# (/usr/src/debug) gets added to this file (via LISTFILES) in
551# /usr/lib/rpm/find-debuginfo.sh
552#
553# Hence by installing it below /usr/lib/debug we ensure it is added to the
554# -debuginfo subpackage
555# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
556# payload file would be unpackaged)
557
558%files debug
559%defattr(-,root,root)
560%{_bindir}/*.dbg
561%{_libdir}/*.dbg
562
563%changelog
564* Sat Mar 15 2014 yd
565- r385 and others, added support for virtualenv.
566- added debug package with symbolic info for exceptq.
567
568* Wed Jun 05 2013 yd
569- r348, add samefile, sameopenfile, samestat to os.path module.
570
571* Thu Dec 27 2012 yd
572- fix local/bin requirements for python-tools.
573
574* Mon Jan 16 2012 yd
575- rebuild with libc 0.6.4 runtime.
Note: See TracBrowser for help on using the repository browser.