1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
8 version = %{major_ver}.4
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
57 export CFLAGS += -D_GNU_SOURCE -fwrapv
58 export CXXFLAGS += -D_GNU_SOURCE -fwrapv
59 export OPT = %{CFLAGS}
63 if [ "%{lib}" = "lib64" ]; then
64 patch -Np1 -i %{DIR_SOURCE}/python-3.6.0-lib64.patch
67 # Remove embedded copies of expat and libffi
68 rm -rf Modules/{expat,zlib}
69 rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx}
71 # Make all source files owned by root.
77 configure_options += \
79 --with-computed-gotos=yes \
80 --with-dbmliborder=gdbm:ndbm:bdb \
83 --enable-loadable-sqlite-extensions \
88 LD_LIBRARY_PATH=$(pwd) $(pwd)/python \
93 -x test_faulthandler \
102 # # test_subprocess won't work on grsecurity-enabled kernels
103 # # test_float and test_cmath do not work on armv5tel (soft FPU)
107 install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__
108 install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__
111 mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3
112 install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools
113 install Tools/README %{BUILDROOT}%{pylibdir}/Tools/
114 cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/
116 rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au
118 # Switch all shebangs to refer to the specific Python version.
119 LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \
120 -i "%{bindir}/python%{major_ver}" \
123 # Remove shebang lines from .py files that aren't executable, and
124 # remove executability from .py files that don't have a shebang line:
125 find %{BUILDROOT} -name \*.py \
126 \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
127 -print -exec sed -i '1d' {} \; \) -o \( \
128 -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
129 -exec chmod a-x {} \; \) \)
131 # .xpm and .xbm files should not be executable:
133 \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
134 -exec chmod a-x {} \;
136 # Remove executable flag from files that shouldn't have it:
138 %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \
139 %{BUILDROOT}%{pylibdir}/Tools/README
141 # Get rid of DOS batch files:
142 find %{BUILDROOT} -name \*.bat -exec rm {} \;
144 # Get rid of backup files:
145 find %{BUILDROOT}/ -name "*~" -exec rm -f {} \;
146 rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt
148 # Junk, no point in putting in -test sub-pkg
149 rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py*
151 # Fix end-of-line encodings:
152 find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \;
154 # Do bytecompilation with the newly installed interpreter.
156 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
157 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
158 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
159 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:]]' || :
161 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
162 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
163 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
164 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:]]' || :
166 # Fixup permissions for shared libraries from non-standard 555 to standard 755:
167 find %{BUILDROOT} -perm 555 -exec chmod 755 {} \;
173 # Define python-abi manually.
175 python-abi = %{major_ver}
179 %{name}-libs = %{thisver}
190 files += %{dynload_dir}
193 package %{name}-devel
196 requires += %{name}-libs = %{thisver}
199 !%{libdir}/python*/config*/Makefile \
200 !%{includedir}/python*/pyconfig.h
209 %{pylibdir}/ctypes/test
210 %{pylibdir}/distutils/testi
211 %{pylibdir}/lib2to3/test
212 %{pylibdir}/sqlite3/test
214 %{pylibdir}/tkinter/test
215 %{pylibdir}/unittest/test
216 %{dynload_dir}/_ctypes_test*
217 %{dynload_dir}/_testbuffer*
218 %{dynload_dir}/_testcapi*
222 package %{name}-tools
228 %{bindir}/python3-2to3
235 package %{name}-debuginfo