Hello community,

here is the log from the commit of package python3.5493 for 
openSUSE:13.2:Update checked in at 2016-08-19 15:16:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/python3.5493 (Old)
 and      /work/SRC/openSUSE:13.2:Update/.python3.5493.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3.5493"

Changes:
--------
New Changes file:

--- /dev/null   2016-07-07 10:01:34.856033756 +0200
+++ /work/SRC/openSUSE:13.2:Update/.python3.5493.new/python3-base.changes       
2016-08-19 15:16:45.000000000 +0200
@@ -0,0 +1,526 @@
+-------------------------------------------------------------------
+Mon Aug  8 14:28:04 UTC 2016 - [email protected]
+
+- drop python-fix-short-dh.patch and dh2048.pem, this is now fixed
+  upstream
+- drop disabled libffi-ppc64le.diff completely
+- reverse order of lowercase-proxies and HTTPoxy patches in order
+  to fix documented behavior
+
+-------------------------------------------------------------------
+Sun Aug  7 11:25:39 UTC 2016 - [email protected]
+
+- fix python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sat Aug  6 21:11:02 UTC 2016 - [email protected]
+
+- apply fix for CVE-2016-1000110 - CGIHandler: sets environmental
+  variable based on user supplied Proxy request header:
+  python-3.4-CVE-2016-1000110-fix.patch
+  (fixes bsc#989523, CVE-2016-1000110)
+- refresh python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sun Jul  3 12:41:08 UTC 2016 - [email protected]
+
+- update to 3.4.5
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+  (fixes bsc#984751, CVE-2016-0772)
+  (fixes bsc#985177, CVE-2016-5636)
+  (fixes bsc#985348, CVE-2016-5699)
+
+-------------------------------------------------------------------
+Wed Jun 15 12:57:55 UTC 2016 - [email protected]
+
+- apply upstream patch python3-urllib-prefer-lowercase-proxies.patch 
+  in order to make urllib proxy var handling behave as usual on POSIX
+
+-------------------------------------------------------------------
+Tue Jun 14 08:49:18 UTC 2016 - [email protected]
+
+- Due to being fixed upstream (differently), removed outdated patch
+  CVE-2014-4650-CGIHTTPServer-traversal.patch (bsc#983582)
+
+-------------------------------------------------------------------
+Sat May  7 09:02:50 UTC 2016 - [email protected]
+
+- update to 3.4.4
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+- all necessary patches refreshed
+- adjusted Python-3.3.0b2-multilib.patch
+- disabled libffi-ppc64le.diff: horribly deviated
+- fix a new multilib issue in configure.ac with $LIBPL
+  (target of python3 config)
+- disabled more tests, that require ssl
+
+-------------------------------------------------------------------
+Tue Sep 22 12:54:10 UTC 2015 - [email protected]
+
+- add python-2.7-libffi-aarch64.patch to fix incorrect FFI on aarch64
+
+-------------------------------------------------------------------
+Thu Sep 17 09:37:23 UTC 2015 - [email protected]
+
+- python-fix-short-dh.patch,dh2048.pem:
+  Bump DH parameters to 2048 bit to fix logjam security issue. bsc#935856
+
+-------------------------------------------------------------------
+Thu Jul 31 17:24:59 UTC 2014 - [email protected]
+
+- Rename rpmlintrc to %{name}-rpmlintrc.
+  Follow the packaging guidelines.
+
+-------------------------------------------------------------------
+Wed Jul 23 16:31:02 UTC 2014 - [email protected]
+
+- CVE-2014-4650-CGIHTTPServer-traversal.patch: CGIHTTPServer file
+  disclosure and directory traversal through URL-encoded characters
+  (CVE-2014-4650, bnc#885882)
+
+-------------------------------------------------------------------
+Tue Jul 22 13:55:57 UTC 2014 - [email protected]
+
+- drop python-3.4.1-SUSE-ensurepip.patch for compatibility reasons,
+  reinstate bundled copies of pip and setuptools
+  (fixes bnc#885662)
+- add more files as sources to silence the validator
+
+-------------------------------------------------------------------
+Wed May 21 11:01:56 UTC 2014 - [email protected]
+
+- update to 3.4.1
+    * bugfix-only release, over 300 bugs fixed
+- drop upstreamed python-3.4.0rc2-sqlite-3.8.4-tests.patch
+- drop upstreamed CVE-2014-2667-mkdir.patch
+- include Python release manager keyring and signature file
+  for the source archive (thus renumbering of source files)
+  (see https://www.python.org/download/#openpgp-public-keys )
+- move ensurepip to python3, because it transitively requires ssl
+
+-------------------------------------------------------------------
+Fri Apr  4 16:21:40 UTC 2014 - [email protected]
+
+- CVE-2014-2667-mkdir.patch: race condition with reseting umask
+  in os.makedirs
+  (CVE-2014-2667, bnc#871152)
+- updated multilib patch to include ~/.local/lib64 (bnc#637176)
+
+-------------------------------------------------------------------
+Wed Mar 26 15:24:46 UTC 2014 - [email protected]
+
+- raise timeout value for test_subprocess to 10s (might fix
+  intermittent build failures in OBS)
+
+-------------------------------------------------------------------
+Mon Mar 24 17:29:31 UTC 2014 - [email protected]
+
+- remove blacklisting of test_posix on aarch64: qemu bug is fixed 
+
+-------------------------------------------------------------------
+Mon Mar 17 18:26:58 UTC 2014 - [email protected]
+
+- update to 3.4.0 final
+- drop upstreamed python-3.4rc2-importlib.patch
+
+-------------------------------------------------------------------
+Sun Mar 16 16:33:25 UTC 2014 - [email protected]
+
+- Only build with profile-opt if profiling is enabled
+- Update test exclusion lists:
+  * test_ctypes no longer fails on arm
+  * test_io no longer fails on ppc*
+  * test_multiprocessing has been split in multiple tests
+  * test_posix and test_signal fail due to qemu bugs
+
+-------------------------------------------------------------------
+Fri Mar 14 20:26:03 UTC 2014 - [email protected]
+
+- Fix build with SQLite 3.8.4 [bnc#867887], fixing SQLite tests,
+  adding python-2.7.6-sqlite-3.8.4-tests.patch
+
+-------------------------------------------------------------------
+Thu Feb 27 14:08:40 UTC 2014 - [email protected]
+
+- update to 3.4.0 rc2
+   * pre-release bugfixes
+   * improvements to asyncio library
+- drop upstreamed tracemalloc_gcov.patch
+- python-3.4rc2-importlib.patch fixes backwards-incompatibility
+  in the reworked importlib module that blocks build of vim
+
+-------------------------------------------------------------------
+Fri Jan 17 18:45:27 UTC 2014 - [email protected]
+
+- initial commit of 3.4.0 beta 3
+    * new stdlib modules: pathlib, enum, statistics, tracemalloc
+    * asynchronous IO with new asyncio module
+    * introspection data for builtins
+    * subprocesses no longer inherit open file descriptors
+    * standardized metadata for packages
+    * internal hashing changed to SipHash
+    * new pickle protocol
+    * improved handling of codecs
+    * TLS 1.2 support
+    * major speed improvements for internal unicode handling
+    * many bugfixes and optimizations
+- see porting guide at:
+  http://docs.python.org/3.4/whatsnew/3.4.html#porting-to-python-3-4
+- moved several modules to -testsuite subpackage
+- updated list of binary extensions, refreshed patches
+- tracemalloc_gcov.patch fixes profile-based optimization build
+- updated packages and pre_checkin.sh to use ~-version notation
+  for prereleases
+- fix-shebangs part of build process moved to common %prep
+- drop python-3.3.2-no-REUSEPORT.patch (upstreamed)
+- update baselibs for new soname
+
+- TODOs:
+    * require python-pip, make ensurepip work with zypper
+
+-------------------------------------------------------------------
+Wed Dec  4 13:21:26 UTC 2013 - [email protected]
+
+- add ppc64le (ELFv2) support for libffi copy for ctypes module
+- Adjust Python-3.3.0b2-multilib.patch for ppc64le (make sys.lib be
+  "lib64").
+- added patches:
+  * libffi-ppc64le.diff
+-------------------------------------------------------------------
+Tue Dec  3 09:51:43 UTC 2013 - [email protected]
+
+- add ppc64le rules
+
+-------------------------------------------------------------------
+Fri Nov 22 13:17:23 UTC 2013 - [email protected]
+
+- Add python-3.3.3-skip-distutils-test_sysconfig_module.patch:
++++ 329 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.2:Update/.python3.5493.new/python3-base.changes
New Changes file:

--- /dev/null   2016-07-07 10:01:34.856033756 +0200
+++ /work/SRC/openSUSE:13.2:Update/.python3.5493.new/python3-doc.changes        
2016-08-19 15:16:45.000000000 +0200
@@ -0,0 +1,170 @@
+-------------------------------------------------------------------
+Mon Aug  8 14:28:04 UTC 2016 - [email protected]
+
+- drop python-fix-short-dh.patch and dh2048.pem, this is now fixed
+  upstream
+- drop disabled libffi-ppc64le.diff completely
+- reverse order of lowercase-proxies and HTTPoxy patches in order
+  to fix documented behavior
+
+-------------------------------------------------------------------
+Sun Aug  7 11:25:39 UTC 2016 - [email protected]
+
+- fix python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sat Aug  6 21:11:02 UTC 2016 - [email protected]
+
+- apply fix for CVE-2016-1000110 - CGIHandler: sets environmental
+  variable based on user supplied Proxy request header:
+  python-3.4-CVE-2016-1000110-fix.patch
+  (fixes bsc#989523, CVE-2016-1000110)
+- refresh python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sun Jul  3 12:41:08 UTC 2016 - [email protected]
+
+- update to 3.4.5
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+  (fixes bsc#984751, CVE-2016-0772)
+  (fixes bsc#985177, CVE-2016-5636)
+  (fixes bsc#985348, CVE-2016-5699)
+
+-------------------------------------------------------------------
+Wed Jun 15 12:57:55 UTC 2016 - [email protected]
+
+- apply upstream patch python3-urllib-prefer-lowercase-proxies.patch 
+  in order to make urllib proxy var handling behave as usual on POSIX
+
+-------------------------------------------------------------------
+Tue Jun 14 08:49:18 UTC 2016 - [email protected]
+
+- Due to being fixed upstream (differently), removed outdated patch for
+  CVE-2014-4650-CGIHTTPServer-traversal.patch (bsc#983582)
+  CGIHTTPServer
+
+-------------------------------------------------------------------
+Sat May  7 10:06:19 UTC 2016 - [email protected]
+
+- update to 3.4.4
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+- all necessary patches refreshed
+- adjusted Python-3.3.0b2-multilib.patch
+- disabled libffi-ppc64le.diff: horribly deviated
+- fix a new multilib issue in configure.ac with $LIBPL
+- add new tests, that require ssl
+
+-------------------------------------------------------------------
+Thu Oct 16 14:03:43 UTC 2014 - [email protected]
+
+- Add texlive-upquote BuildRequires: dependency to render the docs.
+
+-------------------------------------------------------------------
+Fri May 23 17:38:42 UTC 2014 - [email protected]
+
+- update to 3.4.1
+- drop upstream compiled sources
+- build documentation from source tarball
+  * this brings build-time dependency on Sphinx and LaTeX
+- drop useless README.AIX and duplicate ACKS file
+- drop wrong Obsoletes/Provides pairs
+
+-------------------------------------------------------------------
+Mon Mar 17 19:30:22 UTC 2014 - [email protected]
+
+- update to 3.4.0 final
+
+-------------------------------------------------------------------
+Fri Mar 14 20:26:03 UTC 2014 - [email protected]
+
+- Fix build with SQLite 3.8.4 [bnc#867887], fixing SQLite tests,
+  adding python-2.7.6-sqlite-3.8.4-tests.patch
+
+-------------------------------------------------------------------
+Tue Jan 21 18:09:54 UTC 2014 - [email protected]
+
+- initial commit of 3.4.0 beta2
+  * for full changelog, see python3-base
+
+-------------------------------------------------------------------
+Tue Nov 19 16:13:18 UTC 2013 - [email protected]
+
+- update to 3.3.3
+
+-------------------------------------------------------------------
+Thu Jun 13 15:06:22 UTC 2013 - [email protected]
+
+- update to version 3.3.2
+- switch to xz compression of main Python archive
+- remove README.txt (bnc#709442)
+- disable Source URLs for docs (the doc archives are regenerated
+  every day and autobuild detects this as "upstream file is different"
+  error)
+
+-------------------------------------------------------------------
+Sat Apr 13 07:57:45 UTC 2013 - [email protected]
+
+- Update to version 3.3.1 
+
+-------------------------------------------------------------------
+Fri Apr  5 13:01:00 UTC 2013 - [email protected]
+
+- Add Source URL, see https://en.opensuse.org/SourceUrls
+
+-------------------------------------------------------------------
+Mon Oct  1 08:53:43 UTC 2012 - [email protected]
+
+- Update to final 3.3.0 release
+  * See http://hg.python.org/cpython/file/v3.3.0/Misc/NEWS
+
+-------------------------------------------------------------------
+Fri Aug  3 12:13:10 UTC 2012 - [email protected]
+
+- update to 3.3.0 beta 1
+
+-------------------------------------------------------------------
+Tue Jun 12 14:43:44 UTC 2012 - [email protected]
+
+- update to build against 3.2.3
+
+-------------------------------------------------------------------
+Wed Jan 18 15:52:06 UTC 2012 - [email protected]
+
+- update to build against 3.2.2
+
+-------------------------------------------------------------------
+Mon Jul 18 16:23:31 UTC 2011 - [email protected]
+
+- update to build against 3.2.1
+
+-------------------------------------------------------------------
+Wed Mar 23 04:26:45 UTC 2011 - [email protected]
+
+- update to python 3.2
+
+-------------------------------------------------------------------
+Tue Feb  8 19:43:20 CET 2011 - [email protected]
+
+- updated to build against 3.2 RC2
+
+-------------------------------------------------------------------
+Mon Nov 29 14:24:43 UTC 2010 - [email protected]
+
+- updated to build against 3.1.2
+
+-------------------------------------------------------------------
+Thu Aug  6 20:48:25 CEST 2009 - [email protected]
+
+- updated to 3.1 documentation
+
+-------------------------------------------------------------------
+Fri Sep 12 14:13:07 CEST 2008 - [email protected]
+
+- updated to build against 3.0b3
+
+-------------------------------------------------------------------
+Fri Jun 27 16:30:21 CEST 2008 - [email protected]
+
+- initial release of python3-doc subpackage
+(now it contains files from python2. they will be updated
+in due time)
New Changes file:

--- /dev/null   2016-07-07 10:01:34.856033756 +0200
+++ /work/SRC/openSUSE:13.2:Update/.python3.5493.new/python3.changes    
2016-08-19 15:16:45.000000000 +0200
@@ -0,0 +1,298 @@
+-------------------------------------------------------------------
+Mon Aug  8 14:28:04 UTC 2016 - [email protected]
+
+- drop python-fix-short-dh.patch and dh2048.pem, this is now fixed
+  upstream
+- drop disabled libffi-ppc64le.diff completely
+- reverse order of lowercase-proxies and HTTPoxy patches in order
+  to fix documented behavior
+
+-------------------------------------------------------------------
+Sun Aug  7 11:25:39 UTC 2016 - [email protected]
+
+- fix python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sat Aug  6 21:11:02 UTC 2016 - [email protected]
+
+- apply fix for CVE-2016-1000110 - CGIHandler: sets environmental
+  variable based on user supplied Proxy request header:
+  python-3.4-CVE-2016-1000110-fix.patch
+  (fixes bsc#989523, CVE-2016-1000110)
+- refresh python3-urllib-prefer-lowercase-proxies.patch
+
+-------------------------------------------------------------------
+Sun Jul  3 12:41:08 UTC 2016 - [email protected]
+
+- update to 3.4.5
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+  (fixes bsc#984751, CVE-2016-0772)
+  (fixes bsc#985177, CVE-2016-5636)
+  (fixes bsc#985348, CVE-2016-5699)
+
+-------------------------------------------------------------------
+Wed Jun 15 12:57:55 UTC 2016 - [email protected]
+
+- apply upstream patch python3-urllib-prefer-lowercase-proxies.patch 
+  in order to make urllib proxy var handling behave as usual on POSIX
+
+-------------------------------------------------------------------
+Tue Jun 14 08:49:18 UTC 2016 - [email protected]
+
+- Due to being fixed upstream (differently), removed outdated patch
+  CVE-2014-4650-CGIHTTPServer-traversal.patch (bsc#983582)
+
+-------------------------------------------------------------------
+Sat May  7 09:16:54 UTC 2016 - [email protected]
+
+- update to 3.4.4
+  check: https://docs.python.org/3.4/whatsnew/changelog.html
+- all necessary patches refreshed
+- adjusted Python-3.3.0b2-multilib.patch
+- disabled libffi-ppc64le.diff: horribly deviated
+- fix a new multilib issue in configure.ac with $LIBPL
+- add new tests, that require ssl
+
+-------------------------------------------------------------------
+Thu Jul 31 12:45:47 UTC 2014 - [email protected]
+
+- Rename rpmlintrc to %{name}-rpmlintrc.
+  Follow the packaging guidelines.
+
+-------------------------------------------------------------------
+Fri May 23 17:38:20 UTC 2014 - [email protected]
+
+- update to 3.4.1
+  *  * bugfix-only release, over 300 bugs fixed
+- upgrade pip to Recommends (it seems to be a stronger hint)
+- move ensurepip here, because it requires ssl through pip
+- python-3.4.1-SUSE-ensurepip.patch: make ensurepip require
+  python3-pip from separate package
+- Suggests every subpackage that is part of stdlib
+
+-------------------------------------------------------------------
+Mon Mar 17 19:29:49 UTC 2014 - [email protected]
+
+- update to 3.4.0 final
+- lower pip requirement to Suggests, to prevent build cycles
+
+-------------------------------------------------------------------
+Fri Mar 14 20:26:03 UTC 2014 - [email protected]
+
+- Fix build with SQLite 3.8.4 [bnc#867887], fixing SQLite tests,
+  adding python-2.7.6-sqlite-3.8.4-tests.patch
+
+-------------------------------------------------------------------
+Thu Feb 27 14:07:55 UTC 2014 - [email protected]
+
+- update to 3.4.0 rc2
+  * for full changelog, see python3-base
+- hard Require for python3-pip, see what happens
+
+-------------------------------------------------------------------
+Tue Jan 21 18:08:54 UTC 2014 - [email protected]
+
+- initial commit of 3.4.0 beta 3
+  * for full changelog, see python3-base
+- modify script shebangs in common %prep
+
+-------------------------------------------------------------------
+Tue Nov 19 14:36:18 UTC 2013 - [email protected]
+
+- update to 3.3.3
+- move example module xxlimited to python3-testsuite
+- drop CVE-2013-4238_py33.patch - it is upstreamed
+
+-------------------------------------------------------------------
+Tue Oct 15 17:44:08 UTC 2013 - [email protected]
+
+- build with -DOPENSSL_LOAD_CONF for the same reasons 
+  described in the python2 package.
+
+-------------------------------------------------------------------
+Fri Aug 16 11:35:15 UTC 2013 - [email protected]
+
+- handle NULL bytes in certain fields of SSL certificates
+  (CVE-2013-4238, bnc#834601)
+
+-------------------------------------------------------------------
+Thu Jun 13 15:06:07 UTC 2013 - [email protected]
+
+- update to 3.3.2
+- switch to xz compression
+- move _lzma module to python3-base
+
+-------------------------------------------------------------------
+Mon Apr 29 22:32:43 UTC 2013 - [email protected]
+
+- Readd missing bits from ctypes-libffi-aarch64.patch
+
+-------------------------------------------------------------------
+Sat Apr 13 07:51:28 UTC 2013 - [email protected]
+
+- Update to version 3.3.1
+  * Fix the –enable-profiling configure switch.
+  * In IDLE, close the replace dialog after it is used.
+- Too many bugfixes to list here,
+  see See http://hg.python.org/cpython/file/v3.3.0/Misc/NEWS
+- Refresh Python-3.3.0b2-multilib.patch
+- Refresh python-3.2b2-buildtime-generate.patch
+- Drop upstream patches: ctypes-libffi-aarch64.patch,
+  python-3.2.3rc2-pypirc-secure.patch, python-3.3.0-getdents64.patch
+
+-------------------------------------------------------------------
+Mon Apr  8 11:25:30 UTC 2013 - [email protected]
+
+- Exclude sqlite/test and tk/test directories from the respective
+  sub-packages. These are owned by the testsuite sub-package already
+
+-------------------------------------------------------------------
+Fri Apr  5 12:58:38 UTC 2013 - [email protected]
+
+- Add Source URL, see https://en.opensuse.org/SourceUrls
+
+-------------------------------------------------------------------
+Mon Oct 29 18:21:45 UTC 2012 - [email protected]
+
+- disable more checks for qemu builds as they use syscalls not
+  implemented yet
+
+-------------------------------------------------------------------
+Mon Oct  1 08:52:01 UTC 2012 - [email protected]
+
+- Update to final 3.3.0 release
+  * See http://hg.python.org/cpython/file/v3.3.0/Misc/NEWS
+
+-------------------------------------------------------------------
+Mon Aug 27 16:36:03 UTC 2012 - [email protected]
+
+- update to 3.3.0 RC1
+- added Provides for %{python_version}, we'll see whether that
+  breaks everything
+
+-------------------------------------------------------------------
+Fri Aug  3 12:12:58 UTC 2012 - [email protected]
+
+- update to 3.3.0 beta 1
+
+-------------------------------------------------------------------
+Fri Jul 27 09:04:43 UTC 2012 - [email protected]
+
+- drop test_io ppc patch... we run only selective tests here 
+
+-------------------------------------------------------------------
+Tue Jun 12 15:39:08 UTC 2012 - [email protected]
+
+- fix logic of checks exclusion
+
+-------------------------------------------------------------------
+Sun Dec 25 13:26:04 UTC 2011 - [email protected]
+
+- Use system ffi, included one is broken see
+  http://bugs.python.org/issue11729 and 
+  http://bugs.python.org/issue12081
+
+-------------------------------------------------------------------
+Fri Dec  9 17:19:55 UTC 2011 - [email protected]
+
++++ 101 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.2:Update/.python3.5493.new/python3.changes

New:
----
  PACKAGING-NOTES
  Python-3.0b1-record-rpm.patch
  Python-3.3.0b2-multilib.patch
  Python-3.4.5.tar.xz
  Python-3.4.5.tar.xz.asc
  README.SUSE
  baselibs.conf
  ctypes-libffi-aarch64.patch
  import_failed.map
  import_failed.py
  macros.python3.py
  pre_checkin.sh
  python-2.6b1-canonicalize2.patch
  python-2.7-libffi-aarch64.patch
  python-3.3.0b1-curses-panel.patch
  python-3.3.0b1-fix_date_time_compiler.patch
  python-3.3.0b1-localpath.patch
  python-3.3.0b1-test-posix_fadvise.patch
  python-3.3.3-skip-distutils-test_sysconfig_module.patch
  python-3.4-CVE-2016-1000110-fix.patch
  python.keyring
  python3-base.changes
  python3-base.spec
  python3-doc.changes
  python3-doc.spec
  python3-rpmlintrc
  python3-urllib-prefer-lowercase-proxies.patch
  python3.changes
  python3.csh
  python3.sh
  python3.spec
  python3start
  subprocess-raise-timeout.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python3-base.spec ++++++
#
# spec file for package python3-base
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# !!!!
# this is the master spec file, but changes should be submitted
# against python3, not python3-base
#
# see PACKAGING-NOTES for details
# !!!!

Name:           python3-base
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  libbz2-devel
BuildRequires:  pkg-config
BuildRequires:  timezone
BuildRequires:  xz
BuildRequires:  xz-devel
BuildRequires:  zlib-devel
Url:            http://www.python.org/
Summary:        Python3 Interpreter
License:        Python-2.0
Group:          Development/Languages/Python
Version:        3.4.5
Release:        0
%define         tarversion %{version}
%define         tarname    Python-%{tarversion}

# python 3.1 didn't have a separate python-base, so it is wrongly
# not a conflict to have python3-3.1 and python3-base > 3.1
Obsoletes:      python3 < 3.2
# no Provides, because python3 is obviously provided by package python3

Source0:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
Source1:        
http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc
Source2:        python.keyring
Source3:        baselibs.conf
Source4:        README.SUSE
Source5:        python3start
Source6:        python3.sh
Source7:        python3.csh
Source8:        macros.python3.py
Source9:        import_failed.py
Source10:       import_failed.map

# The following files are not used in the build.
# They are listed here to work around missing functionality in rpmbuild,
# which would otherwise exclude them from distributed src.rpm files.
Source100:      PACKAGING-NOTES
Source101:      python3-rpmlintrc
Source102:      pre_checkin.sh

### COMMON-PATCH-BEGIN ###

# implement "--record-rpm" option for distutils installations
Patch01:        Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02:        Python-3.3.0b2-multilib.patch
# securing usage of readlink/realpath in PySys_SetArgv
Patch03:        python-2.6b1-canonicalize2.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04:        python-3.3.0b1-localpath.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible 
builds
Patch06:        python-3.3.0b1-fix_date_time_compiler.patch
# fix wrong include path in curses-panel module
Patch07:        python-3.3.0b1-curses-panel.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09:        python-3.3.0b1-test-posix_fadvise.patch
# Add missing bits for aarch64 in libffi
Patch10:        ctypes-libffi-aarch64.patch
# Disable global and distutils sysconfig comparison test, we deviate from the 
default depending on optflags
Patch12:        python-3.3.3-skip-distutils-test_sysconfig_module.patch
# Raise timeout value for test_subprocess
Patch15:        subprocess-raise-timeout.patch
# PATCH-FIX-UPSTREAM Fix argument passing in libffi for aarch64
Patch18:        python-2.7-libffi-aarch64.patch
# PATCH-FIX-UPSTREAM Prefer lowercase proxy environment variables
Patch19:        python3-urllib-prefer-lowercase-proxies.patch
# PATCH-FIX-UPSTREAM Prevent HTTPoxy vulnerability
Patch20:        python-3.4-CVE-2016-1000110-fix.patch

### COMMON-PATCH-END ###

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

### COMMON-DEF-BEGIN ###

# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
%define         python_version  3.4

%define         python_version_abitag   34
%define         python_version_soname   3_4

%define         sitedir         %{_libdir}/python%{python_version}

# three possible ABI kinds: m - pymalloc, d - debug build
# see PEP 3149
%define         abi_kind m
# python ABI version - used in some file names
%define         python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
%define         abi_tag %{python_version_abitag}%{abi_kind}

%define         so_version %{python_version_soname}%{abi_kind}1_0

%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
### COMMON-DEF-END ###

%description
Python 3 is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

If you want to install third party modules using distutils, you need to
install python-devel package.


Authors:
--------
    Guido van Rossum <[email protected]>


%package -n python3-tools
Requires:       %{name} = %{version}
Summary:        Python Utility and Demonstration Scripts
Group:          Development/Languages/Python
Obsoletes:      python3-demo < %{version}
Provides:       python3-demo = %{version}

%description -n python3-tools
A number of scripts that are useful for building, testing or extending Python,
and a set of demonstration programs.


%package -n python3-idle
Requires:       %{name} = %{version}
Requires:       python3-tk
Summary:        An Integrated Development Environment for Python
Group:          Development/Languages/Python

%description -n python3-idle
IDLE is a Tkinter based integrated development environment for Python.
It features a multi-window text editor with multiple undo, Python
colorizing, and many other things, as well as a Python shell window and
a debugger.


%package -n python3-devel
Requires:       %{name} = %{version}
Provides:       python3-2to3 = %{version}
Obsoletes:      python3-2to3 < %{version}
Summary:        Include Files and Libraries Mandatory for Building Python 
Modules
Group:          Development/Languages/Python

%description -n python3-devel
The Python programming language's interpreter can be extended with
dynamically loaded extensions and can be embedded in other programs.

This package contains header files, a static library, and development
tools for building Python modules, extending the Python interpreter or
embedding Python in applications.

This also includes the Python distutils, which were in the Python
package up to version 2.2.2.


%package -n python3-testsuite
Requires:       python3 = %{version}
Requires:       python3-tk = %{version}
Summary:        Unit tests for Python and its standard library
Group:          Development/Languages/Python

%description -n python3-testsuite
Unit tests that are useful for verifying integrity and functionality
of the installed Python interpreter and standard library.
They are a documented part of stdlib, as a module 'test'.


%package -n libpython%{so_version}
Summary:        Python Interpreter shared library
Group:          Development/Languages/Python

%description -n libpython%{so_version}
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

This package contains libpython3.2 shared library for embedding in
other applications.


%prep
%setup -q -n %{tarname}

### COMMON-PREP-BEGIN ###

%patch01 -p1
%patch02 -p1
#%%patch03
#- canonicalize disabled, needs testing whether the exploit still works
%patch04 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch10 -p1
%patch12 -p1
%patch15 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1

# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to 
/usr/bin/python3
for dir in Lib Tools; do
    # find *.py, filter to files that contain bad shebangs
    find $dir -name '*.py' -type f -print0 \
        | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' \
        | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env 
+)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@'
done

### COMMON-PREP-END ###

%build
# use rpm_opt_flags
export OPT="%{optflags} -DOPENSSL_LOAD_CONF"

touch -r %{S:0} Makefile.pre.in

autoreconf -fi
# prevent make from trying to rebuild asdl stuff, which requires existing 
python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
# prevent makeopcodetargets
touch -r Python/opcode_targets.h Lib/opcode.py Python/makeopcodetargets.py

%if 0%{?sles_version} || 0%{?suse_version} <= 1220
sed -e 's/-fprofile-correction//' -i Makefile.pre.in
%endif

./configure \
    --prefix=%{_prefix} \
    --libdir=%{_libdir} \
    --mandir=%{_mandir} \
    --docdir=%{_docdir}/python \
    --enable-ipv6 \
    --with-fpectl \
    --enable-shared \
    --with-ensurepip=no

%if 0%{?do_profiling}
target=profile-opt
%else
target=all
%endif
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
    make %{?_smp_mflags} $target

%check
# SUSE's gdb breaks test_gdb by producing spurious output (zypper suggestions)
# test_socket fails because of name resolution failure, that is expected
EXCLUDE="test_gdb test_socket"
%ifarch %arm
# test_multiprocessing_forkserver is racy
EXCLUDE="$EXCLUDE test_multiprocessing_forkserver"
%endif
%ifarch ppc ppc64 ppc64le
# exclue test_faulthandler due to bnc#831629
EXCLUDE="$EXCLUDE test_faulthandler"
%endif
# some tests break in QEMU
%if 0%{?qemu_user_space_build} > 0
EXCLUDE="$EXCLUDE test_multiprocessing_fork test_multiprocessing_forkserver 
test_multiprocessing_main_handling test_multiprocessing_spawn test_threading 
test_threadedtempfile test_io test_posix test_ioctl test_mmap test_openpty 
test_pty test_monotonic_settime test_clock_settime test_time test_subprocess 
test_asyncore test_asyncio test_send_at_certain_offset test_send_whole_file 
test_os test_faulthandler"
# qemu bug (siginterrupt handling)
EXCLUDE="$EXCLUDE test_signal"
%endif
%ifarch aarch64
EXCLUDE="$EXCLUDE test_faulthandler"
%endif

# on x86_64, SLE_11_SP2 only, extreme gamma function values (close to negative 
# integers) fail. Is probably a bug/imperfection in -lm
# disabling this for all SLE, unless someone knows how to test for SP level?
%ifarch x86_64
%if 0%{?sles_version} == 11
EXCLUDE="$EXCLUDE test_math"
%endif
%endif

# This test (part of test_uuid) requires real network interfaces
# so that ifconfig output has "HWaddr <something>".  Some kvm instances
# done have any such interface breaking teh uuid module.
EXCLUDE="$EXCLUDE test_uuid"

# Exclude test_tools, test_venv and test_ensurepip which indirectly require ssl
EXCLUDE="$EXCLUDE test_tools test_venv test_ensurepip"

# Exclude more tests that require ssl
EXCLUDE="$EXCLUDE test_urllib test_urllib2 test_urllib2net"

# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
  ulimit -v 10000000 || :
fi

make test TESTOPTS="-u none -x $EXCLUDE"
# use network, be verbose:
#make test TESTOPTS="-l -u network -v"

%install

make \
    OPT="%{optflags} -fPIC" \
    DESTDIR=$RPM_BUILD_ROOT \
    install

# remove .a
find ${RPM_BUILD_ROOT} -name "*.a" -exec rm {} ";"

# install "site-packages" and __pycache__ for third parties
install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages
install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages/__pycache__
# and their 32bit counterparts explicitly
mkdir -p 
${RPM_BUILD_ROOT}/usr/lib/python%{python_version}/site-packages/__pycache__

# cleanup parts that don't belong
for dir in curses dbm ensurepip sqlite3 tkinter xml xmlrpc; do
    find $RPM_BUILD_ROOT%{sitedir}/$dir/* -maxdepth 0 -name "test" -o -exec rm 
-rf {} ";"
done
rm $RPM_BUILD_ROOT%{dynlib pyexpat}

# overwrite the copied binary with a link
ln -sf python%{python_version} ${RPM_BUILD_ROOT}%{_bindir}/python3

# replace duplicate .pyo/.pyc with hardlinks
%fdupes $RPM_BUILD_ROOT/%{sitedir}

# documentation
export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/%{name}
install -d -m 755 $PDOCS
install -c -m 644 %{S:4}                            $PDOCS/
install -c -m 644 LICENSE                           $PDOCS/
install -c -m 644 README                            $PDOCS/

# tools
for x in `find Tools/ \( -not -name Makefile \) -print | sort` ; do
  test -d $x && ( install -c -m 755 -d $PDOCS/$x ) \
             || ( install -c -m 644 $x $PDOCS/$x )
done
# clean up the bat files
find $PDOCS -name "*.bat" -exec rm {} ";"

# install devel files to /config
#cp Makefile Makefile.pre.in Makefile.pre 
$RPM_BUILD_ROOT%{sitedir}/config-%{python_abi}/

# move idle config into /etc
install -d -m 755 ${RPM_BUILD_ROOT}/etc/idle3
( 
    cd ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/
    for file in *.def ; do
        mv $file ${RPM_BUILD_ROOT}/etc/idle3/
        ln -sf /etc/idle3/$file  ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/
    done
)

# startup scripts
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
install -m 644 %{S:5} $RPM_BUILD_ROOT/etc # python3start
install -m 644 %{S:6} %{S:7} $RPM_BUILD_ROOT/etc/profile.d # python3.sh, 
python3.csh

# RPM macros
mkdir -p $RPM_BUILD_ROOT/etc/rpm
LD_LIBRARY_PATH=. ./python %{S:8} > $RPM_BUILD_ROOT/etc/rpm/macros.python3 # 
macros.python3.py

# import_failed hooks
FAILDIR=$RPM_BUILD_ROOT/%{sitedir}/_import_failed
mkdir $FAILDIR
install -m 644 %{S:9} %{S:10} $FAILDIR # import_failed.*
LD_LIBRARY_PATH=. ./python -c "from py_compile import compile; 
compile('$FAILDIR/import_failed.py', 
dfile='%{sitedir}/_import_failed/import_failed.py')"
LD_LIBRARY_PATH=. ./python -O -c "from py_compile import compile; 
compile('$FAILDIR/import_failed.py', 
dfile='%{sitedir}/_import_failed/import_failed.py')"
(
    cd $FAILDIR
    while read package modules; do
        for module in $modules; do
            ln import_failed.py $module.py
            pushd __pycache__
            for i in import_failed*; do
                ln $i "$module${i#import_failed}"
            done
            popd
        done
    done < %{S:10}
)
echo %{sitedir}/_import_failed > 
$RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-import-failed-hooks.pth

%clean
rm -rf $RPM_BUILD_ROOT

%post -n libpython%{so_version} -p /sbin/ldconfig

%postun -n libpython%{so_version} -p /sbin/ldconfig

%files -n libpython%{so_version}
%defattr(644, root,root)
%{_libdir}/libpython%{python_abi}.so.*

%files -n python3-tools
%defattr(644, root, root, 755)
%{sitedir}/turtledemo
%doc %{_docdir}/%{name}/Tools

%files -n python3-idle
%defattr(644, root, root, 755)
%{sitedir}/idlelib
%dir /etc/idle3
%config /etc/idle3/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%doc Lib/idlelib/extend.txt
%doc Lib/idlelib/ChangeLog
%{_bindir}/idle3
%attr(755, root, root) %{_bindir}/idle%{python_version}

%files -n python3-devel
%defattr(644, root, root, 755)
%{_libdir}/libpython%{python_abi}.so
%{_libdir}/libpython3.so
%{_libdir}/pkgconfig/*
%{_prefix}/include/python%{python_abi}
%exclude %{_prefix}/include/python%{python_abi}/pyconfig.h
%defattr(755, root, root)
%{_bindir}/python%{python_abi}-config
%{_bindir}/python%{python_version}-config
%{_bindir}/python3-config
%{_bindir}/2to3
%{_bindir}/2to3-%{python_version}

%files -n python3-testsuite
%defattr(644, root, root, 755)
%{sitedir}/test
%{sitedir}/*/test
%{dynlib _ctypes_test}
%{dynlib _testbuffer}
%{dynlib _testcapi}
%{dynlib _testimportmultiple}
%{dynlib xxlimited}
# workaround for missing packages
%dir %{sitedir}/sqlite3
%dir %{sitedir}/tkinter

%files
%defattr(644, root, root, 755)
# profile files
%config /etc/python3start
%config /etc/profile.d/python3.*
# docs
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/README.SUSE
%doc %{_mandir}/man1/python3.1*
%doc %{_mandir}/man1/python%{python_version}.1*
# license text, not a doc because the code can use it at run-time
%{sitedir}/LICENSE.txt
# makefile etc
%{sitedir}/config-%{python_abi}
/etc/rpm/macros.python3
%{_prefix}/include/python%{python_abi}/pyconfig.h
# binary parts
%dir %{sitedir}/lib-dynload
#%{sitedir}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
%{dynlib array}
%{dynlib audioop}
%{dynlib binascii}
%{dynlib _bisect}
%{dynlib _bz2}
%{dynlib cmath}
%{dynlib _codecs_cn}
%{dynlib _codecs_hk}
%{dynlib _codecs_iso2022}
%{dynlib _codecs_jp}
%{dynlib _codecs_kr}
%{dynlib _codecs_tw}
%{dynlib _crypt}
%{dynlib _csv}
%{dynlib _ctypes}
%{dynlib _datetime}
%{dynlib _decimal}
%{dynlib _elementtree}
%{dynlib fcntl}
%{dynlib grp}
%{dynlib _heapq}
%{dynlib _json}
%{dynlib _lsprof}
%{dynlib _lzma}
%{dynlib math}
%{dynlib mmap}
%{dynlib _multibytecodec}
%{dynlib _multiprocessing}
%{dynlib nis}
%{dynlib ossaudiodev}
%{dynlib _opcode}
%{dynlib parser}
%{dynlib _pickle}
%{dynlib _posixsubprocess}
%{dynlib _random}
%{dynlib resource}
%{dynlib select}
%{dynlib _socket}
%{dynlib spwd}
%{dynlib _struct}
%{dynlib syslog}
%{dynlib termios}
%{dynlib time}
%{dynlib unicodedata}
%{dynlib zlib}
# hashlib fallback modules
%{dynlib _md5}
%{dynlib _sha1}
%{dynlib _sha256}
%{dynlib _sha512}
# python parts
%dir /usr/lib/python%{python_version}
%dir /usr/lib/python%{python_version}/site-packages
%dir /usr/lib/python%{python_version}/site-packages/__pycache__
%dir %{sitedir}
%dir %{sitedir}/site-packages
%dir %{sitedir}/site-packages/__pycache__
%exclude %{sitedir}/*/test
%{sitedir}/*.py
%{sitedir}/asyncio
%{sitedir}/ctypes
%{sitedir}/collections
%{sitedir}/concurrent
%{sitedir}/distutils
%{sitedir}/email
%{sitedir}/encodings
%{sitedir}/html
%{sitedir}/http
%{sitedir}/importlib
%{sitedir}/json
%{sitedir}/lib2to3
%{sitedir}/logging
%{sitedir}/multiprocessing
%{sitedir}/plat-*
%{sitedir}/pydoc_data
%{sitedir}/unittest
%{sitedir}/urllib
%{sitedir}/venv
%{sitedir}/wsgiref
%{sitedir}/site-packages/README
%{sitedir}/__pycache__
# import-failed hooks
%{sitedir}/_import_failed
%{sitedir}/site-packages/zzzz-import-failed-hooks.pth
# symlinks
%{_bindir}/pyvenv
%{_bindir}/python3
%{_bindir}/pydoc3
# executables
%attr(755, root, root) %{_bindir}/pydoc%{python_version}
%attr(755, root, root) %{_bindir}/python%{python_abi}
%attr(755, root, root) %{_bindir}/python%{python_version}
%attr(755, root, root) %{_bindir}/pyvenv-%{python_version}

%changelog
++++++ python3-doc.spec ++++++
#
# spec file for package python3-doc
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python3-doc
Url:            http://www.python.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  xz
Summary:        Additional Package Documentation for Python
License:        Python-2.0
Group:          Development/Languages/Python
Version:        3.4.5
Release:        0
BuildArch:      noarch
%define         tarversion     %{version}
%define         tarname        Python-%{tarversion}
Source0:        http://www.python.org/ftp/python/%{tarversion}/%{tarname}.tar.xz
BuildRequires:  python-Sphinx
BuildRequires:  texlive-cmap
BuildRequires:  texlive-collection-fontsrecommended
BuildRequires:  texlive-fancybox
BuildRequires:  texlive-fancyvrb
BuildRequires:  texlive-framed
BuildRequires:  texlive-mdwtools
BuildRequires:  texlive-multirow
BuildRequires:  texlive-parskip
BuildRequires:  texlive-scheme-basic
BuildRequires:  texlive-threeparttable
BuildRequires:  texlive-titlesec
BuildRequires:  texlive-ucs
BuildRequires:  texlive-upquote
BuildRequires:  texlive-wrapfig

# for consistency:
### COMMON-PATCH-BEGIN ###

# implement "--record-rpm" option for distutils installations
Patch01:        Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02:        Python-3.3.0b2-multilib.patch
# securing usage of readlink/realpath in PySys_SetArgv
Patch03:        python-2.6b1-canonicalize2.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04:        python-3.3.0b1-localpath.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible 
builds
Patch06:        python-3.3.0b1-fix_date_time_compiler.patch
# fix wrong include path in curses-panel module
Patch07:        python-3.3.0b1-curses-panel.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09:        python-3.3.0b1-test-posix_fadvise.patch
# Add missing bits for aarch64 in libffi
Patch10:        ctypes-libffi-aarch64.patch
# Disable global and distutils sysconfig comparison test, we deviate from the 
default depending on optflags
Patch12:        python-3.3.3-skip-distutils-test_sysconfig_module.patch
# Raise timeout value for test_subprocess
Patch15:        subprocess-raise-timeout.patch
# PATCH-FIX-UPSTREAM Fix argument passing in libffi for aarch64
Patch18:        python-2.7-libffi-aarch64.patch
# PATCH-FIX-UPSTREAM Prefer lowercase proxy environment variables
Patch19:        python3-urllib-prefer-lowercase-proxies.patch
# PATCH-FIX-UPSTREAM Prevent HTTPoxy vulnerability
Patch20:        python-3.4-CVE-2016-1000110-fix.patch

### COMMON-PATCH-END ###
### COMMON-DEF-BEGIN ###

# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
%define         python_version  3.4

%define         python_version_abitag   34
%define         python_version_soname   3_4

%define         sitedir         %{_libdir}/python%{python_version}

# three possible ABI kinds: m - pymalloc, d - debug build
# see PEP 3149
%define         abi_kind m
# python ABI version - used in some file names
%define         python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
%define         abi_tag %{python_version_abitag}%{abi_kind}

%define         so_version %{python_version_soname}%{abi_kind}1_0

%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
### COMMON-DEF-END ###

Enhances:       python3 = %{python_version}

%description
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in HTML format.



%package pdf
Summary:        Python PDF Documentation
Group:          Development/Languages/Python

%description pdf
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in PDF format.



Authors:
--------
    Guido van Rossum <[email protected]>

%prep
%setup -q -n %{tarname}

# for consistency
### COMMON-PREP-BEGIN ###

%patch01 -p1
%patch02 -p1
#%%patch03
#- canonicalize disabled, needs testing whether the exploit still works
%patch04 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch10 -p1
%patch12 -p1
%patch15 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1

# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to 
/usr/bin/python3
for dir in Lib Tools; do
    # find *.py, filter to files that contain bad shebangs
    find $dir -name '*.py' -type f -print0 \
        | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' \
        | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env 
+)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@'
done

### COMMON-PREP-END ###

%build
TODAY_DATE=`date -r %{S:0} "+%B %d, %Y"`
# TODO use not date of tarball but date of latest patch

cd Doc
sed -i "s/^today = .*/today = '$TODAY_DATE'/" conf.py
make html
make latex PAPER=a4
( cd build/latex; make all-pdf )
mv build/latex build/paper-a4
make latex PAPER=letter
( cd build/latex; make all-pdf )
mv build/latex build/paper-letter

%install
export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/python3
mkdir -p $PDOCS
# generated docs
pushd Doc
rm build/html/.buildinfo
cp -r build/html $PDOCS
install -d -m 755 $PDOCS/paper-a4
cp build/paper-a4/*.pdf $PDOCS/paper-a4
install -d -m 755 $PDOCS/paper-letter
cp build/paper-letter/*.pdf $PDOCS/paper-letter
popd
# misc
install -d -m 755 $PDOCS/Misc
rm Misc/README.AIX
for i in Misc/* ; do
  [ -f $i ] && install -c -m 644 $i $PDOCS/Misc/
done

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(644, root, root, 755)
%dir %{_docdir}/python3
%doc %{_docdir}/python3/Misc
%doc %{_docdir}/python3/html

%files pdf
%defattr(644, root, root, 755)
%doc %{_docdir}/python3/paper-a4
%doc %{_docdir}/python3/paper-letter

%changelog
++++++ python3.spec ++++++
#
# spec file for package python3
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python3
BuildRequires:  automake
BuildRequires:  db-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gdbm-devel
BuildRequires:  gettext-tools
BuildRequires:  gmp-devel
BuildRequires:  intltool
BuildRequires:  libbz2-devel
BuildRequires:  libexpat-devel
BuildRequires:  libffi-devel
BuildRequires:  libopenssl-devel
BuildRequires:  ncurses-devel
BuildRequires:  readline-devel
BuildRequires:  sqlite-devel
BuildRequires:  tk-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  xz
BuildRequires:  xz-devel
Url:            http://www.python.org/
Summary:        Python3 Interpreter
License:        Python-2.0
Group:          Development/Languages/Python
Version:        3.4.5
Release:        0
%define         tarversion %{version}
%define         tarname    Python-%{tarversion}

Requires:       python3-base = %{version}
Recommends:     python3-pip
Suggests:       python3-curses
Suggests:       python3-dbm
Suggests:       python3-idlelib
Suggests:       python3-tk

Source0:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
Source1:        baselibs.conf
Source2:        python3-rpmlintrc
# issues with copyrighted Unicode testing files

# do not add patches here, please edit python3-base.spec instead
# and run pre_checkin.sh
#
# see PACKAGING-NOTES for details

### COMMON-PATCH-BEGIN ###

# implement "--record-rpm" option for distutils installations
Patch01:        Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02:        Python-3.3.0b2-multilib.patch
# securing usage of readlink/realpath in PySys_SetArgv
Patch03:        python-2.6b1-canonicalize2.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04:        python-3.3.0b1-localpath.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible 
builds
Patch06:        python-3.3.0b1-fix_date_time_compiler.patch
# fix wrong include path in curses-panel module
Patch07:        python-3.3.0b1-curses-panel.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09:        python-3.3.0b1-test-posix_fadvise.patch
# Add missing bits for aarch64 in libffi
Patch10:        ctypes-libffi-aarch64.patch
# Disable global and distutils sysconfig comparison test, we deviate from the 
default depending on optflags
Patch12:        python-3.3.3-skip-distutils-test_sysconfig_module.patch
# Raise timeout value for test_subprocess
Patch15:        subprocess-raise-timeout.patch
# PATCH-FIX-UPSTREAM Fix argument passing in libffi for aarch64
Patch18:        python-2.7-libffi-aarch64.patch
# PATCH-FIX-UPSTREAM Prefer lowercase proxy environment variables
Patch19:        python3-urllib-prefer-lowercase-proxies.patch
# PATCH-FIX-UPSTREAM Prevent HTTPoxy vulnerability
Patch20:        python-3.4-CVE-2016-1000110-fix.patch

### COMMON-PATCH-END ###

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# do not add defs here, please edit python3-base.spec instead
# and run pre_checkin.sh
#
# see PACKAGING-NOTES for details

### COMMON-DEF-BEGIN ###

# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
%define         python_version  3.4

%define         python_version_abitag   34
%define         python_version_soname   3_4

%define         sitedir         %{_libdir}/python%{python_version}

# three possible ABI kinds: m - pymalloc, d - debug build
# see PEP 3149
%define         abi_kind m
# python ABI version - used in some file names
%define         python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
%define         abi_tag %{python_version_abitag}%{abi_kind}

%define         so_version %{python_version_soname}%{abi_kind}1_0

%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
### COMMON-DEF-END ###

# some compatibility Provides
Provides:       python = %{python_version}
Provides:       python3 = %{python_version}

Provides:       python3-xml = %{version}
Obsoletes:      python3-xml < %{version}

%description
Python 3 is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

If you want to install third party modules using distutils, you need to
install python-devel package.



Authors:
--------
    Guido van Rossum <[email protected]>


%package tk
Requires:       %{name} = %{version}
Summary:        TkInter - Python Tk Interface
Group:          Development/Libraries/Python

%description tk
Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. The
"xrpm" package uses this Python interface.


%package curses
Requires:       %{name} = %{version}
Summary:        Python Interface to the (N)Curses Library
Group:          Development/Libraries/Python

%description curses
An easy to use interface to the (n)curses CUI library. CUI stands for
Console User Interface.


%package dbm
Requires:       %{name} = %{version}
Summary:        Python Interface to the GDBM Library
Group:          Development/Languages/Python

%description dbm
An easy to use interface for Unix DBM databases, and more specifically,
the GNU implementation GDBM.


%prep
%setup -q -n %{tarname}
### COMMON-PREP-BEGIN ###

%patch01 -p1
%patch02 -p1
#%%patch03
#- canonicalize disabled, needs testing whether the exploit still works
%patch04 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch10 -p1
%patch12 -p1
%patch15 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1

# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to 
/usr/bin/python3
for dir in Lib Tools; do
    # find *.py, filter to files that contain bad shebangs
    find $dir -name '*.py' -type f -print0 \
        | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' \
        | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env 
+)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@'
done

### COMMON-PREP-END ###

%build
export SUSE_ASNEEDED=0
export OPT="%{optflags} -DOPENSSL_LOAD_CONF"

autoreconf -f -i .
# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h 
Objects/typeslots.inc

./configure \
    --prefix=%{_prefix} \
    --libdir=%{_libdir} \
    --mandir=%{_mandir} \
    --docdir=%{_docdir}/python \
    --enable-ipv6 \
    --with-fpectl \
    --enable-shared \
    --with-system-ffi \
    --with-system-expat \
    --with-ensurepip=no

make %{?_smp_mflags} # DESTDIR=$RPM_BUILD_ROOT

%check
# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
  ulimit -v 10000000 || :
fi

# only test the parts skipped in python3-base
TESTS="test_dbm_gnu test_dbm_ndbm test_readline test_ssl test_tcl test_tk 
test_ttk_guionly test_ttk_textonly test_curses test_socketserver test_sqlite 
test_hashlib test_smtpnet"

# ensurepip-based tests
TESTS="$TESTS test_venv test_ensurepip test_tools"

# and the rest of the newly excluded stuff
TESTS="$TESTS test_urllib test_urllib2 test_urllib2net"

make test TESTOPTS="-u none $TESTS"

%install
make \
    OPT="%{optflags} -fPIC" \
    DESTDIR=$RPM_BUILD_ROOT \
    install

# clean out stuff that is in python-base and subpackages

rm $RPM_BUILD_ROOT%{_bindir}/*
rm $RPM_BUILD_ROOT%{_libdir}/lib*
rm -r $RPM_BUILD_ROOT%{_libdir}/pkgconfig
rm -r $RPM_BUILD_ROOT%{_mandir}/*
rm -r $RPM_BUILD_ROOT%{_includedir}/*

rm -r $RPM_BUILD_ROOT%{sitedir}/config*
find $RPM_BUILD_ROOT%{sitedir} -name "*.egg-info" -exec rm {} ";"
rm -r $RPM_BUILD_ROOT%{sitedir}/__pycache__
rm -r $RPM_BUILD_ROOT%{sitedir}/site-packages
rm $RPM_BUILD_ROOT%{sitedir}/*.*

for module in \
    asyncio ctypes collections concurrent distutils email encodings \
    html http \
    importlib json logging multiprocessing plat-* pydoc_data unittest \
    urllib venv wsgiref lib2to3 test idlelib turtledemo
do
    rm -r $RPM_BUILD_ROOT%{sitedir}/$module
done

for library in \
    array audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \
    _ctypes _datetime _decimal _elementtree fcntl grp _heapq _json _lsprof \
    _lzma math mmap _multibytecodec _multiprocessing nis _opcode ossaudiodev \
    parser _pickle _posixsubprocess _random resource select _socket spwd \
    _struct syslog termios _testbuffer _testimportmultiple time unicodedata 
zlib \
    _ctypes_test _testcapi xxlimited \
    _md5 _sha1 _sha256 _sha512
do
    eval rm "$RPM_BUILD_ROOT%{sitedir}/lib-dynload/$library.*"
done

%fdupes $RPM_BUILD_ROOT/%{_libdir}/python%{python_version}

%files tk
%defattr(644, root, root, 755)
%{sitedir}/tkinter
%exclude %{sitedir}/tkinter/test
%{dynlib _tkinter}

%files curses
%defattr(644, root, root, 755)
%{sitedir}/curses
%{dynlib _curses}
%{dynlib _curses_panel}

%files dbm
%defattr(644, root, root, 755)
%{sitedir}/dbm
%{dynlib _dbm}
%{dynlib _gdbm}

%files
%defattr(644, root, root, 755)
%dir %{sitedir}
%dir %{sitedir}/lib-dynload
%{sitedir}/ensurepip
%{sitedir}/sqlite3
%exclude %{sitedir}/sqlite3/test
%{sitedir}/xml
%{sitedir}/xmlrpc
%{dynlib _hashlib}
%{dynlib pyexpat}
%{dynlib readline}
%{dynlib _sqlite3}
%{dynlib _ssl}

%changelog
++++++ PACKAGING-NOTES ++++++
Notes for packagers of Python3
==============================

I. python3 and python3-base naming confusion
--------------------------------------------

1. the important stuff first

This is package "python3". However, master spec file for this package is 
"python3-base.spec".
That means that all important changes should be put into "python3-base.spec" 
and then submitted
against "python3" in OBS.

Changelogs of python3-base and python3 will be merged at some point. Now they 
arent,
but feel free to enter changes in either or both.

2. why is that?

Technical reasons. python3-base was originally supposed to be a minimal package 
with no external
dependencies - so that it can build early in the distribution rebuild. There 
were also some
build loops involved.
Turns out, 90% of Python's standard library can be built without external 
dependencies. That's
what we do - in python3-base. python3 then only contains the remaining bits - 
dependency-heavy
subpackages, plus small bits depending on common packages (OpenSSL, expat, 
readline)
Logically, python3-base must be the master spec because it builds the important 
parts.

3. why not rename the whole package to python3-base?

Because that would be stupid. The package is called python3.

4. so why not make python3 the minimal package and put the rest in 
python3-the-rest?

Because other distributions use python3-base as the minimal package as well. 
Also, packages
that require python3 expect the whole deal, not a stripped-down version.

5. alright, let's build python3-base from python3.spec and python3 from 
someother.spec

Tried that, abandoned it. It is more trouble than it's worth.


II. pre_checkin.sh
------------------

Our pre_checkin.sh takes care of copying relevant portions of python3-base.spec 
to python3.spec.
The "relevant portions" are:
* list of patches
* list of macro definitions
* patch apply sequence in %prep

That means that when you're adding a patch, you need only add it to 
python3-base.spec and it will appear
magically in python3.spec too.

If you want to replicate another section from py3-base to py3, just mark the 
section with
NEW-SECTION-BEGIN and NEW-SECTION-END (in both py3-base and py3) and add 
NEW-SECTION to list of $sections
in pre_checkin.sh

pre_checkin.sh also finds the newest python tarball in the source directory and 
updates versions
in all specfiles to match it. Therefore, you usually don't need to update 
version numbers in specs
when you update Python
++++++ Python-3.0b1-record-rpm.patch ++++++
Index: b/Lib/distutils/command/install.py
===================================================================
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -131,6 +131,8 @@ class install(Command):
 
         ('record=', None,
          "filename in which to record list of installed files"),
+        ('record-rpm=', None,
+         "filename in which to record list of installed files and directories 
suitable as filelist for rpm"),
         ]
 
     boolean_options = ['compile', 'force', 'skip-build']
@@ -212,6 +214,7 @@ class install(Command):
         #self.install_info = None
 
         self.record = None
+        self.record_rpm = None
 
 
     # -- Option finalizing methods -------------------------------------
@@ -554,12 +557,61 @@ class install(Command):
             self.create_path_file()
 
         # write list of installed files, if requested.
-        if self.record:
+        if self.record or self.record_rpm:
             outputs = self.get_outputs()
             if self.root:               # strip any package prefix
                 root_len = len(self.root)
                 for counter in range(len(outputs)):
                     outputs[counter] = outputs[counter][root_len:]
+            if self.record_rpm:         # add directories
+                self.record = self.record_rpm
+                dirs = []
+                # directories to reject:
+                rejectdirs = [
+                    '/etc',
+                    '/',
+                    '',
+                    self.prefix,
+                    self.exec_prefix,
+                    self.install_base,
+                    self.install_platbase,
+                    self.install_purelib,
+                    self.install_platlib,
+                    self.install_headers[:len(self.install_headers) - 
len(self.distribution.get_name()) - 1],
+                    self.install_libbase,
+                    self.install_scripts,
+                    self.install_data,
+                    os.path.join(self.install_data, 'share'),
+                    os.path.join(self.install_data, 'share', 'doc'),
+                    ]
+                # directories whose childs reject:
+                rejectdirs2 = [
+                    os.path.join(self.install_data, 'share', 'man'),
+                    ]
+                # directories whose grandsons reject:
+                rejectdirs3 = [
+                    os.path.join(self.install_data, 'share', 'man'),
+                    os.path.join(self.install_data, 'share', 'locale'),
+                    ]
+                for counter in range(len(rejectdirs)):
+                    if len(rejectdirs[counter]) > root_len:
+                        rejectdirs[counter] = rejectdirs[counter][root_len:]
+                for counter in range(len(rejectdirs2)):
+                    if len(rejectdirs2[counter]) > root_len:
+                        rejectdirs2[counter] = rejectdirs2[counter][root_len:]
+                for counter in range(len(rejectdirs3)):
+                    if len(rejectdirs3[counter]) > root_len:
+                        rejectdirs3[counter] = rejectdirs3[counter][root_len:]
+                for counter in range(len(outputs)):
+                    directory = os.path.dirname(outputs[counter])
+                    while directory not in rejectdirs and \
+                            os.path.dirname(directory) not in rejectdirs2 and \
+                            os.path.dirname(os.path.dirname(directory)) not in 
rejectdirs3:
+                        dirname = '%dir ' + directory
+                        if dirname not in dirs:
+                            dirs.append(dirname)
+                        directory = os.path.dirname(directory)
+                outputs += dirs
             self.execute(write_file,
                          (self.record, outputs),
                          "writing list of installed files to '%s'" %
++++++ Python-3.3.0b2-multilib.patch ++++++
Index: b/Include/pythonrun.h
===================================================================
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -220,6 +220,8 @@ int _Py_CheckPython3();
 /* In their own files */
 PyAPI_FUNC(const char *) Py_GetVersion(void);
 PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetArch(void);
+PyAPI_FUNC(const char *) Py_GetLib(void);
 PyAPI_FUNC(const char *) Py_GetCopyright(void);
 PyAPI_FUNC(const char *) Py_GetCompiler(void);
 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Index: b/Lib/distutils/command/install.py
===================================================================
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -19,6 +19,8 @@ from site import USER_BASE
 from site import USER_SITE
 HAS_USER_SITE = True
 
+libname = sys.lib
+
 WINDOWS_SCHEME = {
     'purelib': '$base/Lib/site-packages',
     'platlib': '$base/Lib/site-packages',
@@ -30,7 +32,7 @@ WINDOWS_SCHEME = {
 INSTALL_SCHEMES = {
     'unix_prefix': {
         'purelib': '$base/lib/python$py_version_short/site-packages',
-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
+        'platlib': 
'$platbase/'+libname+'/python$py_version_short/site-packages',
         'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
Index: b/Lib/distutils/sysconfig.py
===================================================================
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -141,8 +141,11 @@ def get_python_lib(plat_specific=0, stan
             prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
-        libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
+        if plat_specific or standard_lib:
+            lib = sys.lib
+        else:
+            lib = "lib"
+        libpython = os.path.join(prefix, lib, "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
Index: b/Lib/pydoc.py
===================================================================
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -394,7 +394,7 @@ class Doc:
 
         docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
 
-        basedir = os.path.join(sys.base_exec_prefix, "lib",
+        basedir = os.path.join(sys.base_exec_prefix, sys.lib,
                                "python%d.%d" %  sys.version_info[:2])
         if (isinstance(object, type(os)) and
             (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
Index: b/Lib/site.py
===================================================================
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -247,28 +247,37 @@ def getuserbase():
     USER_BASE = get_config_var('userbase')
     return USER_BASE
 
-def getusersitepackages():
+def getusersitepackages(lib_kind = 'purelib'):
     """Returns the user-specific site-packages directory path.
 
     If the global variable ``USER_SITE`` is not initialized yet, this
     function will also set it.
     """
+
+    set_user_site = (lib_kind == 'purelib')
+
     global USER_SITE
     user_base = getuserbase() # this will also set USER_BASE
 
-    if USER_SITE is not None:
+    if USER_SITE is not None and set_user_site:
         return USER_SITE
 
     from sysconfig import get_path
 
+    user_site = None
+
     if sys.platform == 'darwin':
         from sysconfig import get_config_var
         if get_config_var('PYTHONFRAMEWORK'):
-            USER_SITE = get_path('purelib', 'osx_framework_user')
-            return USER_SITE
+            user_site = get_path('purelib', 'osx_framework_user')
+
+    if user_site is None:
+        user_site = get_path('purelib', '%s_user' % os.name)
 
-    USER_SITE = get_path('purelib', '%s_user' % os.name)
-    return USER_SITE
+    if set_user_site:
+        USER_SITE = user_site
+
+    return user_site
 
 def addusersitepackages(known_paths):
     """Add a per user site-package to sys.path
@@ -278,10 +287,12 @@ def addusersitepackages(known_paths):
     """
     # get the per user site-package path
     # this call will also make sure USER_BASE and USER_SITE are set
-    user_site = getusersitepackages()
+    for kind in ('purelib', 'platlib'):
+        user_site = getusersitepackages()
+
+        if ENABLE_USER_SITE and os.path.isdir(user_site):
+            addsitedir(user_site, known_paths)
 
-    if ENABLE_USER_SITE and os.path.isdir(user_site):
-        addsitedir(user_site, known_paths)
     return known_paths
 
 def getsitepackages(prefixes=None):
@@ -304,13 +315,19 @@ def getsitepackages(prefixes=None):
         seen.add(prefix)
 
         if os.sep == '/':
-            sitepackages.append(os.path.join(prefix, "lib",
+            sitepackages.append(os.path.join(prefix, sys.lib,
+                                        "python" + sys.version[:3],
+                                        "site-packages"))
+            if sys.lib != "lib":
+                sitepackages.append(os.path.join(prefix, "lib",
                                         "python" + sys.version[:3],
                                         "site-packages"))
-            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+            sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
+            if sys.lib != "lib":
+                sitepackages.append(os.path.join(prefix, "lib", "site-python"))
         else:
             sitepackages.append(prefix)
-            sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+            sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
         if sys.platform == "darwin":
             # for framework builds *only* we add the standard Apple
             # locations.
Index: b/Lib/trace.py
===================================================================
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -751,10 +751,10 @@ def main(argv=None):
                 # should I also call expanduser? (after all, could use $HOME)
 
                 s = s.replace("$prefix",
-                              os.path.join(sys.base_prefix, "lib",
+                              os.path.join(sys.base_prefix, sys.lib,
                                            "python" + sys.version[:3]))
                 s = s.replace("$exec_prefix",
-                              os.path.join(sys.base_exec_prefix, "lib",
+                              os.path.join(sys.base_exec_prefix, sys.lib,
                                            "python" + sys.version[:3]))
                 s = os.path.normpath(s)
                 ignore_dirs.append(s)
Index: b/Makefile.pre.in
===================================================================
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -101,6 +101,8 @@ PY_CORE_CFLAGS=     $(PY_CFLAGS) $(PY_CFLAGS
 
 # Machine-dependent subdirectories
 MACHDEP=       @MACHDEP@
+LIB=           @LIB@
+ARCH=          @ARCH@
 
 # Multiarch directory (may be empty)
 MULTIARCH=     @MULTIARCH@
@@ -120,7 +122,7 @@ LIBDIR=             @libdir@
 MANDIR=                @mandir@
 INCLUDEDIR=    @includedir@
 CONFINCLUDEDIR=        $(exec_prefix)/include
-SCRIPTDIR=     $(prefix)/lib
+SCRIPTDIR=     @libdir@
 ABIFLAGS=      @ABIFLAGS@
 
 # Detailed destination directories
@@ -711,6 +713,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
                -DEXEC_PREFIX='"$(exec_prefix)"' \
                -DVERSION='"$(VERSION)"' \
                -DVPATH='"$(VPATH)"' \
+               -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' \
                -o $@ $(srcdir)/Modules/getpath.c
 
 Modules/python.o: $(srcdir)/Modules/python.c
@@ -779,7 +782,7 @@ $(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN
 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
-               $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ 
$(srcdir)/Python/getplatform.c
+               $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' 
-DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
 
 Python/importdl.o: $(srcdir)/Python/importdl.c
                $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ 
$(srcdir)/Python/importdl.c
Index: b/Modules/getpath.c
===================================================================
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -117,9 +117,11 @@
 #define EXEC_PREFIX PREFIX
 #endif
 
+#define LIB_PYTHON LIB "/python" VERSION
+
 #ifndef PYTHONPATH
-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
+              EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
 #endif
 
 #ifndef LANDMARK
@@ -494,7 +496,7 @@ calculate_path(void)
     _pythonpath = _Py_char2wchar(PYTHONPATH, NULL);
     _prefix = _Py_char2wchar(PREFIX, NULL);
     _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL);
-    lib_python = _Py_char2wchar("lib/python" VERSION, NULL);
+    lib_python = _Py_char2wchar(LIB_PYTHON, NULL);
 
     if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
         Py_FatalError(
Index: b/Python/getplatform.c
===================================================================
--- a/Python/getplatform.c
+++ b/Python/getplatform.c
@@ -10,3 +10,23 @@ Py_GetPlatform(void)
 {
        return PLATFORM;
 }
+
+#ifndef ARCH
+#define ARCH "unknown"
+#endif
+
+const char *
+Py_GetArch(void)
+{
+       return ARCH;
+}
+
+#ifndef LIB
+#define LIB "lib"
+#endif
+
+const char *
+Py_GetLib(void)
+{
+       return LIB;
+}
Index: b/Python/sysmodule.c
===================================================================
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1702,6 +1702,10 @@ _PySys_Init(void)
                         PyUnicode_FromString(Py_GetCopyright()));
     SET_SYS_FROM_STRING("platform",
                         PyUnicode_FromString(Py_GetPlatform()));
+    SET_SYS_FROM_STRING("arch",
+                        PyUnicode_FromString(Py_GetArch()));
+    SET_SYS_FROM_STRING("lib",
+                        PyUnicode_FromString(Py_GetLib()));
     SET_SYS_FROM_STRING("executable",
                         PyUnicode_FromWideChar(
                                Py_GetProgramFullPath(), -1));
Index: b/setup.py
===================================================================
--- a/setup.py
+++ b/setup.py
@@ -451,7 +451,7 @@ class PyBuildExt(build_ext):
         # directories (i.e. '.' and 'Include') must be first.  See issue
         # 10520.
         if not cross_compiling:
-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+            add_dir_to_list(self.compiler.library_dirs, 
os.path.join('/usr/local', sys.lib))
             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
         # only change this for cross builds for 3.3, issues on Mageia
         if cross_compiling:
@@ -508,8 +508,7 @@ class PyBuildExt(build_ext):
         # be assumed that no additional -I,-L directives are needed.
         if not cross_compiling:
             lib_dirs = self.compiler.library_dirs + [
-                '/lib64', '/usr/lib64',
-                '/lib', '/usr/lib',
+                '/' + sys.lib, '/usr/' + sys.lib,
                 ]
             inc_dirs = self.compiler.include_dirs + ['/usr/include']
         else:
@@ -730,11 +729,11 @@ class PyBuildExt(build_ext):
             elif curses_library:
                 readline_libs.append(curses_library)
             elif self.compiler.find_library_file(lib_dirs +
-                                                     ['/usr/lib/termcap'],
+                                                     
['/usr/'+sys.lib+'/termcap'],
                                                      'termcap'):
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
-                                   library_dirs=['/usr/lib/termcap'],
+                                   library_dirs=['/usr/'+sys.lib+'/termcap'],
                                    extra_link_args=readline_extra_link_args,
                                    libraries=readline_libs) )
         else:
@@ -1750,18 +1749,17 @@ class PyBuildExt(build_ext):
         # Check for various platform-specific directories
         if host_platform == 'sunos5':
             include_dirs.append('/usr/openwin/include')
-            added_lib_dirs.append('/usr/openwin/lib')
+            added_lib_dirs.append('/usr/openwin/' + sys.lib)
         elif os.path.exists('/usr/X11R6/include'):
             include_dirs.append('/usr/X11R6/include')
-            added_lib_dirs.append('/usr/X11R6/lib64')
-            added_lib_dirs.append('/usr/X11R6/lib')
+            added_lib_dirs.append('/usr/X11R6/' + sys.lib)
         elif os.path.exists('/usr/X11R5/include'):
             include_dirs.append('/usr/X11R5/include')
-            added_lib_dirs.append('/usr/X11R5/lib')
+            added_lib_dirs.append('/usr/X11R5/' + sys.lib)
         else:
             # Assume default location for X11
             include_dirs.append('/usr/X11/include')
-            added_lib_dirs.append('/usr/X11/lib')
+            added_lib_dirs.append('/usr/X11/' + sys.lib)
 
         # If Cygwin, then verify that X is installed before proceeding
         if host_platform == 'cygwin':
Index: b/Lib/sysconfig.py
===================================================================
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -20,10 +20,10 @@ __all__ = [
 
 _INSTALL_SCHEMES = {
     'posix_prefix': {
-        'stdlib': '{installed_base}/lib/python{py_version_short}',
-        'platstdlib': '{platbase}/lib/python{py_version_short}',
+        'stdlib': '{installed_base}/'+sys.lib+'/python{py_version_short}',
+        'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
         'purelib': '{base}/lib/python{py_version_short}/site-packages',
-        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+        'platlib': 
'{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
         'include':
             '{installed_base}/include/python{py_version_short}{abiflags}',
         'platinclude':
@@ -61,10 +61,10 @@ _INSTALL_SCHEMES = {
         'data': '{userbase}',
         },
     'posix_user': {
-        'stdlib': '{userbase}/lib/python{py_version_short}',
-        'platstdlib': '{userbase}/lib/python{py_version_short}',
+        'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
+        'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
         'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
-        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+        'platlib': 
'{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
         'include': '{userbase}/include/python{py_version_short}',
         'scripts': '{userbase}/bin',
         'data': '{userbase}',
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -794,6 +794,41 @@ esac
 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
 AC_SUBST(MULTIARCH)
 
+AC_SUBST(ARCH)
+AC_MSG_CHECKING(ARCH)
+ARCH=`uname -m`
+case $ARCH in
+i?86) ARCH=i386;;
+esac
+AC_MSG_RESULT($ARCH)
+
+AC_SUBST(LIB)
+AC_MSG_CHECKING(LIB)
+case $ac_sys_system in
+Linux*)
+  # Test if the compiler is 64bit
+  echo 'int i;' > conftest.$ac_ext
+  python_cv_cc_64bit_output=no
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *"ELF 64"*)
+      python_cv_cc_64bit_output=yes
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+case $ARCH:$python_cv_cc_64bit_output in
+aarch64:yes | ppc64:yes | ppc64le:yes | powerpc64:yes | s390x:yes | 
sparc64:yes | x86_64:yes)
+  LIB="lib64"
+  ;;
+*:*)
+  LIB="lib"
+  ;;
+esac
+AC_MSG_RESULT($LIB)
 
 AC_SUBST(LIBRARY)
 AC_MSG_CHECKING(LIBRARY)
@@ -4115,7 +4150,7 @@ AC_MSG_RESULT($LDVERSION)
 
 dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
 AC_SUBST(PY_ENABLE_SHARED)
-LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+LIBPL='$(prefix)'"/${LIB}/python${VERSION}/config-${LDVERSION}"
 AC_SUBST(LIBPL)
 
 # Check whether right shifting a negative integer extends the sign bit
++++++ README.SUSE ++++++
Python 3 in SUSE
==============

* Subpackages *

Python 3 is split into several subpackages, based on external dependencies.
The main package 'python3' has soft dependencies on all subpackages needed to
assemble the standard library; however, these might not all be installed by 
default.

If you attempt to import a module that is currently not installed, an 
ImportError is thrown,
with instructions to install the missing subpackage. Installing the subpackage 
might result
in installing libraries that the subpackage requires to function.


* ensurepip *

The 'ensurepip' module from Python 3 standard library (PEP 453) is supposed to 
deploy
a bundled copy of the pip installer. This makes no sense in a managed 
distribution like SUSE.
Instead, you need to install package 'python3-pip'. Usually this will be 
installed automatically
with 'python3'.

Using 'ensurepip' when pip is not installed will result in an ImportError with 
instructions
to install 'python3-pip'.


* Documentation *

You can find documentation in seprarate packages: python3-doc and
python3-doc-pdf. These contan following documents:

    Tutorial, What's New in Python, Global Module Index, Library Reference,
    Macintosh Module Reference, Installing Python Modules, Distributing Python
    Modules, Language Reference, Extending and Embedding, Python/C API,
    Documenting Python 

The python3-doc package constains many text files from source tarball.


* Interactive mode *

Interactive mode is by default enhanced with of history and command completion.
If you don't like these features, you can unset the PYTHONSTARTUP variable
in your .profile or disable it system wide in /etc/profile.d/python.sh.
++++++ baselibs.conf ++++++
python3
python3-base
libpython3_4m1_0
++++++ ctypes-libffi-aarch64.patch ++++++
Index: Python-3.3.1/Modules/_ctypes/libffi/fficonfig.py.in
===================================================================
--- Python-3.3.1.orig/Modules/_ctypes/libffi/fficonfig.py.in
+++ Python-3.3.1/Modules/_ctypes/libffi/fficonfig.py.in
@@ -28,6 +28,7 @@ ffi_platforms = {
     'PA': ['src/pa/linux.S', 'src/pa/ffi.c'],
     'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'],
     'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'],
+    'AARCH64' : ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'],
 }
 
 ffi_sources += ffi_platforms['@TARGET@']
++++++ import_failed.map ++++++
python3-tools: turtledemo
python3-idle: idlelib
python3-testsuite: test _ctypes_test _testbuffer _testcapi _testimportmultiple 
xxlimited
python3-tk: tkinter _tkinter
python3-curses: curses _curses _curses_panel
python3-dbm: dbm _dbm _gdbm
python3: ensurepip sqlite3 xml xmlrpc _hashlib pyexpat readline _sqlite3 _ssl
++++++ import_failed.py ++++++
import sys, os
from sysconfig import get_path

failed_map_path = os.path.join(get_path('stdlib'), '_import_failed', 
'import_failed.map')

for line in open(failed_map_path):
    words = line.strip().split()
    if not words or words[0][0] == '#':
        continue
    assert words[0][-1] == ':'
    package = words[0][:-1]

    if __name__ in words[1:]:
        raise ImportError("""Module '{}' is not installed.
Use:
  sudo zypper install {}
to install it.""".format(__name__, package))

raise ImportError("""Module '{}' is not installed.
It is supposed to be part of python3 distribution, but missing from failed 
import map.
Please file a bug on the Novell Bugzilla.""")
++++++ macros.python3.py ++++++
#!/usr/bin/python3

""" generate macros.python3 file from known values """

import sys,os
from sysconfig import get_path, get_config_var

version = "{}.{}".format(*sys.version_info)
abiflags = get_config_var("ABIFLAGS")

macros = {
    "py3_ver":          version,
    "py3_prefix":       sys.prefix,
# hack-fix for bnc#787526 - get_path can't be used this way in python build dir
#    "py3_incdir":       get_path("include"),
    "py3_incdir":       "/usr/include/python" + version + abiflags,
    "py3_abiflags":     abiflags,
    "py3_soflags":      get_config_var("SOABI"),
    "python3_sitelib":  get_path("purelib"),
    "python3_sitearch": get_path("platlib"),
    "py3_compile(O)": """
find %1 -name '*.pyc' -exec rm -f {} ";"
python3 -c "import sys, os, compileall; br='%{buildroot}'; 
compileall.compile_dir(sys.argv[1], ddir=br and 
(sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1
%{-O:
find %1 -name '*.pyo' -exec rm -f {} ";"
python3 -O -c "import sys, os, compileall; br='%{buildroot}'; 
compileall.compile_dir(sys.argv[1], ddir=br and 
(sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1
}""",
}

for (macro,definition) in macros.items():
    definition = "\\\n".join(definition.split("\n"))
    print( "%{} {}".format(macro, definition))
++++++ pre_checkin.sh ++++++
#!/bin/bash
# This script is called automatically during autobuild checkin.
#
#
#
# ...or is it? 
# it really doesn't seem so, you know. go run it manually.

master=python3-base.spec

# calculate version number from newest tar name
VERSION=`ls *.tar.xz | grep '^Python-' | tail -n 1 | sed -r 
's/^Python-([0-9]+\.[0-9]+.[0-9a-z]+)\.tar.*$/\1/'`
if echo $VERSION | grep -q Python; then
    echo "Version is $VERSION and that's not right, fix the script."
    exit 1
fi
# VERSION = 3.3.0

Version=${VERSION/[a-z]*/}      # 3.3.0
tar_suffix=${VERSION#$Version}  # b1
a_version=(${Version//\./ })    # 3 3 0

python_version=${VERSION:0:3}                   # 3.3
python_version_abitag=${python_version//./}     # 33
python_version_soname=${python_version//./_}    # 3_3

if [ -n "$tar_suffix" ]; then
    Version=$Version~$tar_suffix           # 3.3.0~b1
    tarversion=$VERSION                    # 3.3.0b1
else
    tarversion="%{version}"
fi

# set Version for every spec
sed -i -r 's/(^Version:[ \t]+).*/\1'"$Version"'/' python3*.spec
# set tarversion for every spec
sed -i -r 's/(^%define[ \t]+tarversion[ \t]+).*/\1'$tarversion'/' python3*.spec

for varname in python_version{,_abitag,_soname}; do
    eval varvalue=\$$varname
    sed -i -r 's/(^%define[ \t]+'$varname'[ \t]+).*/\1'$varvalue'/' $master
done


# update baselibs
sed -i -r 's/^libpython.*$/libpython'$python_version_soname'm1_0/' baselibs.conf


# copy definition sections


sections="COMMON-PATCH COMMON-DEF COMMON-PREP"

for slave in python3.spec python3-doc.spec; do
{
    prev=1
    for section in $sections; do
        begin="/$section-BEGIN/"
        end="/$section-END/"
        sed -n -e "${prev},${begin}p" $slave
        sed -n -e "${begin},${end}p" $master | head -n -1 | tail -n +2
        prev=$end
    done
    sed -n -e "${prev},\$p" $slave
} > $slave.tmp && mv $slave.tmp $slave
done

osc service localrun format_spec_file


# create import_failed.map from package definitions

MAPFILE=import_failed.map
function new_map_line () {
    if [ -z "$1" -o -z "$2" ]; then
        return
    fi
    if [ "$1" == "python3-base" ]; then
        return
    fi
    echo "$1:$2" >> $MAPFILE.tmp
}

for spec in *.spec; do
    basename=${spec%.spec}
    package=
    modules=
    while read line; do
        case $line in
            "%files -n "*)
                new_map_line $package "$modules"
                package=${line#"%files -n "}
                modules=
                ;;
            "%files "*)
                new_map_line $package "$modules"
                package=$basename-${line#"%files "}
                modules=
                ;;
            "%files")
                new_map_line $package "$modules"
                package=$basename
                modules=
                ;;
            "%{sitedir}/"*)
                word=${line#"%{sitedir}/"}
                if ! echo $word | grep -q /; then
                    modules="$modules $word"
                fi
                ;;
            "%{dynlib "*"}")
                word=${line#"%{dynlib "}
                word=${word%"}"}
                modules="$modules $word"
                ;;
        esac
    done < $spec
    new_map_line $package "$modules"
done

mv $MAPFILE.tmp $MAPFILE
++++++ python-2.6b1-canonicalize2.patch ++++++
--- Python/sysmodule.c
+++ Python/sysmodule.c
@@ -1532,7 +1532,20 @@
                char *p = NULL;
                Py_ssize_t n = 0;
                PyObject *a;
-#ifdef HAVE_READLINK
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+               int errnum;
+
+               if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
+                       argv0 = canonicalize_file_name(argv0);
+                       if (argv0 == NULL) argv0 = strdup(argv[0]);
+               }
+#elif defined(HAVE_REALPATH)
+               if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
+                       if (realpath(argv0, fullpath)) {
+                               argv0 = fullpath;
+                       }
+               }
+#elif defined(HAVE_READLINK)
                char link[MAXPATHLEN+1];
                char argv0copy[2*MAXPATHLEN+1];
                int nr = 0;
@@ -1559,7 +1572,8 @@
                                }
                        }
                }
-#endif /* HAVE_READLINK */
+#endif /* resolve method selection */
+               
 #if SEP == '\\' /* Special case for MS filename syntax */
                if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
                        char *q;
@@ -1585,11 +1599,6 @@
                }
 #else /* All other filename syntaxes */
                if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
-#if defined(HAVE_REALPATH)
-                       if (realpath(argv0, fullpath)) {
-                               argv0 = fullpath;
-                       }
-#endif
                        p = strrchr(argv0, SEP);
                }
                if (p != NULL) {
@@ -1607,6 +1616,9 @@
                a = PyString_FromStringAndSize(argv0, n);
                if (a == NULL)
                        Py_FatalError("no mem for sys.path insertion");
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+               if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) 
free(argv0);
+#endif /* HAVE_CANONICALIZE_FILE_NAME */
                if (PyList_Insert(path, 0, a) < 0)
                        Py_FatalError("sys.path.insert(0) failed");
                Py_DECREF(a);
--- configure.in
+++ configure.in
@@ -2473,7 +2473,7 @@
  getpriority getpwent getspnam getspent getsid getwd \
  kill killpg lchmod lchown lstat mkfifo mknod mktime \
  mremap nice pathconf pause plock poll pthread_init \
- putenv readlink realpath \
+ putenv readlink realpath canonicalize_file_name \
  select setegid seteuid setgid \
  setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
  sigaction siginterrupt sigrelse strftime \
--- pyconfig.h.in
+++ pyconfig.h.in
@@ -79,6 +79,9 @@
 /* Define to 1 if you have the `chflags' function. */
 #undef HAVE_CHFLAGS
 
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
 /* Define to 1 if you have the `chown' function. */
 #undef HAVE_CHOWN
 
++++++ python-2.7-libffi-aarch64.patch ++++++
Index: Python-2.7.9/Modules/_ctypes/libffi/src/aarch64/ffi.c
===================================================================
--- Python-2.7.9.orig/Modules/_ctypes/libffi/src/aarch64/ffi.c
+++ Python-2.7.9/Modules/_ctypes/libffi/src/aarch64/ffi.c
@@ -728,7 +728,7 @@ aarch64_prep_args (struct call_context *
              state.ngrn = N_X_ARG_REG;
 
              memcpy (allocate_to_stack (&state, stack, ty->alignment,
-                                        ty->size), ecif->avalue + i, ty->size);
+                                        ty->size), ecif->avalue[i], ty->size);
            }
          break;
 
++++++ python-3.3.0b1-curses-panel.patch ++++++
Index: Modules/_curses_panel.c
===================================================================
--- Modules/_curses_panel.c.orig        2012-06-26 22:19:53.000000000 +0200
+++ Modules/_curses_panel.c     2012-08-02 14:56:23.000000000 +0200
@@ -14,7 +14,7 @@
 
 #include "py_curses.h"
 
-#include <panel.h>
+#include <ncurses/panel.h>
 
 typedef struct {
     PyObject *PyCursesError;
++++++ python-3.3.0b1-fix_date_time_compiler.patch ++++++
Index: b/Makefile.pre.in
===================================================================
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -702,11 +702,18 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
                $(MODOBJS) \
                $(srcdir)/Modules/getbuildinfo.c
        $(CC) -c $(PY_CORE_CFLAGS) \
+             -DDATE="\"`date -u -r Makefile.pre.in +"%b %d %Y"`\"" \
+             -DTIME="\"`date -u -r Makefile.pre.in +"%T"`\"" \
              -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
              -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
              -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
              -o $@ $(srcdir)/Modules/getbuildinfo.c
 
+Python/getcompiler.o: $(srcdir)/Python/getcompiler.c Makefile
+       $(CC) -c $(PY_CORE_CFLAGS) \
+               -DCOMPILER='"[GCC]"' \
+               -o $@ $(srcdir)/Python/getcompiler.c
+
 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
        $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
                -DPREFIX='"$(prefix)"' \
++++++ python-3.3.0b1-localpath.patch ++++++
Index: b/Lib/site.py
===================================================================
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -74,7 +74,7 @@ import builtins
 import _sitebuiltins
 
 # Prefixes for site-packages; add additional prefixes like /usr/local here
-PREFIXES = [sys.prefix, sys.exec_prefix]
+PREFIXES = [sys.prefix, sys.exec_prefix, '/usr/local']
 # Enable per user site-packages directory
 # set it to False to disable the feature or True to force the feature
 ENABLE_USER_SITE = None
Index: b/Lib/test/test_site.py
===================================================================
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -243,12 +243,27 @@ class HelperFunctionsTests(unittest.Test
             self.assertEqual(dirs[2], wanted)
         elif os.sep == '/':
             # OS X non-framwework builds, Linux, FreeBSD, etc
-            self.assertEqual(len(dirs), 2)
-            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
+            i = 0
+            wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
                                   'site-packages')
-            self.assertEqual(dirs[0], wanted)
-            wanted = os.path.join('xoxo', 'lib', 'site-python')
-            self.assertEqual(dirs[1], wanted)
+            self.assertEqual(dirs[i], wanted)
+            i += 1
+            if sys.lib != 'lib':
+                wanted = os.path.join('xoxo', 'lib', 'python' + 
sys.version[:3],
+                                      'site-packages')
+                self.assertEqual(dirs[i], wanted)
+                i += 1
+
+            wanted = os.path.join('xoxo', sys.lib, 'site-python')
+            self.assertEqual(dirs[i], wanted)
+            i += 1
+            if sys.lib != 'lib':
+                wanted = os.path.join('xoxo', 'lib', 'site-python')
+                self.assertEqual(dirs[i], wanted)
+                i += 1
+
+            self.assertTrue(i in [2,4])
+            self.assertEqual(len(dirs), i)
         else:
             # other platforms
             self.assertEqual(len(dirs), 2)
++++++ python-3.3.0b1-test-posix_fadvise.patch ++++++
Index: b/Lib/test/test_posix.py
===================================================================
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -242,7 +242,7 @@ class PosixTester(unittest.TestCase):
     def test_posix_fadvise(self):
         fd = os.open(support.TESTFN, os.O_RDONLY)
         try:
-            posix.posix_fadvise(fd, 0, 0, posix.POSIX_FADV_WILLNEED)
+            posix.posix_fadvise(fd, 0, 0, posix.POSIX_FADV_RANDOM)
         finally:
             os.close(fd)
 
++++++ python-3.3.3-skip-distutils-test_sysconfig_module.patch ++++++
Index: Python-3.4.0b1/Lib/distutils/tests/test_sysconfig.py
===================================================================
--- Python-3.4.0b1.orig/Lib/distutils/tests/test_sysconfig.py   2013-11-24 
21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/distutils/tests/test_sysconfig.py        2013-12-20 
12:09:13.307133040 +0100
@@ -125,6 +125,7 @@
                              'OTHER': 'foo'})
 
 
+    @unittest.skip("Either fix distutil's sysconfig everytime we add new 
compiler flags or we just skip this test")
     def test_sysconfig_module(self):
         import sysconfig as global_sysconfig
         self.assertEqual(global_sysconfig.get_config_var('CFLAGS'),
++++++ python-3.4-CVE-2016-1000110-fix.patch ++++++

# HG changeset patch
# User Senthil Kumaran <[email protected]>
# Date 1469946874 25200
# Node ID 3c19023c9fec5a615c25598468b44fade89049ce
# Parent  17ec4d58c04634cd7d8cdd36d259be7c60bc8a61# Parent  
95b09ccc8a3eda0a1c9e61b366e31be443f7a34c
[merge from 3.3] Prevent HTTPoxy attack (CVE-2016-1000110)

Ignore the HTTP_PROXY variable when REQUEST_METHOD environment is set, which
indicates that the script is in CGI mode.

Issue #27568 Reported and patch contributed by Rémi Rampin.

Index: Python-3.4.5/Doc/howto/urllib2.rst
===================================================================
--- Python-3.4.5.orig/Doc/howto/urllib2.rst
+++ Python-3.4.5/Doc/howto/urllib2.rst
@@ -538,6 +538,11 @@ setting up a `Basic Authentication`_ han
     through a proxy.  However, this can be enabled by extending urllib.request 
as
     shown in the recipe [#]_.
 
+.. note::
+
+   `HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see
+   the documentation on :func:`~urllib.request.getproxies`.
+
 
 Sockets and Layers
 ==================
Index: Python-3.4.5/Doc/library/urllib.request.rst
===================================================================
--- Python-3.4.5.orig/Doc/library/urllib.request.rst
+++ Python-3.4.5/Doc/library/urllib.request.rst
@@ -168,6 +168,14 @@ The :mod:`urllib.request` module defines
    If both lowercase and uppercase environment variables exist (and disagree),
    lowercase is preferred.
 
+   .. note::
+
+      If the environment variable ``REQUEST_METHOD`` is set, which usually
+      indicates your script is running in a CGI environment, the environment
+      variable ``HTTP_PROXY`` (uppercase ``_PROXY``) will be ignored. This is
+      because that variable can be injected by a client using the "Proxy:" HTTP
+      header. If you need to use an HTTP proxy in a CGI environment use
+      ``ProxyHandler`` explicitly.
 
 The following classes are provided:
 
@@ -270,6 +278,11 @@ The following classes are provided:
 
    To disable autodetected proxy pass an empty dictionary.
 
+   .. note::
+
+      ``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set;
+      see the documentation on :func:`~urllib.request.getproxies`.
+
 
 .. class:: HTTPPasswordMgr()
 
Index: Python-3.4.5/Lib/test/test_urllib.py
===================================================================
--- Python-3.4.5.orig/Lib/test/test_urllib.py
+++ Python-3.4.5/Lib/test/test_urllib.py
@@ -224,6 +224,18 @@ class ProxyTests(unittest.TestCase):
         
self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com:8888'))
         
self.assertTrue(urllib.request.proxy_bypass_environment('newdomain.com:1234'))
 
+    def test_proxy_cgi_ignore(self):
+        try:
+            self.env.set('HTTP_PROXY', 'http://somewhere:3128')
+            proxies = urllib.request.getproxies_environment()
+            self.assertEqual('http://somewhere:3128', proxies['http'])
+            self.env.set('REQUEST_METHOD', 'GET')
+            proxies = urllib.request.getproxies_environment()
+            self.assertNotIn('http', proxies)
+        finally:
+            self.env.unset('REQUEST_METHOD')
+            self.env.unset('HTTP_PROXY')
+
 
 class ProxyTests_withOrderedEnv(unittest.TestCase):
 
@@ -260,6 +272,7 @@ class ProxyTests_withOrderedEnv(unittest
         proxies = urllib.request.getproxies_environment()
         self.assertEqual('http://somewhere:3128', proxies['http'])
 
+
 class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin):
     """Test urlopen() opening a fake http connection."""
 
Index: Python-3.4.5/Lib/urllib/request.py
===================================================================
--- Python-3.4.5.orig/Lib/urllib/request.py
+++ Python-3.4.5/Lib/urllib/request.py
@@ -2339,6 +2339,12 @@ def getproxies_environment():
         name = name.lower()
         if value and name[-6:] == '_proxy':
             proxies[name[:-6]] = value
+    # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY
+    # (non-all-lowercase) as it may be set from the web server by a "Proxy:"
+    # header from the client
+    # If "proxy" is lowercase, it will still be used thanks to the next block
+    if 'REQUEST_METHOD' in os.environ:
+        proxies.pop('http', None)
     for name, value in os.environ.items():
         if name[-6:] == '_proxy':
             name = name.lower()
Index: Python-3.4.5/Misc/NEWS
===================================================================
--- Python-3.4.5.orig/Misc/NEWS
+++ Python-3.4.5/Misc/NEWS
@@ -7,6 +7,10 @@ What's New in Python 3.4.5?
 
 Release date: 2016-06-26
 
+- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the
+  HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates
+  that the script is in CGI mode.
+
 Tests
 -----
 
++++++ python3-rpmlintrc ++++++
# RPM macros are not configuration:
addFilter("non-conffile-in-etc /etc/rpm/macros.python3")
# Obviously, these files are meant to be empty:
addFilter("zero-length /usr/lib64/python3.3/test/nullcert.pem")
addFilter("zero-length 
/usr/lib64/python3.3/test/namespace_pkgs/module_and_namespace_package/a_test/empty")
++++++ python3-urllib-prefer-lowercase-proxies.patch ++++++

# HG changeset patch
# User Senthil Kumaran <[email protected]>
# Date 1461597383 25200
# Node ID 49b97512202264b950804fc5381436df97677472
# Parent  2c1651fbfbbab973177467efaf75ce6ce9a77012
Issue #26804: urllib.request will prefer lower_case proxy environment variables
over UPPER_CASE or Mixed_Case ones.

Patch contributed by Hans-Peter Jansen. Reviewed by Martin Panter and Senthil 
Kumaran.

Index: Python-3.4.5/Doc/library/urllib.request.rst
===================================================================
--- Python-3.4.5.orig/Doc/library/urllib.request.rst
+++ Python-3.4.5/Doc/library/urllib.request.rst
@@ -165,6 +165,8 @@ The :mod:`urllib.request` module defines
    in a case insensitive approach, for all operating systems first, and when it
    cannot find it, looks for proxy information from Mac OSX System
    Configuration for Mac OS X and Windows Systems Registry for Windows.
+   If both lowercase and uppercase environment variables exist (and disagree),
+   lowercase is preferred.
 
 
 The following classes are provided:
Index: Python-3.4.5/Lib/test/test_urllib.py
===================================================================
--- Python-3.4.5.orig/Lib/test/test_urllib.py
+++ Python-3.4.5/Lib/test/test_urllib.py
@@ -219,8 +219,46 @@ class ProxyTests(unittest.TestCase):
         # getproxies_environment use lowered case truncated (no '_proxy') keys
         self.assertEqual('localhost', proxies['no'])
         # List of no_proxies with space.
-        self.env.set('NO_PROXY', 'localhost, anotherdomain.com, newdomain.com')
+        self.env.set('NO_PROXY', 'localhost, anotherdomain.com, 
newdomain.com:1234')
         
self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com'))
+        
self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com:8888'))
+        
self.assertTrue(urllib.request.proxy_bypass_environment('newdomain.com:1234'))
+
+
+class ProxyTests_withOrderedEnv(unittest.TestCase):
+
+    def setUp(self):
+        # We need to test conditions, where variable order _is_ significant
+        self._saved_env = os.environ
+        # Monkey patch os.environ, start with empty fake environment
+        os.environ = collections.OrderedDict()
+
+    def tearDown(self):
+        os.environ = self._saved_env
+
+    def test_getproxies_environment_prefer_lowercase(self):
+        # Test lowercase preference with removal
+        os.environ['no_proxy'] = ''
+        os.environ['No_Proxy'] = 'localhost'
+        self.assertFalse(urllib.request.proxy_bypass_environment('localhost'))
+        self.assertFalse(urllib.request.proxy_bypass_environment('arbitrary'))
+        os.environ['http_proxy'] = ''
+        os.environ['HTTP_PROXY'] = 'http://somewhere:3128'
+        proxies = urllib.request.getproxies_environment()
+        self.assertEqual({}, proxies)
+        # Test lowercase preference of proxy bypass and correct matching 
including ports
+        os.environ['no_proxy'] = 'localhost, noproxy.com, my.proxy:1234'
+        os.environ['No_Proxy'] = 'xyz.com'
+        self.assertTrue(urllib.request.proxy_bypass_environment('localhost'))
+        
self.assertTrue(urllib.request.proxy_bypass_environment('noproxy.com:5678'))
+        
self.assertTrue(urllib.request.proxy_bypass_environment('my.proxy:1234'))
+        self.assertFalse(urllib.request.proxy_bypass_environment('my.proxy'))
+        self.assertFalse(urllib.request.proxy_bypass_environment('arbitrary'))
+        # Test lowercase preference with replacement
+        os.environ['http_proxy'] = 'http://somewhere:3128'
+        os.environ['Http_Proxy'] = 'http://somewhereelse:3128'
+        proxies = urllib.request.getproxies_environment()
+        self.assertEqual('http://somewhere:3128', proxies['http'])
 
 class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin):
     """Test urlopen() opening a fake http connection."""
Index: Python-3.4.5/Lib/urllib/request.py
===================================================================
--- Python-3.4.5.orig/Lib/urllib/request.py
+++ Python-3.4.5/Lib/urllib/request.py
@@ -2333,19 +2333,35 @@ def getproxies_environment():
 
     """
     proxies = {}
+    # in order to prefer lowercase variables, process environment in
+    # two passes: first matches any, second pass matches lowercase only
     for name, value in os.environ.items():
         name = name.lower()
         if value and name[-6:] == '_proxy':
             proxies[name[:-6]] = value
+    for name, value in os.environ.items():
+        if name[-6:] == '_proxy':
+            name = name.lower()
+            if value:
+                proxies[name[:-6]] = value
+            else:
+                proxies.pop(name[:-6], None)
     return proxies
 
-def proxy_bypass_environment(host):
+def proxy_bypass_environment(host, proxies=None):
     """Test if proxies should not be used for a particular host.
 
-    Checks the environment for a variable named no_proxy, which should
-    be a list of DNS suffixes separated by commas, or '*' for all hosts.
+    Checks the proxy dict for the value of no_proxy, which should
+    be a list of comma separated DNS suffixes, or '*' for all hosts.
+
     """
-    no_proxy = os.environ.get('no_proxy', '') or os.environ.get('NO_PROXY', '')
+    if proxies is None:
+        proxies = getproxies_environment()
+    # don't bypass, if no_proxy isn't specified
+    try:
+        no_proxy = proxies['no']
+    except KeyError:
+        return 0
     # '*' is special case for always bypass
     if no_proxy == '*':
         return 1
@@ -2440,8 +2456,15 @@ if sys.platform == 'darwin':
 
 
     def proxy_bypass(host):
-        if getproxies_environment():
-            return proxy_bypass_environment(host)
+        """Return True, if host should be bypassed.
+
+        Checks proxy settings gathered from the environment, if specified,
+        or from the MacOSX framework SystemConfiguration.
+
+        """
+        proxies = getproxies_environment()
+        if proxies:
+            return proxy_bypass_environment(host, proxies)
         else:
             return proxy_bypass_macosx_sysconf(host)
 
@@ -2555,14 +2578,15 @@ elif os.name == 'nt':
         return 0
 
     def proxy_bypass(host):
-        """Return a dictionary of scheme -> proxy server URL mappings.
+        """Return True, if host should be bypassed.
 
-        Returns settings gathered from the environment, if specified,
+        Checks proxy settings gathered from the environment, if specified,
         or the registry.
 
         """
-        if getproxies_environment():
-            return proxy_bypass_environment(host)
+        proxies = getproxies_environment()
+        if proxies:
+            return proxy_bypass_environment(host, proxies)
         else:
             return proxy_bypass_registry(host)
 
Index: Python-3.4.5/Misc/ACKS
===================================================================
--- Python-3.4.5.orig/Misc/ACKS
+++ Python-3.4.5/Misc/ACKS
@@ -653,6 +653,7 @@ Kjetil Jacobsen
 Bertrand Janin
 Geert Jansen
 Jack Jansen
+Hans-Peter Jansen
 Bill Janssen
 Thomas Jarosch
 Juhana Jauhiainen
++++++ python3.csh ++++++
# add python startup script for interactive sessions
setenv PYTHONSTARTUP /etc/pythonstart
++++++ python3.sh ++++++
# add python startup script for interactive sessions
export PYTHONSTARTUP=/etc/pythonstart
++++++ python3start ++++++
# startup script for python to enable saving of interpreter history and
# enabling name completion

# import needed modules
import atexit
import os
import readline
import rlcompleter

# where is history saved
historyPath = os.path.expanduser("~/.py3history")

# handler for saving history
def save_history(historyPath=historyPath):
    import readline
    readline.write_history_file(historyPath)

# read history, if it exists
if os.path.exists(historyPath):
    readline.set_history_length(10000)
    readline.read_history_file(historyPath)

# register saving handler
atexit.register(save_history)

# enable completion
readline.parse_and_bind('tab: complete')

# cleanup
del os, atexit, readline, rlcompleter, save_history, historyPath
++++++ subprocess-raise-timeout.patch ++++++
Index: b/Lib/test/test_subprocess.py
===================================================================
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -979,7 +979,8 @@ class ProcessTestCase(BaseTestCase):
         self.assertIn("0.0001", str(c.exception))  # For coverage of __str__.
         # Some heavily loaded buildbots (sparc Debian 3.x) require this much
         # time to start.
-        self.assertEqual(p.wait(timeout=3), 0)
+        # OBS might require even more
+        self.assertEqual(p.wait(timeout=10), 0)
 
     def test_invalid_bufsize(self):
         # an invalid type of the bufsize argument should raise

Reply via email to