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

Last change on this file since 561 was 561, checked in by Yuri Dario, 10 years ago

spec: python, - r560, -O3 breaks the build, at least for pentium4 march. - r529, use unixroot path for script path replacement. Fixes ticket#114.

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