1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
8 version = %{major_ver}.3
10 thisapp = Python-%{version}
12 groups = Development/Languages
13 url = http://www.python.org
15 summary = Version 3 of the Python programming language.
18 Python is an interpreted, interactive, object-oriented programming
19 language often compared to Tcl, Perl, Scheme or Java. Python includes
20 modules, classes, exceptions, very high level dynamic data types and
21 dynamic typing. Python supports interfaces to many system calls and
22 libraries, as well as to various windowing systems.
25 source_dl = http://python.org/ftp/python/%{version}/
26 sources = %{thisapp}.tar.xz
28 pylibdir = %{libdir}/python%{major_ver}
29 dynload_dir= %{pylibdir}/lib-dynload
59 export CFLAGS += -D_GNU_SOURCE -fwrapv
60 export CXXFLAGS += -D_GNU_SOURCE -fwrapv
61 export OPT = %{CFLAGS}
65 if [ "%{lib}" = "lib64" ]; then
66 patch -Np1 -i %{DIR_SOURCE}/python-3.4.3-lib64.patch
69 # Remove embedded copies of expat and libffi
70 rm -rf Modules/{expat,zlib}
71 rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx}
73 # Make all source files owned by root.
79 configure_options += \
81 --with-computed-gotos=yes \
82 --with-dbmliborder=gdbm:ndbm:bdb \
85 --enable-loadable-sqlite-extensions \
89 LD_LIBRARY_PATH=$(pwd) $(pwd)/python \
94 -x test_faulthandler \
103 # test_subprocess won't work on grsecurity-enabled kernels
104 # test_float and test_cmath do not work on armv5tel (soft FPU)
108 install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__
109 install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__
112 mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3
113 install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools
114 install Tools/README %{BUILDROOT}%{pylibdir}/Tools/
115 cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/
117 rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au
119 # Switch all shebangs to refer to the specific Python version.
120 LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \
121 -i "%{bindir}/python%{major_ver}" \
124 # Remove shebang lines from .py files that aren't executable, and
125 # remove executability from .py files that don't have a shebang line:
126 find %{BUILDROOT} -name \*.py \
127 \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
128 -print -exec sed -i '1d' {} \; \) -o \( \
129 -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
130 -exec chmod a-x {} \; \) \)
132 # .xpm and .xbm files should not be executable:
134 \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
135 -exec chmod a-x {} \;
137 # Remove executable flag from files that shouldn't have it:
139 %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \
140 %{BUILDROOT}%{pylibdir}/Tools/README
142 # Get rid of DOS batch files:
143 find %{BUILDROOT} -name \*.bat -exec rm {} \;
145 # Get rid of backup files:
146 find %{BUILDROOT}/ -name "*~" -exec rm -f {} \;
147 rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt
149 # Junk, no point in putting in -test sub-pkg
150 rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py*
152 # Fix end-of-line encodings:
153 find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \;
155 # Do bytecompilation with the newly installed interpreter.
157 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
158 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
159 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
160 xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2]) for f in sys.argv[1:]]' || :
162 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
163 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
164 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
165 xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2], optimize=0) for f in sys.argv[1:]]' || :
167 # Fixup permissions for shared libraries from non-standard 555 to standard 755:
168 find %{BUILDROOT} -perm 555 -exec chmod 755 {} \;
174 # Define python-abi manually.
176 python-abi = %{major_ver}
180 %{name}-libs = %{thisver}
191 files += %{dynload_dir}
194 package %{name}-devel
197 requires += %{name}-libs = %{thisver}
200 !%{libdir}/python*/config*/Makefile \
201 !%{includedir}/python*/pyconfig.h
210 %{pylibdir}/ctypes/test
211 %{pylibdir}/distutils/testi
212 %{pylibdir}/lib2to3/test
213 %{pylibdir}/sqlite3/test
215 %{pylibdir}/tkinter/test
216 %{pylibdir}/unittest/test
217 %{dynload_dir}/_ctypes_test*
218 %{dynload_dir}/_testbuffer*
219 %{dynload_dir}/_testcapi*
223 package %{name}-tools
229 %{bindir}/python3-2to3
236 package %{name}-debuginfo