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

Last change on this file since 782 was 782, checked in by Yuri Dario, 9 years ago

spec: python, Build python with --enable-unicode[=ucs[24]] ticket#182; Python and long dll/pyd names ticket#185.

  • Property svn:eol-style set to native
File size: 16.5 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 780
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: 13%{?dist}
53License: Python
54Group: Development/Languages
55Provides: python-abi = %{pybasever}
56Provides: python(abi) = %{pybasever}
57
58Source: %{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip
59
60BuildRequires: gcc make subversion zip
61
62%if %{main_python}
63Obsoletes: Distutils
64Provides: Distutils
65Obsoletes: python2
66Provides: python2 = %{version}
67Obsoletes: python-elementtree <= 1.2.6
68Obsoletes: python-sqlite < 2.3.2
69Provides: python-sqlite = 2.3.2
70Obsoletes: python-ctypes < 1.0.1
71Provides: python-ctypes = 1.0.1
72Obsoletes: python-hashlib < 20081120
73Provides: python-hashlib = 20081120
74Obsoletes: python-uuid < 1.31
75Provides: python-uuid = 1.31
76%endif
77
78# YD because of ucs4
79Obsoletes: python-pycurl <= 7.19.5.1-1
80Obsoletes: rpm <= 4.13.0-7
81Obsoletes: yum-metadata-parser <= 1.1.4-5
82
83# YD unix adds this automatically by parsing elf binaries
84Requires: %{name}-libs = %{version}-%{release}
85
86BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
87BuildRequires: readline-devel, openssl-devel, gmp-devel
88#BuildRequires: gdbm-devel, zlib-devel, expat-devel
89BuildRequires: ncurses-devel, zlib-devel, expat-devel
90#BuildRequires: libGL-devel tk tix gcc-c++ libX11-devel glibc-devel
91#BuildRequires: tar findutils pkgconfig tcl-devel tk-devel
92BuildRequires: bzip2 pkgconfig tcl-devel
93#BuildRequires: tix-devel
94BuildRequires: bzip2-devel sqlite-devel
95BuildRequires: autoconf
96BuildRequires: db4-devel >= 4.8
97#BuildRequires: libffi-devel
98%if 0%{?with_valgrind}
99BuildRequires: valgrind-devel
100%endif
101
102%if 0%{?with_systemtap}
103BuildRequires: systemtap-sdt-devel
104%global tapsetdir /usr/share/systemtap/tapset
105%endif
106
107# OS/2 specific
108BuildRequires: mmap urpo-devel
109
110URL: http://www.python.org/
111
112%description
113Python is an interpreted, interactive, object-oriented programming
114language often compared to Tcl, Perl, Scheme or Java. Python includes
115modules, classes, exceptions, very high level dynamic data types and
116dynamic typing. Python supports interfaces to many system calls and
117libraries, as well as to various windowing systems (X11, Motif, Tk,
118Mac and MFC).
119
120Programmers can write new built-in modules for Python in C or C++.
121Python can be used as an extension language for applications that need
122a programmable interface. This package contains most of the standard
123Python modules, as well as modules for interfacing to the Tix widget
124set for Tk and RPM.
125
126Note that documentation for Python is provided in the python-docs
127package.
128
129%package common
130Summary: An interpreted, interactive, object-oriented programming language
131Group: Development/Languages
132
133%description common
134Only binary files without versioned name. Allows multiple installations.
135
136%package libs
137Summary: The libraries for python runtime
138Group: Applications/System
139Requires: %{name} = %{version}-%{release}
140# Needed for ctypes, to load libraries, worked around for Live CDs size
141# Requires: binutils
142
143%description libs
144The python interpreter can be embedded into applications wanting to
145use python as an embedded scripting language. The python-libs package
146provides the libraries needed for this.
147
148%package devel
149Summary: The libraries and header files needed for Python development
150Group: Development/Libraries
151Requires: %{python}%{?_isa} = %{version}-%{release}
152# Needed here because of the migration of Makefile from -devel to the main
153# package
154Conflicts: %{python} < %{version}-%{release}
155%if %{main_python}
156Obsoletes: python2-devel
157Provides: python2-devel = %{version}-%{release}
158%endif
159
160%description devel
161The Python programming language's interpreter can be extended with
162dynamically loaded extensions and can be embedded in other programs.
163This package contains the header files and libraries needed to do
164these types of tasks.
165
166Install python-devel if you want to develop Python extensions. The
167python package will also need to be installed. You'll probably also
168want to install the python-docs package, which contains Python
169documentation.
170
171%package tools
172Summary: A collection of development tools included with Python
173Group: Development/Tools
174Requires: %{name} = %{version}-%{release}
175Requires: %{tkinter} = %{version}-%{release}
176%if %{main_python}
177Obsoletes: python2-tools
178Provides: python2-tools = %{version}
179%endif
180
181%description tools
182This package includes several tools to help with the development of Python
183programs, including IDLE (an IDE with editing and debugging facilities), a
184color editor (pynche), and a python gettext program (pygettext.py).
185
186%package -n %{tkinter}
187Summary: A graphical user interface for the Python scripting language
188Group: Development/Languages
189#BuildRequires: tcl, tk
190Requires: %{name} = %{version}-%{release}
191%if %{main_python}
192Obsoletes: tkinter2
193Provides: tkinter2 = %{version}
194%endif
195
196%description -n %{tkinter}
197
198The Tkinter (Tk interface) program is an graphical user interface for
199the Python scripting language.
200
201You should install the tkinter package if you'd like to use a graphical
202user interface for Python programming.
203
204%package test
205Summary: The test modules from the main python package
206Group: Development/Languages
207Requires: %{name} = %{version}-%{release}
208
209%description test
210
211The test modules from the main python package: %{name}
212These have been removed to save space, as they are never or almost
213never used in production.
214
215You might want to install the python-test package if you're developing python
216code that uses more than just unittest and/or test_support.py.
217
218%debug_package
219
220%prep
221%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}
222%setup -q
223%else
224%setup -n "%{name}-%{version}" -Tc
225svn export %{?svn_rev:-r %{svn_rev}} %{svn_url} . --force
226rm -f "%{_sourcedir}/%{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip"
227(cd .. && zip -SrX9 "%{_sourcedir}/%{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip" "%{name}-%{version}")
228%endif
229
230%if 0%{?with_systemtap}
231# Provide an example of usage of the tapset:
232cp -a %{SOURCE4} .
233cp -a %{SOURCE5} .
234%endif # with_systemtap
235
236# Ensure that we're using the system copy of various libraries, rather than
237# copies shipped by upstream in the tarball:
238# Remove embedded copy of expat:
239#rm -r Modules/expat || exit 1
240# Remove embedded copy of libffi:
241#for SUBDIR in darwin libffi libffi_arm_wince libffi_msvc libffi_osx ; do
242# rm -r Modules/_ctypes/$SUBDIR || exit 1 ;
243#done
244# Remove embedded copy of zlib:
245#rm -r Modules/zlib || exit 1
246
247# This shouldn't be necesarry, but is right now (2.2a3)
248find -name "*~" |xargs rm -f
249
250# generate configure & friends
251autoreconf -fvi
252
253%build
254export LDFLAGS="-g -Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
255export LIBS="-lssl -lcrypto -lurpo -lpthread -lintl"
256%configure \
257 --enable-shared \
258 --with-system-expat \
259 --enable-unicode=ucs4 \
260 --with-system-ffi
261
262make OPT="$CFLAGS" %{?_smp_mflags}
263
264%install
265rm -rf %{buildroot}
266mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}
267
268make install DESTDIR=%{buildroot}
269
270# YD fix binaries
271cp %{buildroot}%{_bindir}/python.exe %{buildroot}%{_bindir}/python
272rm -f %{buildroot}%{_bindir}/python%{pybasever_cond}.dll
273
274# Junk, no point in putting in -test sub-pkg
275rm -f %{buildroot}/%{pylibdir}/idlelib/testcode.py*
276
277# don't include tests that are run at build time in the package
278# This is documented, and used: rhbz#387401
279if /bin/false; then
280 # Move this to -test subpackage.
281mkdir save_bits_of_test
282for i in test_support.py __init__.py; do
283 cp -a %{buildroot}/%{pylibdir}/test/$i save_bits_of_test
284done
285rm -rf %{buildroot}/%{pylibdir}/test
286mkdir %{buildroot}/%{pylibdir}/test
287cp -a save_bits_of_test/* %{buildroot}/%{pylibdir}/test
288fi
289
290#%if %{main_python}
291#ln -s python %{buildroot}%{_bindir}/python2
292#%else
293#mv %{buildroot}%{_bindir}/python %{buildroot}%{_bindir}/%{python}
294#mv %{buildroot}/%{_mandir}/man1/python.1 %{buildroot}/%{_mandir}/man1/python%{pybasever}.1
295#%endif
296
297# tools
298
299mkdir -p ${RPM_BUILD_ROOT}%{site_packages}
300
301#gettext
302install -m755 Tools/i18n/pygettext.py %{buildroot}%{_bindir}/
303install -m755 Tools/i18n/msgfmt.py %{buildroot}%{_bindir}/
304
305# Useful development tools
306install -m755 -d %{buildroot}%{tools_dir}/scripts
307install Tools/README %{buildroot}%{tools_dir}/
308install Tools/scripts/*py %{buildroot}%{tools_dir}/scripts/
309
310# Documentation tools
311install -m755 -d %{buildroot}%{doc_tools_dir}
312#install -m755 Doc/tools/mkhowto %{buildroot}%{doc_tools_dir}
313
314# Useful demo scripts
315install -m755 -d %{buildroot}%{demo_dir}
316cp -ar Demo/* %{buildroot}%{demo_dir}
317
318# Get rid of crap
319find %{buildroot}/ -name "*~"|xargs rm -f
320find %{buildroot}/ -name ".cvsignore"|xargs rm -f
321find . -name "*~"|xargs rm -f
322find . -name ".cvsignore"|xargs rm -f
323#zero length
324rm -f %{buildroot}%{site_packages}/modulator/Templates/copyright
325
326rm -f %{buildroot}%{pylibdir}/LICENSE.txt
327
328
329#make the binaries install side by side with the main python
330#%if !%{main_python}
331#pushd %{buildroot}%{_bindir}
332#mv idle idle%{__python_ver}
333#mv modulator modulator%{__python_ver}
334#mv pynche pynche%{__python_ver}
335#mv pygettext.py pygettext%{__python_ver}.py
336#mv msgfmt.py msgfmt%{__python_ver}.py
337#mv smtpd.py smtpd%{__python_ver}.py
338#mv pydoc pydoc%{__python_ver}
339#popd
340#%endif
341
342# Fix for bug #136654
343rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au
344
345%global _pyconfig_h pyconfig.h
346
347# Get rid of egg-info files (core python modules are installed through rpms)
348rm %{buildroot}%{pylibdir}/*.egg-info
349
350%clean
351rm -fr %{buildroot}
352
353#%post libs -p /sbin/ldconfig
354
355#%postun libs -p /sbin/ldconfig
356
357
358%post
359if [ "$1" = 1 ] ; then
360#execute only on first install
361%cube {DELLINE "SET PYTHONPATH="} c:\config.sys > NUL
362%cube {DELLINE "SET PYTHONHOME="} c:\config.sys > NUL
363fi
364
365
366%files
367%defattr(-, root, root, -)
368%doc LICENSE README
369%{_bindir}/pydoc*
370%{_bindir}/python
371%{_bindir}/python.exe
372%{_bindir}/python2.exe
373%if %{main_python}
374#%{_bindir}/python2
375%endif
376%{_bindir}/python%{pybasever}.exe
377%{_mandir}/*/*
378%exclude %{_bindir}/*.dbg
379
380%dir %{pylibdir}
381%dir %{dynload_dir}
382%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info
383%{dynload_dir}/*.pyd
384%exclude %{dynload_dir}/_ctypes_test.pyd
385%exclude %{dynload_dir}/_ct3574.pyd
386%exclude %{dynload_dir}/_testcapi.pyd
387%exclude %{dynload_dir}/_te3228.pyd
388
389%dir %{site_packages}
390%{site_packages}/README
391%{pylibdir}/*.py*
392%{pylibdir}/*.doc
393%dir %{pylibdir}/bsddb
394%{pylibdir}/bsddb/*.py*
395%{pylibdir}/compiler
396%dir %{pylibdir}/ctypes
397%{pylibdir}/ctypes/*.py*
398%{pylibdir}/ctypes/macholib
399%{pylibdir}/curses
400%dir %{pylibdir}/distutils
401%{pylibdir}/distutils/*.py*
402%{pylibdir}/distutils/README
403%{pylibdir}/distutils/command
404%dir %{pylibdir}/email
405%{pylibdir}/email/*.py*
406%{pylibdir}/email/mime
407%{pylibdir}/encodings
408%{pylibdir}/hotshot
409%{pylibdir}/idlelib
410%{pylibdir}/importlib
411%dir %{pylibdir}/json
412%{pylibdir}/json/*.py*
413%{pylibdir}/lib2to3
414%{pylibdir}/logging
415%{pylibdir}/multiprocessing
416%{pylibdir}/plat-os2knix
417%{pylibdir}/pydoc_data
418%dir %{pylibdir}/sqlite3
419%{pylibdir}/sqlite3/*.py*
420%dir %{pylibdir}/test
421%{pylibdir}/test/test_support.py*
422%{pylibdir}/test/__init__.py*
423%{pylibdir}/wsgiref
424%{pylibdir}/xml
425
426# "Makefile" and the config-32/64.h file are needed by
427# distutils/sysconfig.py:_init_posix(), so we include them in the core
428# package, along with their parent directories (bug 531901):
429%dir %{pylibdir}/config
430%{pylibdir}/config/Makefile
431%dir %{_includedir}/python%{pybasever}
432%{_includedir}/python%{pybasever}/%{_pyconfig_h}
433
434%files libs
435%defattr(-,root,root,-)
436#%doc LICENSE README
437%{_libdir}/python%{pybasever_cond}.dll
438%if 0%{?with_systemtap}
439%{tapsetdir}/%{libpython_stp}
440%doc systemtap-example.stp pyfuntop.stp
441%endif
442%exclude %{_libdir}/*.dbg
443
444%files devel
445%defattr(-,root,root,-)
446%{pylibdir}/config/*
447%exclude %{pylibdir}/config/Makefile
448%{_includedir}/python%{pybasever}/*.h
449%exclude %{_includedir}/python%{pybasever}/%{_pyconfig_h}
450%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
451%if %{main_python}
452%{_bindir}/python-config
453%endif
454%{_bindir}/python?*-config
455#%{_libdir}/libpython%{pybasever}.pyd
456%{_libdir}/python%{pybasever}_dll.a
457%{_libdir}/pkgconfig
458
459%files tools
460%defattr(-,root,root,755)
461#%doc Tools/modulator/README.modulator
462#%doc Tools/pynche/README.pynche
463#%{site_packages}/modulator
464#%{site_packages}/pynche
465%{_bindir}/smtpd*.py*
466%{_bindir}/2to3*
467%{_bindir}/idle*
468#%{_bindir}/modulator*
469#%{_bindir}/pynche*
470%{_bindir}/pygettext*.py*
471%{_bindir}/msgfmt*.py*
472%{tools_dir}
473%{demo_dir}
474%{pylibdir}/Doc
475
476%files -n %{tkinter}
477%defattr(-,root,root,755)
478%{pylibdir}/lib-tk
479#%{dynload_dir}/_tkinter.pyd
480
481%files test
482%defattr(-, root, root, -)
483%{pylibdir}/bsddb/test
484%{pylibdir}/ctypes/test
485%{pylibdir}/distutils/tests
486%{pylibdir}/email/test
487%{pylibdir}/json/tests
488%{pylibdir}/sqlite3/test
489%{pylibdir}/test/*
490%{pylibdir}/unittest/*
491# These two are shipped in the main subpackage:
492%exclude %{pylibdir}/test/test_support.py*
493%exclude %{pylibdir}/test/__init__.py*
494%{dynload_dir}/_ctypes_test.pyd
495%{dynload_dir}/_ct3574.pyd
496%{dynload_dir}/_testcapi.pyd
497%{dynload_dir}/_te3228.pyd
498
499# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from
500# ldconfig (rhbz:562980).
501#
502# The /usr/lib/rpm/redhat/macros defines %__debug_package to use
503# debugfiles.list, and it appears that everything below /usr/lib/debug and
504# (/usr/src/debug) gets added to this file (via LISTFILES) in
505# /usr/lib/rpm/find-debuginfo.sh
506#
507# Hence by installing it below /usr/lib/debug we ensure it is added to the
508# -debuginfo subpackage
509# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
510# payload file would be unpackaged)
511
512%changelog
513* Thu Jun 09 2016 yd <yd@os2power.com> 2.7.6-13
514- enable support for ucs4 unicode set. ticket#182.
515- r780, fix file deletion. ticket#185.
516- r779, remove 8.3 file name truncation, use opendir() to avoid resolving symlinks. ticket#185.
517- r775, generate both 8.3 and long names for pyd dynamic libraries. fixes ticket#185.
518
519* Sat Dec 12 2015 Dmitriy Kuminov <coding@dmik.org> 2.7.6-12
520- r611, Add dummy plat-os2knix directory.
521- r610, Fix silly typo.
522- r609, Fix a typo in r529.
523- r608, Make os.path.defpath return '$UNIXROOT/usr/bin' on OS/2 when it is set.
524- r607, Replace altsep to sep in paths returned by os.path.join.
525- r606, Add ignore patterns for *.pyc and generated files.
526- r605, configure: Generate correct OS/2 defs and remove pre-built configure.
527- r604, Fix building with no OS/2 Toolkit headers in include paths.
528- r603, Use configured SHELL in subprocess module.
529- Provide dummy _dlopen in ctypes to make colorama package happy.
530- Use configured SHELL for subprocess.Popen(shell=True) instead of
531 hardcoded '/bin/sh'.
532- Make os.path.join replace all altsep (\) with sep (/) on return (to
533 fix joining names with components of PATH-like env. vars and passing
534 the results to a unix shell).
535- Make os.path.defpath return '$UNIXROOT\\usr\\bin'.
536- r568, build mmap module, by psmedley.
537
538* Thu Feb 26 2015 yd <yd@os2power.com> 2.7.6-11
539- r560, -O3 breaks the build, at least for pentium4 march.
540- r529, use unixroot path for script path replacement. Fixes ticket#114.
541
542* Mon Apr 07 2014 yd
543- build for python 2.7.
544
545* Sat Mar 15 2014 yd
546- r385 and others, added support for virtualenv.
547- added debug package with symbolic info for exceptq.
548
549* Wed Jun 05 2013 yd
550- r348, add samefile, sameopenfile, samestat to os.path module.
551
552* Thu Dec 27 2012 yd
553- fix local/bin requirements for python-tools.
554
555* Mon Jan 16 2012 yd
556- rebuild with libc 0.6.4 runtime.
Note: See TracBrowser for help on using the repository browser.