%define docver 3.4.2 %define dirver 3.4 %define familyver 3 %define lib_major %{dirver} %define lib_name_orig libpython%{familyver} %define lib_name %mklibname python %{lib_major} %define develname %mklibname python3 -d %ifarch %{ix86} x86_64 ppc %bcond_without valgrind %else %bcond_with valgrind %endif %bcond_without rewheel # We want to byte-compile the .py files within the packages using the new # python3 binary. # # Unfortunately, rpmbuild's infrastructure requires us to jump through some # hoops to avoid byte-compiling with the system python 2 version: # /usr/lib/rpm/mageia/macros sets up build policy that (amongst other things) # defines __os_install_post. In particular, "brp-python-bytecompile" is # invoked without an argument thus using the wrong version of python # (/usr/bin/python, rather than the freshly built python), thus leading to # numerous syntax errors, and incorrect magic numbers in the .pyc files. We # thus remove the invocation of brp-python-bytecompile, whilst keeping the # invocation of brp-python-hardlink (since this should still work for python3 # pyc/pyo files) %define _python_bytecompile_build 0 Summary: An interpreted, interactive object-oriented programming language Name: python3 Version: 3.4.5 Release: 1 License: Modified CNRI Open Source License Group: Development/Python Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz Source1: https://docs.python.org/3/archives/python-%{docver}-docs-html.tar.bz2 Source2: python3.macros Source3: pybytecompile.macros Source100: %{name}.rpmlintrc Patch0: python-3.3.0-module-linkage.patch Patch1: python3-3.4.0-fdr-lib64.patch Patch2: python3-3.4.0-fdr-lib64-fix-for-test_install.patch Patch3: python3-3.4.0-no-static-lib.patch Patch4: python3-3.4.0-more-configuration-flags.patch Patch5: python3-3.4.0-disable-tests-in-test_io.patch Patch6: python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch Patch7: python3-3.4.3-skip-distutils-tests-that-fail-in-rpmbuild.patch Patch8: python3-3.4.0-hashlib-fips.patch Patch9: python3-3.4.3-fix-test_gdb-noise.patch Patch10: python3-3.4.0-uid-gid-overflows.patch Patch11: python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch Patch12: python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch Patch13: python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch Patch14: python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch Patch15: python3-3.4.0-dont-raise-from-py_compile.patch %if %{with rewheel} Patch16: python3-3.4.0-add-rewheel-module.patch %endif Patch18: python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch Patch19: Python-nis-requires-tirpc.patch Patch20: Python-select-requires-libm.patch Patch22: python3-3.5.0-make-libpl-respect-lib64.patch URL: http://www.python.org/ Conflicts: tkinter3 < %{version} Conflicts: %{lib_name}-devel < 3.4 Conflicts: %{develname} < 3.4 Requires: %{lib_name} = %{version} BuildRequires: automake BuildRequires: gcc-c++ BuildRequires: blt BuildRequires: db-devel BuildRequires: expat-devel BuildRequires: gdbm-devel BuildRequires: gmp-devel BuildRequires: ffi-devel BuildRequires: pkgconfig(ncursesw) BuildRequires: openssl-devel BuildRequires: readline-devel BuildRequires: tcl tcl-devel BuildRequires: tk tk-devel BuildRequires: autoconf BuildRequires: bzip2-devel BuildRequires: sqlite3-devel # uncomment once the emacs part no longer conflict with python 2.X #BuildRequires: emacs #BuildRequires: emacs-bin %if %{with valgrind} BuildRequires: valgrind-devel %endif %if %{with rewheel} BuildRequires: python3-setuptools BuildRequires: python3-pip %endif Provides: python(abi) = %{dirver} Provides: /usr/bin/python%{dirver}m Provides: /usr/bin/python%{dirver} %description Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. Python includes modules, classes, exceptions, very high level dynamic data types and dynamic typing. Python supports interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac and MFC). Programmers can write new built-in modules for Python in C or C++. Python can be used as an extension language for applications that need a programmable interface. This package contains most of the standard Python modules, as well as modules for interfacing to the Tix widget set for Tk and RPM. Note that documentation for Python is provided in the python-docs package. %package -n %{lib_name} Summary: Shared libraries for Python %{version} Group: System/Libraries %description -n %{lib_name} This packages contains Python shared object library. Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. %package -n %{develname} Summary: The libraries and header files needed for Python development Group: Development/Python Requires: %{name} = %{version} Requires: %{lib_name} = %{version} Provides: %{name}-devel = %{version}-%{release} Provides: %{lib_name_orig}-devel = %{version}-%{release} Obsoletes: %{_lib}python3.1-devel < %{version} Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} %description -n %{develname} The Python programming language's interpreter can be extended with dynamically loaded extensions and can be embedded in other programs. This package contains the header files and libraries needed to do these types of tasks. Install %{develname} if you want to develop Python extensions. The python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation. %package docs Summary: Documentation for the Python programming language Requires: %{name} = %{version} Requires: xdg-utils Group: Development/Python BuildArch: noarch %description docs The python-docs package contains documentation on the Python programming language and interpreter. The documentation is provided in ASCII text files and in LaTeX source files. Install the python-docs package if you'd like to use the documentation for the Python language. %package -n tkinter3 Summary: A graphical user interface for the Python scripting language Group: Development/Python Requires: %{name} = %{version} Requires: tcl tk Provides: python3-tkinter %description -n tkinter3 The Tkinter (Tk interface) program is an graphical user interface for the Python scripting language. You should install the tkinter package if you'd like to use a graphical user interface for Python programming. %package -n tkinter3-apps Summary: Various applications written using tkinter Group: Development/Python Requires: tkinter3 %description -n tkinter3-apps Various applications written using tkinter %prep %setup -qn Python-%{version} %patch0 -p0 -b .link %if "%{_lib}" == "lib64" %patch1 -p1 -b .lib64 %patch2 -p1 %endif %patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 %patch15 -p1 %if %{with rewheel} %patch16 -p1 %endif %patch18 -p0 %patch19 -p1 -b .tirpc~ %patch20 -p1 -b .lm~ %patch22 -p1 # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac # docs mkdir html bzcat %{SOURCE1} | tar x -C html find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@' cat > README.urpmi << EOF Python interpreter support readline completion by default. This is only used with the interpreter. In order to remove it, you can : 1) unset PYTHONSTARTUP when you login 2) create a empty file \$HOME/.pythonrc.py 3) change %{_sysconfdir}/pythonrc.py EOF %build rm -f Modules/Setup.local export OPT="%{optflags} -g" # to fix curses module build # https://bugs.mageia.org/show_bug.cgi?id=6702 export CFLAGS="%{optflags} -I/usr/include/ncursesw" export CPPFLAGS="%{optflags} -I/usr/include/ncursesw" autoreconf -vfi # Remove -Wl,--no-undefined in accordance with MGA #9395 : # https://bugs.mageia.org/show_bug.cgi?id=9395 %define _disable_ld_no_undefined 1 %configure2_5x --with-threads \ --enable-ipv6 \ --with-dbmliborder=gdbm \ --with-system-expat \ --with-system-ffi \ --enable-shared \ --without-ensurepip \ %if %{with valgrind} --with-valgrind %endif # fix build #perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile # (misc) if the home is nfs mounted, rmdir fails due to delay export TMP="/tmp" TMPDIR="/tmp" #%make LN="ln -sf" make EXTRA_CFLAGS="$CFLAGS" LN="ln -sf" %install mkdir -p %{buildroot}%{_prefix}/lib/python%{dirver} # fix Makefile to get rid of reference to distcc perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile # set the install path echo '[install_scripts]' >setup.cfg echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg # python is not GNU and does not know fsstd mkdir -p %{buildroot}%{_mandir} %makeinstall_std LN="ln -sf" # overwrite the copied binary with a link pushd %{buildroot}%{_bindir} ln -sf python%{dirver}m python%{dirver} ln -sf python%{dirver} python%{familyver} popd (cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) # fix files conflicting with python2.6 mv %{buildroot}/%{_bindir}/2to3 %{buildroot}/%{_bindir}/python3-2to3 # install pynche as pynche3 cat << EOF > %{buildroot}%{_bindir}/pynche3 #!/bin/bash exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche EOF rm -f Tools/pynche/*.pyw cp -r Tools/pynche %{buildroot}%{_libdir}/python%{dirver}/site-packages/ chmod 755 %{buildroot}%{_bindir}/{idle3,pynche3} ln -f Tools/pynche/README Tools/pynche/README.pynche %if %{with valgrind} install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp %endif mkdir -p %{buildroot}%{_datadir}/applications cat > %{buildroot}%{_datadir}/applications/rosa-tkinter3.desktop << EOF [Desktop Entry] Name=IDLE Name[ru]=IDLE Comment=IDE for Python3 Comment[ru]=IDE для Python3 Exec=%{_bindir}/idle3 Icon=development_environment_section Terminal=false Type=Application Categories=Development;IDE; EOF cat > %{buildroot}%{_datadir}/applications/rosa-%{name}-docs.desktop << EOF [Desktop Entry] Name=Python documentation Name[ru]=Документация Python Comment=Python complete reference Comment[ru]=Полное руководство по языку Python Exec=%{_bindir}/xdg-open %{_defaultdocdir}/%{name}-docs/index.html Icon=documentation_section Terminal=false Type=Application Categories=Documentation; EOF # fix non real scripts #chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py* find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -o -name "test_htmlparser.py*" \) -exec chmod 644 {} \; # fix python library not stripped chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 %{buildroot}%{_libdir}/libpython3.so %multiarch_includes %{buildroot}/usr/include/python*/pyconfig.h mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.d/ install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/rpm/macros.d/ %check # (misc) if the home is nfs mounted, rmdir fails export TMP="/tmp" TMPDIR="/tmp" # all tests must pass # but we disable network on BS #WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u none -x $EXCLUDE" # consider use network on local build #WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u network -x $EXCLUDE" %files %doc README.urpmi %{_sysconfdir}/rpm/macros.d/*.macros %{_includedir}/python*/pyconfig.h %multiarch_includedir/python*/pyconfig.h %{_libdir}/python*/config*/Makefile %exclude %{_libdir}/python*/site-packages/pynche %exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so %dir %{_libdir}/python* %{_libdir}/python*/LICENSE.txt %{_libdir}/python%{dirver}/*.py %{_libdir}/python%{dirver}/__pycache__ %{_libdir}/python%{dirver}/collections %{_libdir}/python%{dirver}/concurrent %{_libdir}/python%{dirver}/ctypes %{_libdir}/python%{dirver}/curses %{_libdir}/python%{dirver}/dbm %{_libdir}/python%{dirver}/distutils %{_libdir}/python%{dirver}/email %{_libdir}/python%{dirver}/encodings %{_libdir}/python%{dirver}/html %{_libdir}/python%{dirver}/http %{_libdir}/python%{dirver}/importlib %{_libdir}/python%{dirver}/json %{_libdir}/python%{dirver}/lib-dynload %{_libdir}/python%{dirver}/lib2to3 %{_libdir}/python%{dirver}/logging %{_libdir}/python%{dirver}/multiprocessing %{_libdir}/python%{dirver}/plat-linux %{_libdir}/python%{dirver}/pydoc_data %{_libdir}/python%{dirver}/site-packages %{_libdir}/python%{dirver}/sqlite3 %{_libdir}/python%{dirver}/turtledemo %{_libdir}/python%{dirver}/unittest %{_libdir}/python%{dirver}/urllib %{_libdir}/python%{dirver}/venv %{_libdir}/python%{dirver}/wsgiref* %{_libdir}/python%{dirver}/xml %{_libdir}/python%{dirver}/xmlrpc %{_libdir}/python%{dirver}/asyncio %{_libdir}/python%{dirver}/ensurepip # %exclude %{_libdir}/python%{dirver}/ensurepip/_bundled %{_bindir}/pydoc3* %{_bindir}/python3* %{_bindir}/pyvenv* %{_bindir}/2to3-%{dirver} %exclude %{_bindir}/python*config #%{_datadir}/emacs/site-lisp/* %{_mandir}/man*/* %if %{with valgrind} %{_libdir}/valgrind/valgrind-python3.supp %endif %files -n %{lib_name} %{_libdir}/libpython*.so.1* %files -n %{develname} %{_libdir}/libpython*.so %{_includedir}/python* %{_libdir}/python*/config-%{dirver}* %{_libdir}/python*/test/ %{_bindir}/python%{dirver}*-config %{_bindir}/python%{familyver}-config %{_libdir}/pkgconfig/python*.pc %exclude %{_includedir}/python*/pyconfig.h %exclude %{_libdir}/python*/config*/Makefile %files docs %doc html/*/* %{_datadir}/applications/rosa-%{name}-docs.desktop %files -n tkinter3 %{_libdir}/python*/tkinter/ %{_libdir}/python*/idlelib %{_libdir}/python*/site-packages/pynche %{_libdir}/python*/lib-dynload/_tkinter.*.so %files -n tkinter3-apps %{_bindir}/idle3* %{_bindir}/pynche3 %{_datadir}/applications/rosa-tkinter3.desktop %changelog * Tue Aug 25 2015 Denis Silakov 3.4.3-3 - (95db9cb) Added rewheel module (https://github.com/fedora-python/rewheel/issues/2) * Wed Apr 08 2015 Tigro 3.4.3-2 - (fb9cc91) rebuilt with ncurses depend * Wed Apr 08 2015 Tigro 3.4.3-1 - (9fcfd82) drop termcap-devel depend - (Denis Silakov: e2bc6ce) Updated to 3.4.3 * Sun Feb 22 2015 Alexander Lakhin 3.4.2-2 - (693af99) MassBuild#656: Increase release tag * Thu Oct 09 2014 Denis Silakov 3.4.2-1 - (57ee39c) Clean .abf.yml - (Denis Silakov: bb940a1) Updated to 3.4.2 * Fri Jun 27 2014 Alex Burmashev 3.4.1-6 - (1bfdf5e) MassBuild#440: Increase release tag * Thu Jun 26 2014 Denis Silakov 3.4.1-5 - (a4149c4) Drop files conflicting with python * Thu Jun 26 2014 Denis Silakov 3.4.1-4 - (5002108) Fix files - (Denis Silakov: 00abc50) Minor cleanup - (Denis Silakov: 3dd3726) Drop py3ver - (Denis Silakov: afa1305) Turn back autocompletion, prepare for the 'wheel' module support * Wed Jun 25 2014 Denis Silakov 3.4.1-3 - (e11ee70) Bootstrap build * Tue Jun 24 2014 Denis Silakov 3.4.1-2 - (f5332f3) Added Russian l10n for desktop files * Sun Jun 22 2014 Denis Silakov 3.4.1-1 - (9f2027e) Updated to 3.4.1 * Tue May 06 2014 Denis Silakov 3.3.4-1 - (653c588) Try non-parallel make - (Denis Silakov: 2992bf0) Clean .abf.yml - (Denis Silakov: 9f2d2a7) Updated to 3.3.4 * Thu Jan 16 2014 Denis Silakov 3.3.3-1 - (e192f53) Fix file lists - (Denis Silakov: 24bcc4a) Updated to 3.3.3, added bdist_rpm5 * Wed Oct 09 2013 Ilya Khokhryakov 3.3.2-1 - (13cebd0) Updated to 3.3.2 * Mon Apr 08 2013 Denis Silakov 3.3.1-1 - (5f41e05) Fix .abf.yml - (Denis Silakov: 5468ec3) LOG Updated to 3.3.1 * Thu Mar 28 2013 Anton Kirilenko 3.3.0-2 - (7c760db) Fix for multiarch dir discovering - (Anton Kirilenko: 7576343) Patch for distutils. It can now find pyconfig.h correctly * Tue Mar 05 2013 akdengi 3.3.0-1 - (159a93e) LOG -new version 3.3.0 - (root: 0d694db) update to 3.3 * Fri Oct 05 2012 Andrey Bondrov 3.2.3-6 - (a554f24) LOG New version 3.2.3 (sync with Mageia), do some cleanups * Wed Feb 01 2012 Rosa 3.2.1-2 - (4cd24e3) Automatic import for version 3.2.1