1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
8 version = %{major_ver}.0
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 # Apply patches for x86_64.
66 if [ "$(uname -m)" = "x86_64" ]; then
67 patch -Np1 -i %{DIR_SOURCE}/python-3.3.0b1-lib64.patch
70 # Remove embedded copies of expat and libffi
71 rm -rf Modules/{expat,zlib}
72 rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx}
74 # Make all source files owned by root.
80 configure_options += \
82 --with-computed-gotos=yes \
83 --with-dbmliborder=gdbm:ndbm:bdb \
93 install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__
94 install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__
97 mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3
98 install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools
99 install Tools/README %{BUILDROOT}%{pylibdir}/Tools/
100 cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/
102 rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au
104 # Switch all shebangs to refer to the specific Python version.
105 LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \
106 -i "%{bindir}/python%{major_ver}" \
109 # Remove shebang lines from .py files that aren't executable, and
110 # remove executability from .py files that don't have a shebang line:
111 find %{BUILDROOT} -name \*.py \
112 \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
113 -print -exec sed -i '1d' {} \; \) -o \( \
114 -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
115 -exec chmod a-x {} \; \) \)
117 # .xpm and .xbm files should not be executable:
119 \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
120 -exec chmod a-x {} \;
122 # Remove executable flag from files that shouldn't have it:
124 %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \
125 %{BUILDROOT}%{pylibdir}/Tools/README
127 # Get rid of DOS batch files:
128 find %{BUILDROOT} -name \*.bat -exec rm {} \;
130 # Get rid of backup files:
131 find %{BUILDROOT}/ -name "*~" -exec rm -f {} \;
132 rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt
134 # Junk, no point in putting in -test sub-pkg
135 rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py*
137 # Fix end-of-line encodings:
138 find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \;
140 # Do bytecompilation with the newly installed interpreter.
142 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
143 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
144 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
145 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:]]' || :
147 find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
148 LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
149 PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
150 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:]]' || :
152 # Fixup permissions for shared libraries from non-standard 555 to standard 755:
153 find %{BUILDROOT} -perm 555 -exec chmod 755 {} \;
159 # Define python-abi manually.
161 python-abi = %{major_ver}
165 %{name}-libs = %{thisver}
176 files += %{dynload_dir}
179 package %{name}-devel
182 requires += %{name}-libs = %{thisver}
185 !%{libdir}/python*/config*/Makefile \
186 !%{includedir}/python*/pyconfig.h
195 %{pylibdir}/ctypes/test
196 %{pylibdir}/distutils/testi
197 %{pylibdir}/lib2to3/test
198 %{pylibdir}/sqlite3/test
200 %{pylibdir}/tkinter/test
201 %{pylibdir}/unittest/test
202 %{dynload_dir}/_ctypes_test*
203 %{dynload_dir}/_testbuffer*
204 %{dynload_dir}/_testcapi*
208 package %{name}-tools
214 %{bindir}/python3-2to3
221 package %{name}-debuginfo