summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/python
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2022-11-22 17:02:30 -0600
committerGitHub <noreply@github.com>2022-11-22 15:02:30 -0800
commitc5883fffd7310f704a8adc2f3666d7539cdfe4e1 (patch)
tree6878ac2edd4efab60b0655a25891e8f010c17f1a /var/spack/repos/builtin/packages/python
parent4bf964e6b36e8756b014c2e30343507c1cb71b03 (diff)
downloadspack-c5883fffd7310f704a8adc2f3666d7539cdfe4e1.tar.gz
spack-c5883fffd7310f704a8adc2f3666d7539cdfe4e1.tar.bz2
spack-c5883fffd7310f704a8adc2f3666d7539cdfe4e1.tar.xz
spack-c5883fffd7310f704a8adc2f3666d7539cdfe4e1.zip
Python: drop EOL versions (#33898)
This PR removes [end of life](https://endoflife.date/python) versions of Python from Spack. Specifically, this includes all versions of Python older than 3.7. See https://github.com/spack/spack/discussions/31824 for rationale. Deprecated in #32615. And #28003. For anyone using software that relies on Python 2, you have a few options: * Upgrade the software to support Python 3. The `3to2` tool may get you most of the way there, although more complex libraries may need manual tweaking. * Add Python 2 as an [external package](https://spack.readthedocs.io/en/latest/build_settings.html#external-packages). Many Python libraries do not support Python 2, but you may be able to add older versions that did once upon a time. * Use Spack 0.19. Spack 0.19 is the last release to officially support Python 3.6 and older * Create and maintain your own [custom repository](https://spack.readthedocs.io/en/latest/repositories.html). Basically, you would need a package for Python 2 and any other Python 2-specific libraries you need.
Diffstat (limited to 'var/spack/repos/builtin/packages/python')
-rw-r--r--var/spack/repos/builtin/packages/python/cray-rpath-2.3.patch12
-rw-r--r--var/spack/repos/builtin/packages/python/fj-rpath-2.3.patch12
-rw-r--r--var/spack/repos/builtin/packages/python/gcc-8-2.7.14.patch35
-rw-r--r--var/spack/repos/builtin/packages/python/intel-3.7.patch (renamed from var/spack/repos/builtin/packages/python/intel-3.6.7.patch)0
-rw-r--r--var/spack/repos/builtin/packages/python/package.py507
-rw-r--r--var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++-fixup.patch120
-rw-r--r--var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++.patch269
-rw-r--r--var/spack/repos/builtin/packages/python/python-2.7.8-distutils-C++.patch260
-rw-r--r--var/spack/repos/builtin/packages/python/python-3.7.2-distutils-C++.patch (renamed from var/spack/repos/builtin/packages/python/python-3.6.8-distutils-C++.patch)0
-rw-r--r--var/spack/repos/builtin/packages/python/tkinter-3.7.patch (renamed from var/spack/repos/builtin/packages/python/tkinter.patch)0
10 files changed, 61 insertions, 1154 deletions
diff --git a/var/spack/repos/builtin/packages/python/cray-rpath-2.3.patch b/var/spack/repos/builtin/packages/python/cray-rpath-2.3.patch
deleted file mode 100644
index 54a85cc64a..0000000000
--- a/var/spack/repos/builtin/packages/python/cray-rpath-2.3.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Lib/distutils/unixccompiler.py 2003-06-02 05:27:40.000000000 +1000
-+++ b/Lib/distutils/unixccompiler.py 2017-05-13 13:52:45.554213616 +1000
-@@ -208,7 +208,8 @@
- elif compiler[:3] == "gcc" or compiler[:3] == "g++":
- return "-Wl,-R" + dir
- else:
-- return "-R" + dir
-+ # Patched by spack to use gcc syntax by default:
-+ return "-Wl,-R" + dir
-
- def library_option(self, lib):
- return "-l" + lib
diff --git a/var/spack/repos/builtin/packages/python/fj-rpath-2.3.patch b/var/spack/repos/builtin/packages/python/fj-rpath-2.3.patch
deleted file mode 100644
index 2ebda4cc12..0000000000
--- a/var/spack/repos/builtin/packages/python/fj-rpath-2.3.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Lib/distutils/unixccompiler.py 2003-06-02 05:27:40.000000000 +1000
-+++ b/Lib/distutils/unixccompiler.py 2017-05-13 13:52:45.554213616 +1000
-@@ -208,7 +208,8 @@
- elif compiler[:3] == "gcc" or compiler[:3] == "g++":
- return "-Wl,-R" + dir
- else:
-- return "-R" + dir
-+ # Patched by spack to use GNU ld syntax by default:
-+ return "-Wl,--enable-new-dtags,-R" + dir
-
- def library_option(self, lib):
- return "-l" + lib
diff --git a/var/spack/repos/builtin/packages/python/gcc-8-2.7.14.patch b/var/spack/repos/builtin/packages/python/gcc-8-2.7.14.patch
deleted file mode 100644
index 72c879cdea..0000000000
--- a/var/spack/repos/builtin/packages/python/gcc-8-2.7.14.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git a/Include/objimpl.h b/Include/objimpl.h
-index 5f2868332955..cbf6bc3f8763 100644
---- a/Include/objimpl.h
-+++ b/Include/objimpl.h
-@@ -248,6 +248,20 @@ PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
- /* for source compatibility with 2.2 */
- #define _PyObject_GC_Del PyObject_GC_Del
-
-+/*
-+ * Former over-aligned definition of PyGC_Head, used to compute the size of the
-+ * padding for the new version below.
-+ */
-+union _gc_head;
-+union _gc_head_old {
-+ struct {
-+ union _gc_head_old *gc_next;
-+ union _gc_head_old *gc_prev;
-+ Py_ssize_t gc_refs;
-+ } gc;
-+ long double dummy;
-+};
-+
- /* GC information is stored BEFORE the object structure. */
- typedef union _gc_head {
- struct {
-@@ -255,7 +269,8 @@ typedef union _gc_head {
- union _gc_head *gc_prev;
- Py_ssize_t gc_refs;
- } gc;
-- long double dummy; /* force worst-case alignment */
-+ double dummy; /* Force at least 8-byte alignment. */
-+ char dummy_padding[sizeof(union _gc_head_old)];
- } PyGC_Head;
-
- extern PyGC_Head *_PyGC_generation0;
diff --git a/var/spack/repos/builtin/packages/python/intel-3.6.7.patch b/var/spack/repos/builtin/packages/python/intel-3.7.patch
index f2277624af..f2277624af 100644
--- a/var/spack/repos/builtin/packages/python/intel-3.6.7.patch
+++ b/var/spack/repos/builtin/packages/python/intel-3.7.patch
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index e81abd883f..513364e05e 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -106,221 +106,6 @@ class Python(Package):
version("3.7.2", sha256="f09d83c773b9cc72421abba2c317e4e6e05d919f9bcf34468e192b6a6c8e328d")
version("3.7.1", sha256="36c1b81ac29d0f8341f727ef40864d99d8206897be96be73dc34d4739c9c9f06")
version("3.7.0", sha256="85bb9feb6863e04fb1700b018d9d42d1caac178559ffa453d7e6a436e259fd0d")
- version(
- "3.6.15",
- sha256="54570b7e339e2cfd72b29c7e2fdb47c0b7b18b7412e61de5b463fc087c13b043",
- deprecated=True,
- )
- version(
- "3.6.14",
- sha256="70064897bc434d6eae8bcc3e5678f282b5ea776d60e695da548a1219ccfd27a5",
- deprecated=True,
- )
- version(
- "3.6.13",
- sha256="614950d3d54f6e78dac651b49c64cfe2ceefea5af3aff3371a9e4b27a53b2669",
- deprecated=True,
- )
- version(
- "3.6.12",
- sha256="12dddbe52385a0f702fb8071e12dcc6b3cb2dde07cd8db3ed60e90d90ab78693",
- deprecated=True,
- )
- version(
- "3.6.11",
- sha256="96621902f89746fffc22f39749c07da7c2917b232e72352e6837d41850f7b90c",
- deprecated=True,
- )
- version(
- "3.6.10",
- sha256="7034dd7cba98d4f94c74f9edd7345bac71c8814c41672c64d9044fa2f96f334d",
- deprecated=True,
- )
- version(
- "3.6.9",
- sha256="47fc92a1dcb946b9ed0abc311d3767b7215c54e655b17fd1d3f9b538195525aa",
- deprecated=True,
- )
- version(
- "3.6.8",
- sha256="7f5b1f08b3b0a595387ef6c64c85b1b13b38abef0dd871835ee923262e4f32f0",
- deprecated=True,
- )
- version(
- "3.6.7",
- sha256="b7c36f7ed8f7143b2c46153b7332db2227669f583ea0cce753facf549d1a4239",
- deprecated=True,
- )
- version(
- "3.6.6",
- sha256="7d56dadf6c7d92a238702389e80cfe66fbfae73e584189ed6f89c75bbf3eda58",
- deprecated=True,
- )
- version(
- "3.6.5",
- sha256="53a3e17d77cd15c5230192b6a8c1e031c07cd9f34a2f089a731c6f6bd343d5c6",
- deprecated=True,
- )
- version(
- "3.6.4",
- sha256="7dc453e1a93c083388eb1a23a256862407f8234a96dc4fae0fc7682020227486",
- deprecated=True,
- )
- version(
- "3.6.3",
- sha256="ab6193af1921b30f587b302fe385268510e80187ca83ca82d2bfe7ab544c6f91",
- deprecated=True,
- )
- version(
- "3.6.2",
- sha256="7919489310a5f17f7acbab64d731e46dca0702874840dadce8bd4b2b3b8e7a82",
- deprecated=True,
- )
- version(
- "3.6.1",
- sha256="aa50b0143df7c89ce91be020fe41382613a817354b33acdc6641b44f8ced3828",
- deprecated=True,
- )
- version(
- "3.6.0",
- sha256="aa472515800d25a3739833f76ca3735d9f4b2fe77c3cb21f69275e0cce30cb2b",
- deprecated=True,
- )
- version(
- "3.5.10",
- sha256="3496a0daf51913718a6f10e3eda51fa43634cb6151cb096f312d48bdbeff7d3a",
- deprecated=True,
- )
- version(
- "3.5.9",
- sha256="67a1d4fc6e4540d6a092cadc488e533afa961b3c9becc74dc3d6b55cb56e0cc1",
- deprecated=True,
- )
- version(
- "3.5.8",
- sha256="18c88dfd260147bc7247e6356010e5d4916dfbfc480f6434917f88e61228177a",
- deprecated=True,
- )
- version(
- "3.5.7",
- sha256="542d94920a2a06a471a73b51614805ad65366af98145b0369bc374cf248b521b",
- deprecated=True,
- )
- version(
- "3.5.6",
- sha256="30d2ff093988e74283e1abfee823292c6b59590796b9827e95ba4940b27d26f8",
- deprecated=True,
- )
- version(
- "3.5.5",
- sha256="2f988db33913dcef17552fd1447b41afb89dbc26e3cdfc068ea6c62013a3a2a5",
- deprecated=True,
- )
- version(
- "3.5.4",
- sha256="6ed87a8b6c758cc3299a8b433e8a9a9122054ad5bc8aad43299cff3a53d8ca44",
- deprecated=True,
- )
- version(
- "3.5.3",
- sha256="d8890b84d773cd7059e597dbefa510340de8336ec9b9e9032bf030f19291565a",
- deprecated=True,
- )
- version(
- "3.5.2",
- sha256="1524b840e42cf3b909e8f8df67c1724012c7dc7f9d076d4feef2d3eff031e8a0",
- deprecated=True,
- )
- version(
- "3.5.1",
- sha256="687e067d9f391da645423c7eda8205bae9d35edc0c76ef5218dcbe4cc770d0d7",
- deprecated=True,
- )
- version(
- "3.5.0",
- sha256="584e3d5a02692ca52fce505e68ecd77248a6f2c99adf9db144a39087336b0fe0",
- deprecated=True,
- )
- version(
- "3.4.10",
- sha256="217757699249ab432571b381386d441e12b433100ab5f908051fcb7cced2539d",
- deprecated=True,
- )
- version(
- "3.4.3",
- sha256="8b743f56e9e50bf0923b9e9c45dd927c071d7aa56cd46569d8818add8cf01147",
- deprecated=True,
- )
- version(
- "3.3.6",
- sha256="0a58ad1f1def4ecc90b18b0c410a3a0e1a48cf7692c75d1f83d0af080e5d2034",
- deprecated=True,
- )
- version(
- "3.2.6",
- sha256="fc1e41296e29d476f696303acae293ae7a2310f0f9d0d637905e722a3f16163e",
- deprecated=True,
- )
- version(
- "3.1.5",
- sha256="d12dae6d06f52ef6bf1271db4d5b4d14b5dd39813e324314e72b648ef1bc0103",
- deprecated=True,
- )
- version(
- "2.7.18",
- sha256="da3080e3b488f648a3d7a4560ddee895284c3380b11d6de75edb986526b9a814",
- deprecated=True,
- )
- version(
- "2.7.17",
- sha256="f22059d09cdf9625e0a7284d24a13062044f5bf59d93a7f3382190dfa94cecde",
- deprecated=True,
- )
- version(
- "2.7.16",
- sha256="01da813a3600876f03f46db11cc5c408175e99f03af2ba942ef324389a83bad5",
- deprecated=True,
- )
- version(
- "2.7.15",
- sha256="18617d1f15a380a919d517630a9cd85ce17ea602f9bbdc58ddc672df4b0239db",
- deprecated=True,
- )
- version(
- "2.7.14",
- sha256="304c9b202ea6fbd0a4a8e0ad3733715fbd4749f2204a9173a58ec53c32ea73e8",
- deprecated=True,
- )
- version(
- "2.7.13",
- sha256="a4f05a0720ce0fd92626f0278b6b433eee9a6173ddf2bced7957dfb599a5ece1",
- deprecated=True,
- )
- version(
- "2.7.12",
- sha256="3cb522d17463dfa69a155ab18cffa399b358c966c0363d6c8b5b3bf1384da4b6",
- deprecated=True,
- )
- version(
- "2.7.11",
- sha256="82929b96fd6afc8da838b149107078c02fa1744b7e60999a8babbc0d3fa86fc6",
- deprecated=True,
- )
- version(
- "2.7.10",
- sha256="eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a",
- deprecated=True,
- )
- version(
- "2.7.9",
- sha256="c8bba33e66ac3201dabdc556f0ea7cfe6ac11946ec32d357c4c6f9b018c12c5b",
- deprecated=True,
- )
- version(
- "2.7.8",
- sha256="74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557",
- deprecated=True,
- )
extendable = True
@@ -331,18 +116,7 @@ class Python(Package):
"debug", default=False, description="debug build with extra checks (this is high overhead)"
)
- # --enable-shared is known to cause problems for some users on macOS
- # This is a problem for Python 2.7 only, not Python3
- # See http://bugs.python.org/issue29846
variant("shared", default=True, description="Enable shared libraries")
- # From https://docs.python.org/2/c-api/unicode.html: Python's default
- # builds use a 16-bit type for Py_UNICODE and store Unicode values
- # internally as UCS2. It is also possible to build a UCS4 version of Python
- # (most recent Linux distributions come with UCS4 builds of Python). These
- # builds then use a 32-bit type for Py_UNICODE and store Unicode data
- # internally as UCS4. Note that UCS2 and UCS4 Python builds are not binary
- # compatible.
- variant("ucs4", default=False, description="Enable UCS4 (wide) unicode strings")
variant("pic", default=True, description="Produce position-independent code (for shared libs)")
variant(
"optimizations",
@@ -353,7 +127,7 @@ class Python(Package):
variant(
"pythoncmd",
default=not is_windows,
- description="Symlink 'python3' executable to 'python' " "(not PEP 394 compliant)",
+ description="Symlink 'python3' executable to 'python' (not PEP 394 compliant)",
)
# Optional Python modules
@@ -364,12 +138,12 @@ class Python(Package):
variant("nis", default=False, description="Build nis module")
variant("zlib", default=True, description="Build zlib module")
variant("bz2", default=True, description="Build bz2 module")
- variant("lzma", default=True, description="Build lzma module", when="@3.3:")
+ variant("lzma", default=True, description="Build lzma module")
variant("pyexpat", default=True, description="Build pyexpat module")
variant("ctypes", default=True, description="Build ctypes module")
variant("tkinter", default=False, description="Build tkinter module")
variant("uuid", default=True, description="Build uuid module")
- variant("tix", default=False, description="Build Tix module")
+ variant("tix", default=False, description="Build Tix module", when="+tkinter")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=linux")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=darwin")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=cray")
@@ -384,24 +158,18 @@ class Python(Package):
depends_on("readline", when="+readline")
depends_on("ncurses", when="+readline")
depends_on("openssl", when="+ssl")
- # https://raw.githubusercontent.com/python/cpython/84471935ed2f62b8c5758fd544c7d37076fe0fa5/Misc/NEWS
- # https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-4rc1
- depends_on("openssl@:1.0.2z", when="@:2.7.13,3.0.0:3.5.2+ssl")
- depends_on(
- "openssl@1.0.2:", when="@3.7:+ssl"
- ) # https://docs.python.org/3/whatsnew/3.7.html#build-changes
- depends_on(
- "openssl@1.1.1:", when="@3.10:+ssl"
- ) # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes
+ # https://docs.python.org/3/whatsnew/3.7.html#build-changes
+ depends_on("openssl@1.0.2:", when="+ssl")
+ # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes
+ depends_on("openssl@1.1.1:", when="@3.10:+ssl")
depends_on("sqlite@3.0.8:", when="@:3.9+sqlite3")
- depends_on(
- "sqlite@3.7.15:", when="@3.10:+sqlite3"
- ) # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes
+ # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes
+ depends_on("sqlite@3.7.15:", when="@3.10:+sqlite3")
depends_on("gdbm", when="+dbm") # alternatively ndbm or berkeley-db
depends_on("libnsl", when="+nis")
depends_on("zlib@1.1.3:", when="+zlib")
depends_on("bzip2", when="+bz2")
- depends_on("xz", when="@3.3:+lzma")
+ depends_on("xz", when="+lzma")
depends_on("expat", when="+pyexpat")
depends_on("libffi", when="+ctypes")
# https://docs.python.org/3/whatsnew/3.11.html#build-changes
@@ -423,16 +191,13 @@ class Python(Package):
# C/C++ modules, consider installing a Spack-managed Python with
# this patch instead. For more information, see:
# https://github.com/spack/spack/pull/16856
- patch("python-2.7.8-distutils-C++.patch", when="@2.7.8:2.7.16")
- patch("python-2.7.17+-distutils-C++.patch", when="@2.7.17:2.7.18")
- patch("python-2.7.17+-distutils-C++-fixup.patch", when="@2.7.17:2.7.18")
- patch("python-3.6.8-distutils-C++.patch", when="@3.6.8,3.7.2")
+ patch("python-3.7.2-distutils-C++.patch", when="@3.7.2")
patch("python-3.7.3-distutils-C++.patch", when="@3.7.3")
patch("python-3.7.4+-distutils-C++.patch", when="@3.7.4:3.10")
patch("python-3.7.4+-distutils-C++-testsuite.patch", when="@3.7.4:")
patch("python-3.11-distutils-C++.patch", when="@3.11.0:3.11")
patch("cpython-windows-externals.patch", when="@:3.9.6 platform=windows")
- patch("tkinter.patch", when="@:2.8,3.3:3.7 platform=darwin")
+ patch("tkinter-3.7.patch", when="@3.7 platform=darwin")
# Patch the setup script to deny that tcl/x11 exists rather than allowing
# autodetection of (possibly broken) system components
patch("tkinter-3.8.patch", when="@3.8:3.9 ~tkinter")
@@ -440,21 +205,15 @@ class Python(Package):
patch("tkinter-3.11.patch", when="@3.11.0:3.11 ~tkinter")
# Ensure that distutils chooses correct compiler option for RPATH on cray:
- patch("cray-rpath-2.3.patch", when="@2.3:3.0.1 platform=cray")
- patch("cray-rpath-3.1.patch", when="@3.1:3 platform=cray")
+ patch("cray-rpath-3.1.patch", when="@3 platform=cray")
# Ensure that distutils chooses correct compiler option for RPATH on fj:
- patch("fj-rpath-2.3.patch", when="@2.3:3.0.1 %fj")
- patch("fj-rpath-3.1.patch", when="@3.1:3.9.7,3.10.0 %fj")
- patch("fj-rpath-3.9.patch", when="@3.9.8:3.9,3.10.1: %fj")
-
- # Fixes an alignment problem with more aggressive optimization in gcc8
- # https://github.com/python/cpython/commit/0b91f8a668201fc58fa732b8acc496caedfdbae0
- patch("gcc-8-2.7.14.patch", when="@2.7.14 %gcc@8:")
+ patch("fj-rpath-3.1.patch", when="@:3.9.7,3.10.0 %fj")
+ patch("fj-rpath-3.9.patch", when="@3.9.8:3.9,3.10.1: %fj")
# Fixes build with the Intel compilers
# https://github.com/python/cpython/pull/16717
- patch("intel-3.6.7.patch", when="@3.6.7:3.6.8,3.7.1:3.7.5 %intel")
+ patch("intel-3.7.patch", when="@3.7.1:3.7.5 %intel")
# CPython tries to build an Objective-C file with GCC's C frontend
# https://github.com/spack/spack/pull/16222
@@ -464,20 +223,7 @@ class Python(Package):
msg="CPython does not compile with GCC on macOS yet, use clang. "
"See: https://github.com/python/cpython/pull/13306",
)
- # For more information refer to this bug report:
- # https://bugs.python.org/issue29712
- conflicts(
- "@:2.8 +shared",
- when="+optimizations",
- msg="+optimizations is incompatible with +shared in python@2.X",
- )
- conflicts("+tix", when="~tkinter", msg="python+tix requires python+tix+tkinter")
conflicts("%nvhpc")
- conflicts(
- "@:2.7",
- when="platform=darwin target=aarch64:",
- msg="Python 2.7 is too old for Apple Silicon",
- )
# Used to cache various attributes that are expensive to compute
_config_vars = {} # type: Dict[str, Dict[str, str]]
@@ -491,7 +237,6 @@ class Python(Package):
def determine_version(cls, exe):
# Newer versions of Python support `--version`,
# but older versions only support `-V`
- # Python 2 sends to STDERR, while Python 3 sends to STDOUT
# Output looks like:
# Python 3.7.7
# On pre-production Ubuntu, this is also possible:
@@ -512,7 +257,18 @@ class Python(Package):
else:
variants += "~pythoncmd"
- for module in ["readline", "sqlite3", "dbm", "nis", "zlib", "bz2", "ctypes", "uuid"]:
+ for module in [
+ "readline",
+ "sqlite3",
+ "dbm",
+ "nis",
+ "zlib",
+ "bz2",
+ "lzma",
+ "ctypes",
+ "tkinter",
+ "uuid",
+ ]:
try:
python("-c", "import " + module, error=os.devnull)
variants += "+" + module
@@ -534,38 +290,12 @@ class Python(Package):
except ProcessError:
variants += "~pyexpat"
- # Some modules are version-dependent
- if Version(version_str) >= Version("3.3"):
- try:
- python("-c", "import lzma", error=os.devnull)
- variants += "+lzma"
- except ProcessError:
- variants += "~lzma"
-
- if Version(version_str) >= Version("3"):
- try:
- python("-c", "import tkinter", error=os.devnull)
- variants += "+tkinter"
- except ProcessError:
- variants += "~tkinter"
-
- try:
- python("-c", "import tkinter.tix", error=os.devnull)
- variants += "+tix"
- except ProcessError:
- variants += "~tix"
- else:
- try:
- python("-c", "import Tkinter", error=os.devnull)
- variants += "+tkinter"
- except ProcessError:
- variants += "~tkinter"
-
- try:
- python("-c", "import Tix", error=os.devnull)
- variants += "+tix"
- except ProcessError:
- variants += "~tix"
+ # Some variant names do not match module names
+ try:
+ python("-c", "import tkinter.tix", error=os.devnull)
+ variants += "+tix"
+ except ProcessError:
+ variants += "~tix"
# Some modules are platform-dependent
if not is_windows:
@@ -581,57 +311,24 @@ class Python(Package):
url = "https://www.python.org/ftp/python/{0}/Python-{1}.tgz"
return url.format(re.split("[a-z]", str(version))[0], version)
- # TODO: Ideally, these patches would be applied as separate '@run_before'
- # functions enabled via '@when', but these two decorators don't work
- # when used together. See: https://github.com/spack/spack/issues/12736
def patch(self):
# NOTE: Python's default installation procedure makes it possible for a
# user's local configurations to change the Spack installation. In
# order to prevent this behavior for a full installation, we must
# modify the installation script so that it ignores user files.
- if self.spec.satisfies("@2.7:2.8,3.4:"):
- ff = FileFilter("Makefile.pre.in")
- ff.filter(
- r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6"
- )
-
- # NOTE: Older versions of Python do not support the '--with-openssl'
- # configuration option, so the installation's module setup file needs
- # to be modified directly in order to point to the correct SSL path.
- # See: https://stackoverflow.com/a/5939170
- if self.spec.satisfies("@:3.6+ssl"):
- ff = FileFilter(join_path("Modules", "Setup.dist"))
- ff.filter(r"^#(((SSL=)|(_ssl))(.*))$", r"\1")
- ff.filter(r"^#((.*)(\$\(SSL\))(.*))$", r"\1")
- ff.filter(r"^SSL=(.*)$", r"SSL={0}".format(self.spec["openssl"].prefix))
- # Because Python uses compiler system paths during install, it's
- # possible to pick up a system OpenSSL when building 'python~ssl'.
- # To avoid this scenario, we disable the 'ssl' module with patching.
- elif self.spec.satisfies("@:3.6~ssl"):
- ff = FileFilter("setup.py")
- ff.filter(r"^(\s+(ssl_((incs)|(libs)))\s+=\s+)(.*)$", r"\1 None and \6")
- ff.filter(r"^(\s+(opensslv_h)\s+=\s+)(.*)$", r"\1 None and \3")
+ ff = FileFilter("Makefile.pre.in")
+ ff.filter(
+ r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6"
+ )
def setup_build_environment(self, env):
spec = self.spec
- # TODO: The '--no-user-cfg' option for Python installation is only in
- # Python v2.7 and v3.4+ (see https://bugs.python.org/issue1180) and
- # adding support for ignoring user configuration will require
- # significant changes to this package for other Python versions.
- if not spec.satisfies("@2.7:2.8,3.4:"):
- tty.warn(
- (
- "Python v{0} may not install properly if Python "
- "user configurations are present."
- ).format(self.version)
- )
-
# TODO: Python has incomplete support for Python modules with mixed
# C/C++ source, and patches are required to enable building for these
# modules. All Python versions without a viable patch are installed
# with a warning message about this potentially erroneous behavior.
- if not spec.satisfies("@2.7.8:2.7.18,3.6.8,3.7.2:"):
+ if not spec.satisfies("@3.7.2:"):
tty.warn(
(
'Python v{0} does not have the C++ "distutils" patch; '
@@ -769,21 +466,12 @@ class Python(Package):
config_args.extend(["CPPFLAGS=" + cppflags, "LDFLAGS=" + ldflags])
- # https://docs.python.org/3/whatsnew/3.7.html#build-changes
- if spec.satisfies("@:3.6"):
- config_args.append("--with-threads")
-
- if spec.satisfies("@2.7.13:2.8,3.5.3:", strict=True) and "+optimizations" in spec:
+ if "+optimizations" in spec:
config_args.append("--enable-optimizations")
config_args.append("--with-lto")
config_args.append("--with-computed-gotos")
- if spec.satisfies("%gcc platform=darwin"):
- config_args.append("--disable-toolbox-glue")
-
- if spec.satisfies("%intel", strict=True) and spec.satisfies(
- "@2.7.12:2.8,3.5.2:3.7", strict=True
- ):
+ if spec.satisfies("@3.7 %intel", strict=True):
config_args.append("--with-icc={0}".format(spack_cc))
if "+debug" in spec:
@@ -796,24 +484,13 @@ class Python(Package):
else:
config_args.append("--disable-shared")
- if "+ucs4" in spec:
- if spec.satisfies("@:2.7"):
- config_args.append("--enable-unicode=ucs4")
- elif spec.satisfies("@3.0:3.2"):
- config_args.append("--with-wide-unicode")
- elif spec.satisfies("@3.3:"):
- # https://docs.python.org/3.3/whatsnew/3.3.html#functionality
- raise ValueError("+ucs4 variant not compatible with Python 3.3 and beyond")
-
- if spec.satisfies("@2.7.9:2,3.4:"):
- config_args.append("--without-ensurepip")
+ config_args.append("--without-ensurepip")
if "+pic" in spec:
cflags.append(self.compiler.cc_pic_flag)
if "+ssl" in spec:
- if spec.satisfies("@3.7:"):
- config_args.append("--with-openssl={0}".format(spec["openssl"].prefix))
+ config_args.append("--with-openssl={0}".format(spec["openssl"].prefix))
if "+dbm" in spec:
# Default order is ndbm:gdbm:bdb
@@ -844,7 +521,7 @@ class Python(Package):
)
# https://docs.python.org/3.8/library/sqlite3.html#f1
- if spec.satisfies("@3.2: +sqlite3 ^sqlite+dynamic_extensions"):
+ if spec.satisfies("+sqlite3 ^sqlite+dynamic_extensions"):
config_args.append("--enable-loadable-sqlite-extensions")
if spec.satisfies("%oneapi"):
@@ -929,19 +606,7 @@ class Python(Package):
spec = self.spec
prefix = self.prefix
- # TODO:
- # On OpenSuse 13, python uses <prefix>/lib64/python2.7/lib-dynload/*.so
- # instead of <prefix>/lib/python2.7/lib-dynload/*.so. Oddly enough the
- # result is that Python can not find modules like cPickle. A workaround
- # for now is to symlink to `lib`:
- src = os.path.join(prefix.lib64, "python{0}".format(self.version.up_to(2)), "lib-dynload")
- dst = os.path.join(prefix.lib, "python{0}".format(self.version.up_to(2)), "lib-dynload")
- if os.path.isdir(src) and not os.path.isdir(dst):
- mkdirp(dst)
- for f in os.listdir(src):
- os.symlink(os.path.join(src, f), os.path.join(dst, f))
-
- if spec.satisfies("@3:") and spec.satisfies("+pythoncmd"):
+ if spec.satisfies("+pythoncmd"):
os.symlink(os.path.join(prefix.bin, "python3"), os.path.join(prefix.bin, "python"))
os.symlink(
os.path.join(prefix.bin, "python3-config"),
@@ -993,9 +658,8 @@ class Python(Package):
self.command("-c", "import bz2")
# Ensure that lzma module works
- if spec.satisfies("@3.3:"):
- if "+lzma" in spec:
- self.command("-c", "import lzma")
+ if "+lzma" in spec:
+ self.command("-c", "import lzma")
# Ensure that pyexpat module works
if "+pyexpat" in spec:
@@ -1011,15 +675,9 @@ class Python(Package):
if "+tkinter" in spec:
# Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y`
if "DISPLAY" in env:
- if spec.satisfies("@3:"):
- self.command("-c", "import tkinter; tkinter._test()")
- else:
- self.command("-c", "import Tkinter; Tkinter._test()")
+ self.command("-c", "import tkinter; tkinter._test()")
else:
- if spec.satisfies("@3:"):
- self.command("-c", "import tkinter")
- else:
- self.command("-c", "import Tkinter")
+ self.command("-c", "import tkinter")
# Ensure that uuid module works
if "+uuid" in spec:
@@ -1027,10 +685,7 @@ class Python(Package):
# Ensure that tix module works
if "+tix" in spec:
- if spec.satisfies("@3:"):
- self.command("-c", "import tkinter.tix")
- else:
- self.command("-c", "import Tix")
+ self.command("-c", "import tkinter.tix")
# Ensure that crypt module works
if "+crypt" in spec:
@@ -1045,10 +700,9 @@ class Python(Package):
"""Returns the Python command, which may vary depending
on the version of Python and how it was installed.
- In general, Python 2 comes with ``python`` and ``python2`` commands,
- while Python 3 only comes with a ``python3`` command. However, some
+ In general, Python 3 only comes with a ``python3`` command. However, some
package managers will symlink ``python`` to ``python3``, while others
- may contain ``python3.6``, ``python3.5``, and ``python3.4`` in the
+ may contain ``python3.11``, ``python3.10``, and ``python3.9`` in the
same directory.
Returns:
@@ -1058,11 +712,11 @@ class Python(Package):
# installed python, several different commands could be located
# in the same directory. Be as specific as possible. Search for:
#
- # * python3.6
+ # * python3.11
# * python3
# * python
#
- # in that order if using python@3.6.5, for example.
+ # in that order if using python@3.11.0, for example.
version = self.spec.version
for ver in [version.up_to(2), version.up_to(1), ""]:
if not is_windows:
@@ -1076,31 +730,6 @@ class Python(Package):
msg = "Unable to locate {0} command in {1}"
raise RuntimeError(msg.format(self.name, self.prefix.bin))
- def print_string(self, string):
- """Returns the appropriate print string depending on the
- version of Python.
-
- Examples:
-
- * Python 2
-
- .. code-block:: python
-
- >>> self.print_string('sys.prefix')
- 'print sys.prefix'
-
- * Python 3
-
- .. code-block:: python
-
- >>> self.print_string('sys.prefix')
- 'print(sys.prefix)'
- """
- if self.spec.satisfies("@:2"):
- return "print {0}".format(string)
- else:
- return "print({0})".format(string)
-
@property
def config_vars(self):
"""Return a set of variable definitions associated with a Python installation.
@@ -1129,10 +758,8 @@ config['config_h_filename'] = get_config_h_filename()
config['makefile_filename'] = get_makefile_filename()
config.update(get_paths())
-%s
-""" % self.print_string(
- "json.dumps(config)"
- )
+print(json.dumps(config))
+"""
dag_hash = self.spec.dag_hash()
lib_prefix = "lib" if not is_windows else ""
@@ -1150,9 +777,6 @@ config.update(get_paths())
"INCLUDEPY": self.prefix.include.join("python{}").format(version),
"LIBDEST": self.prefix.lib.join("python{}").format(version),
"LIBDIR": self.prefix.lib,
- "LIBPL": self.prefix.lib.join("python{0}")
- .join("config-{0}-{1}")
- .format(version, sys.platform),
"LDLIBRARY": "{}python{}.{}".format(lib_prefix, version, dso_suffix),
"LIBRARY": "{}python{}.{}".format(lib_prefix, version, stat_suffix),
"LDSHARED": "cc",
@@ -1196,13 +820,10 @@ config.update(get_paths())
libdest = self.config_vars["LIBDEST"]
- filename = "_sysconfigdata.py"
- if self.spec.satisfies("@3.6:"):
- # Python 3.6.0 renamed the sys config file
- cmd = "from sysconfig import _get_sysconfigdata_name; "
- cmd += self.print_string("_get_sysconfigdata_name()")
- filename = self.command("-c", cmd, output=str).strip()
- filename += ".py"
+ cmd = "from sysconfig import _get_sysconfigdata_name; "
+ cmd += "print(_get_sysconfigdata_name())"
+ filename = self.command("-c", cmd, output=str).strip()
+ filename += ".py"
return join_path(libdest, filename)
@@ -1225,10 +846,6 @@ config.update(get_paths())
# in either lib or lib64, so we need to ask Python where its LIBDIR is.
libdir = self.config_vars["LIBDIR"]
- # In Ubuntu 16.04.6 and python 2.7.12 from the system, lib could be in LBPL
- # https://mail.python.org/pipermail/python-dev/2013-April/125733.html
- libpl = self.config_vars["LIBPL"]
-
# The system Python installation on macOS and Homebrew installations
# install libraries into a Frameworks directory
frameworkprefix = self.config_vars["PYTHONFRAMEWORKPREFIX"]
@@ -1246,7 +863,6 @@ config.update(get_paths())
directories = [
libdir,
- libpl,
frameworkprefix,
macos_developerdir,
win_bin_dir,
@@ -1586,8 +1202,7 @@ config.update(get_paths())
# checks import works and executable comes from the spec prefix
reason = "test: checking import and executable"
- print_str = self.print_string("sys.executable")
- options = ["-c", "import sys; {0}".format(print_str)]
+ options = ["-c", "import sys; print(sys.executable)"]
self.run_test(
exe, options=options, expected=[self.spec.prefix], installed=True, purpose=reason
)
diff --git a/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++-fixup.patch b/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++-fixup.patch
deleted file mode 100644
index a3c179b6aa..0000000000
--- a/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++-fixup.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-This patch fixes a regression intoduced by python-2.7.17+-distutils-C++.patch
-and updates the distutils testsuite to pass with 2.7.16:2.7.18:
-
-This how the test suite would have to change when the bug is not fixed:
-
- self.assertEqual(comp.exes['compiler'],
-- 'env_cc --sc-cflags --env-cflags --env-cppflags')
-+ 'env_cc --env-cflags --env-cppflags')
- self.assertEqual(comp.exes['compiler_so'],
-- ('env_cc --sc-cflags '
-+ ('env_cc '
- '--env-cflags ''--env-cppflags --sc-ccshared'))
- self.assertEqual(comp.exes['compiler'],
-- 'sc_cc --sc-cflags')
-+ 'sc_cc ')
- self.assertEqual(comp.exes['compiler_so'],
-- 'sc_cc --sc-cflags --sc-ccshared')
-+ 'sc_cc --sc-ccshared')
- self.assertEqual(comp.exes['compiler_cxx'],
-- 'sc_cxx')
-+ 'sc_cxx ')
-
-As shown, it removes the default, builtin cflags when calling the pure
-C compiler CC, which is wrong, introducing a regression.
-
-The cause is that the patch removes reading the python distutils cflags
-value and sets both empty.
-
-- (cc, cxx, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
-- get_config_vars('CC', 'CXX', 'CFLAGS',
-- 'CCSHARED', 'LDSHARED', 'SO', 'AR',
-- 'ARFLAGS')
-+ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
-+ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'SO', 'AR', 'ARFLAGS')
-+ cflags = ''
-+ cxxflags = ''
-
-The fix is obvious when comparing it with python-3.7.4+-distutils-C++.patch
-
-- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
-- get_config_vars('CC', 'CXX', 'CFLAGS',
-- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
-+ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
-+ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
-+
-+ cxxflags = cflags
-
-When handling CFLAGS the same as in python-3.7.4+-distutils-C++.patch,
-the issue is fixed.
-
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -181,12 +181,11 @@
- _osx_support.customize_compiler(_config_vars)
- _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
-
-- (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
-- get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
-+ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
- 'SO', 'AR', 'ARFLAGS')
-
-- cflags = ''
-- cxxflags = ''
-+ cxxflags = cflags
-
- if 'CC' in os.environ:
- newcc = os.environ['CC']
---- a/Lib/distutils/tests/test_sysconfig.py
-+++ b/Lib/distutils/tests/test_sysconfig.py
-@@ -65,6 +65,7 @@
- 'CXX': 'sc_cxx',
- 'ARFLAGS': '--sc-arflags',
- 'CFLAGS': '--sc-cflags',
-+ 'CPPFLAGS': '--sc-cppflags',
- 'CCSHARED': '--sc-ccshared',
- 'LDSHARED': 'sc_ldshared',
- 'SO': 'sc_shutil_suffix',
-@@ -94,11 +95,12 @@
- os.environ['AR'] = 'env_ar'
- os.environ['CC'] = 'env_cc'
- os.environ['CPP'] = 'env_cpp'
-- os.environ['CXX'] = 'env_cxx --env-cxx-flags'
-+ os.environ['CXX'] = 'env_cxx'
- os.environ['LDSHARED'] = 'env_ldshared'
- os.environ['LDFLAGS'] = '--env-ldflags'
- os.environ['ARFLAGS'] = '--env-arflags'
- os.environ['CFLAGS'] = '--env-cflags'
-+ os.environ['CXXFLAGS'] = '--env-cxxflags'
- os.environ['CPPFLAGS'] = '--env-cppflags'
-
- comp = self.customize_compiler()
-@@ -112,7 +114,7 @@
- ('env_cc --sc-cflags '
- '--env-cflags ''--env-cppflags --sc-ccshared'))
- self.assertEqual(comp.exes['compiler_cxx'],
-- 'env_cxx --env-cxx-flags')
-+ 'env_cxx --sc-cflags --env-cxxflags --env-cppflags')
- self.assertEqual(comp.exes['linker_exe'],
- 'env_cc')
- self.assertEqual(comp.exes['linker_so'],
-@@ -128,6 +130,7 @@
- del os.environ['LDFLAGS']
- del os.environ['ARFLAGS']
- del os.environ['CFLAGS']
-+ del os.environ['CXXFLAGS']
- del os.environ['CPPFLAGS']
-
- comp = self.customize_compiler()
-@@ -140,7 +143,7 @@
- self.assertEqual(comp.exes['compiler_so'],
- 'sc_cc --sc-cflags --sc-ccshared')
- self.assertEqual(comp.exes['compiler_cxx'],
-- 'sc_cxx')
-+ 'sc_cxx --sc-cflags')
- self.assertEqual(comp.exes['linker_exe'],
- 'sc_cc')
- self.assertEqual(comp.exes['linker_so'],
diff --git a/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++.patch b/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++.patch
deleted file mode 100644
index 1d2249fcfc..0000000000
--- a/var/spack/repos/builtin/packages/python/python-2.7.17+-distutils-C++.patch
+++ /dev/null
@@ -1,269 +0,0 @@
-diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
-index d2aaae7..8bcdb05 100644
---- a/Lib/_osx_support.py
-+++ b/Lib/_osx_support.py
-@@ -14,13 +14,13 @@ __all__ = [
- # configuration variables that may contain universal build flags,
- # like "-arch" or "-isdkroot", that may need customization for
- # the user environment
--_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
-- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
-- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
-- 'PY_CORE_CFLAGS')
-+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
-+ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
-+ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
-
- # configuration variables that may contain compiler calls
--_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
-+_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
-
- # prefix added to original configuration variable names
- _INITPRE = '_OSX_SUPPORT_INITIAL_'
-diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
-index 258e138..13b7d0c 100644
---- a/Lib/distutils/cygwinccompiler.py
-+++ b/Lib/distutils/cygwinccompiler.py
-@@ -117,8 +117,10 @@ class CygwinCCompiler (UnixCCompiler):
- # dllwrap 2.10.90 is buggy
- if self.ld_version >= "2.10.90":
- self.linker_dll = "gcc"
-+ self.linker_dll_cxx = "g++"
- else:
- self.linker_dll = "dllwrap"
-+ self.linker_dll_cxx = "dllwrap"
-
- # ld_version >= "2.13" support -shared so use it instead of
- # -mdll -static
-@@ -132,9 +134,13 @@ class CygwinCCompiler (UnixCCompiler):
- self.set_executables(compiler='gcc -mcygwin -O -Wall',
- compiler_so='gcc -mcygwin -mdll -O -Wall',
- compiler_cxx='g++ -mcygwin -O -Wall',
-+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
- linker_exe='gcc -mcygwin',
- linker_so=('%s -mcygwin %s' %
-- (self.linker_dll, shared_option)))
-+ (self.linker_dll, shared_option)),
-+ linker_exe_cxx='g++ -mcygwin',
-+ linker_so_cxx=('%s -mcygwin %s' %
-+ (self.linker_dll_cxx, shared_option)))
-
- # cygwin and mingw32 need different sets of libraries
- if self.gcc_version == "2.91.57":
-@@ -160,8 +166,12 @@ class CygwinCCompiler (UnixCCompiler):
- raise CompileError, msg
- else: # for other files use the C-compiler
- try:
-- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
-@@ -327,9 +337,14 @@ class Mingw32CCompiler (CygwinCCompiler):
- self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
- compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
- compiler_cxx='g++%s -O -Wall' % no_cygwin,
-+ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin,
- linker_exe='gcc%s' % no_cygwin,
- linker_so='%s%s %s %s'
- % (self.linker_dll, no_cygwin,
-+ shared_option, entry_point),
-+ linker_exe_cxx='g++%s' % no_cygwin,
-+ linker_so_cxx='%s%s %s %s'
-+ % (self.linker_dll_cxx, no_cygwin,
- shared_option, entry_point))
- # Maybe we should also append -mthreads, but then the finished
- # dlls need another dll (mingwm10.dll see Mingw32 docs)
-diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py
-index a017205..bdc532c 100644
---- a/Lib/distutils/emxccompiler.py
-+++ b/Lib/distutils/emxccompiler.py
-@@ -65,8 +65,12 @@ class EMXCCompiler (UnixCCompiler):
- # XXX optimization, warnings etc. should be customizable.
- self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
- compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
-+ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
-+ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
- linker_exe='gcc -Zomf -Zmt -Zcrtdll',
-- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
-+ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
-+ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
-+ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
-
- # want the gcc library statically linked (so that we don't have
- # to distribute a version dependent on the compiler we have)
-@@ -83,8 +87,12 @@ class EMXCCompiler (UnixCCompiler):
- raise CompileError, msg
- else: # for other files use the C-compiler
- try:
-- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
-diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
-index 1a4b792..9d724b2 100644
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -181,10 +181,12 @@ def customize_compiler(compiler):
- _osx_support.customize_compiler(_config_vars)
- _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
-
-- (cc, cxx, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
-- get_config_vars('CC', 'CXX', 'CFLAGS',
-- 'CCSHARED', 'LDSHARED', 'SO', 'AR',
-- 'ARFLAGS')
-+ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
-+ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'SO', 'AR', 'ARFLAGS')
-+
-+ cflags = ''
-+ cxxflags = ''
-
- if 'CC' in os.environ:
- newcc = os.environ['CC']
-@@ -199,19 +201,27 @@ def customize_compiler(compiler):
- cxx = os.environ['CXX']
- if 'LDSHARED' in os.environ:
- ldshared = os.environ['LDSHARED']
-+ if 'LDCXXSHARED' in os.environ:
-+ ldcxxshared = os.environ['LDCXXSHARED']
- if 'CPP' in os.environ:
- cpp = os.environ['CPP']
- else:
- cpp = cc + " -E" # not always
- if 'LDFLAGS' in os.environ:
- ldshared = ldshared + ' ' + os.environ['LDFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
- if 'CFLAGS' in os.environ:
- cflags = cflags + ' ' + os.environ['CFLAGS']
- ldshared = ldshared + ' ' + os.environ['CFLAGS']
-+ if 'CXXFLAGS' in os.environ:
-+ cxxflags = cxxflags + ' ' + os.environ['CXXFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
- if 'CPPFLAGS' in os.environ:
- cpp = cpp + ' ' + os.environ['CPPFLAGS']
- cflags = cflags + ' ' + os.environ['CPPFLAGS']
-+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
- ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
- if 'AR' in os.environ:
- ar = os.environ['AR']
- if 'ARFLAGS' in os.environ:
-@@ -220,13 +230,17 @@ def customize_compiler(compiler):
- archiver = ar + ' ' + ar_flags
-
- cc_cmd = cc + ' ' + cflags
-+ cxx_cmd = cxx + ' ' + cxxflags
- compiler.set_executables(
- preprocessor=cpp,
- compiler=cc_cmd,
- compiler_so=cc_cmd + ' ' + ccshared,
-- compiler_cxx=cxx,
-+ compiler_cxx=cxx_cmd,
-+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
- linker_so=ldshared,
- linker_exe=cc,
-+ linker_so_cxx=ldcxxshared,
-+ linker_exe_cxx=cxx,
- archiver=archiver)
-
- compiler.shared_lib_extension = so_ext
-diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
-index 3af540e..f8f7efe 100644
---- a/Lib/distutils/unixccompiler.py
-+++ b/Lib/distutils/unixccompiler.py
-@@ -55,14 +55,17 @@ class UnixCCompiler(CCompiler):
- # are pretty generic; they will probably have to be set by an outsider
- # (eg. using information discovered by the sysconfig about building
- # Python extensions).
-- executables = {'preprocessor' : None,
-- 'compiler' : ["cc"],
-- 'compiler_so' : ["cc"],
-- 'compiler_cxx' : ["cc"],
-- 'linker_so' : ["cc", "-shared"],
-- 'linker_exe' : ["cc"],
-- 'archiver' : ["ar", "-cr"],
-- 'ranlib' : None,
-+ executables = {'preprocessor' : None,
-+ 'compiler' : ["cc"],
-+ 'compiler_so' : ["cc"],
-+ 'compiler_cxx' : ["c++"],
-+ 'compiler_so_cxx' : ["c++"],
-+ 'linker_so' : ["cc", "-shared"],
-+ 'linker_exe' : ["cc"],
-+ 'linker_so_cxx' : ["c++", "-shared"],
-+ 'linker_exe_cxx' : ["c++"],
-+ 'archiver' : ["ar", "-cr"],
-+ 'ranlib' : None,
- }
-
- if sys.platform[:6] == "darwin":
-@@ -114,12 +117,19 @@ class UnixCCompiler(CCompiler):
-
- def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
- compiler_so = self.compiler_so
-+ compiler_so_cxx = self.compiler_so_cxx
- if sys.platform == 'darwin':
- compiler_so = _osx_support.compiler_fixup(compiler_so,
- cc_args + extra_postargs)
-+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
-+ cc_args + extra_postargs)
- try:
-- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
-@@ -176,23 +186,16 @@ class UnixCCompiler(CCompiler):
- ld_args.extend(extra_postargs)
- self.mkpath(os.path.dirname(output_filename))
- try:
-- if target_desc == CCompiler.EXECUTABLE:
-- linker = self.linker_exe[:]
-+ if target_lang == "c++":
-+ if target_desc == CCompiler.EXECUTABLE:
-+ linker = self.linker_exe_cxx[:]
-+ else:
-+ linker = self.linker_so_cxx[:]
- else:
-- linker = self.linker_so[:]
-- if target_lang == "c++" and self.compiler_cxx:
-- # skip over environment variable settings if /usr/bin/env
-- # is used to set up the linker's environment.
-- # This is needed on OSX. Note: this assumes that the
-- # normal and C++ compiler have the same environment
-- # settings.
-- i = 0
-- if os.path.basename(linker[0]) == "env":
-- i = 1
-- while '=' in linker[i]:
-- i = i + 1
--
-- linker[i] = self.compiler_cxx[i]
-+ if target_desc == CCompiler.EXECUTABLE:
-+ linker = self.linker_exe[:]
-+ else:
-+ linker = self.linker_so[:]
-
- if sys.platform == 'darwin':
- linker = _osx_support.compiler_fixup(linker, ld_args)
diff --git a/var/spack/repos/builtin/packages/python/python-2.7.8-distutils-C++.patch b/var/spack/repos/builtin/packages/python/python-2.7.8-distutils-C++.patch
deleted file mode 100644
index d6710066d5..0000000000
--- a/var/spack/repos/builtin/packages/python/python-2.7.8-distutils-C++.patch
+++ /dev/null
@@ -1,260 +0,0 @@
---- a/Lib/distutils/cygwinccompiler.py
-+++ b/Lib/distutils/cygwinccompiler.py
-@@ -117,8 +117,10 @@
- # dllwrap 2.10.90 is buggy
- if self.ld_version >= "2.10.90":
- self.linker_dll = "gcc"
-+ self.linker_dll_cxx = "g++"
- else:
- self.linker_dll = "dllwrap"
-+ self.linker_dll_cxx = "dllwrap"
-
- # ld_version >= "2.13" support -shared so use it instead of
- # -mdll -static
-@@ -132,9 +134,13 @@
- self.set_executables(compiler='gcc -mcygwin -O -Wall',
- compiler_so='gcc -mcygwin -mdll -O -Wall',
- compiler_cxx='g++ -mcygwin -O -Wall',
-+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
- linker_exe='gcc -mcygwin',
- linker_so=('%s -mcygwin %s' %
-- (self.linker_dll, shared_option)))
-+ (self.linker_dll, shared_option)),
-+ linker_exe_cxx='g++ -mcygwin',
-+ linker_so_cxx=('%s -mcygwin %s' %
-+ (self.linker_dll_cxx, shared_option)))
-
- # cygwin and mingw32 need different sets of libraries
- if self.gcc_version == "2.91.57":
-@@ -160,8 +166,12 @@
- raise CompileError, msg
- else: # for other files use the C-compiler
- try:
-- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
-@@ -327,9 +337,14 @@
- self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
- compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
- compiler_cxx='g++%s -O -Wall' % no_cygwin,
-+ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin,
- linker_exe='gcc%s' % no_cygwin,
- linker_so='%s%s %s %s'
- % (self.linker_dll, no_cygwin,
-+ shared_option, entry_point),
-+ linker_exe_cxx='g++%s' % no_cygwin,
-+ linker_so_cxx='%s%s %s %s'
-+ % (self.linker_dll_cxx, no_cygwin,
- shared_option, entry_point))
- # Maybe we should also append -mthreads, but then the finished
- # dlls need another dll (mingwm10.dll see Mingw32 docs)
---- a/Lib/distutils/emxccompiler.py
-+++ b/Lib/distutils/emxccompiler.py
-@@ -65,8 +65,12 @@
- # XXX optimization, warnings etc. should be customizable.
- self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
- compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
-+ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
-+ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
- linker_exe='gcc -Zomf -Zmt -Zcrtdll',
-- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
-+ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
-+ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
-+ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
-
- # want the gcc library statically linked (so that we don't have
- # to distribute a version dependent on the compiler we have)
-@@ -83,8 +87,12 @@
- raise CompileError, msg
- else: # for other files use the C-compiler
- try:
-- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -170,10 +170,12 @@
- _osx_support.customize_compiler(_config_vars)
- _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
-
-- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
-- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
-- 'CCSHARED', 'LDSHARED', 'SO', 'AR',
-- 'ARFLAGS')
-+ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
-+ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'SO', 'AR', 'ARFLAGS')
-+
-+ cflags = ''
-+ cxxflags = ''
-
- if 'CC' in os.environ:
- newcc = os.environ['CC']
-@@ -188,19 +190,27 @@
- cxx = os.environ['CXX']
- if 'LDSHARED' in os.environ:
- ldshared = os.environ['LDSHARED']
-+ if 'LDCXXSHARED' in os.environ:
-+ ldcxxshared = os.environ['LDCXXSHARED']
- if 'CPP' in os.environ:
- cpp = os.environ['CPP']
- else:
- cpp = cc + " -E" # not always
- if 'LDFLAGS' in os.environ:
- ldshared = ldshared + ' ' + os.environ['LDFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
- if 'CFLAGS' in os.environ:
-- cflags = opt + ' ' + os.environ['CFLAGS']
-+ cflags = os.environ['CFLAGS']
- ldshared = ldshared + ' ' + os.environ['CFLAGS']
-+ if 'CXXFLAGS' in os.environ:
-+ cxxflags = os.environ['CXXFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
- if 'CPPFLAGS' in os.environ:
- cpp = cpp + ' ' + os.environ['CPPFLAGS']
- cflags = cflags + ' ' + os.environ['CPPFLAGS']
-+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
- ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
-+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
- if 'AR' in os.environ:
- ar = os.environ['AR']
- if 'ARFLAGS' in os.environ:
-@@ -209,13 +219,17 @@
- archiver = ar + ' ' + ar_flags
-
- cc_cmd = cc + ' ' + cflags
-+ cxx_cmd = cxx + ' ' + cxxflags
- compiler.set_executables(
- preprocessor=cpp,
- compiler=cc_cmd,
- compiler_so=cc_cmd + ' ' + ccshared,
-- compiler_cxx=cxx,
-+ compiler_cxx=cxx_cmd,
-+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
- linker_so=ldshared,
- linker_exe=cc,
-+ linker_so_cxx=ldcxxshared,
-+ linker_exe_cxx=cxx,
- archiver=archiver)
-
- compiler.shared_lib_extension = so_ext
---- a/Lib/distutils/unixccompiler.py
-+++ b/Lib/distutils/unixccompiler.py
-@@ -55,14 +55,17 @@
- # are pretty generic; they will probably have to be set by an outsider
- # (eg. using information discovered by the sysconfig about building
- # Python extensions).
-- executables = {'preprocessor' : None,
-- 'compiler' : ["cc"],
-- 'compiler_so' : ["cc"],
-- 'compiler_cxx' : ["cc"],
-- 'linker_so' : ["cc", "-shared"],
-- 'linker_exe' : ["cc"],
-- 'archiver' : ["ar", "-cr"],
-- 'ranlib' : None,
-+ executables = {'preprocessor' : None,
-+ 'compiler' : ["cc"],
-+ 'compiler_so' : ["cc"],
-+ 'compiler_cxx' : ["c++"],
-+ 'compiler_so_cxx' : ["c++"],
-+ 'linker_so' : ["cc", "-shared"],
-+ 'linker_exe' : ["cc"],
-+ 'linker_so_cxx' : ["c++", "-shared"],
-+ 'linker_exe_cxx' : ["c++"],
-+ 'archiver' : ["ar", "-cr"],
-+ 'ranlib' : None,
- }
-
- if sys.platform[:6] == "darwin":
-@@ -112,12 +115,19 @@
-
- def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
- compiler_so = self.compiler_so
-+ compiler_so_cxx = self.compiler_so_cxx
- if sys.platform == 'darwin':
- compiler_so = _osx_support.compiler_fixup(compiler_so,
- cc_args + extra_postargs)
-+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
-+ cc_args + extra_postargs)
- try:
-- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
-- extra_postargs)
-+ if self.detect_language(src) == 'c++':
-+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
-+ extra_postargs)
-+ else:
-+ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
-+ extra_postargs)
- except DistutilsExecError, msg:
- raise CompileError, msg
-
-@@ -174,23 +184,16 @@
- ld_args.extend(extra_postargs)
- self.mkpath(os.path.dirname(output_filename))
- try:
-- if target_desc == CCompiler.EXECUTABLE:
-- linker = self.linker_exe[:]
-+ if target_lang == "c++":
-+ if target_desc == CCompiler.EXECUTABLE:
-+ linker = self.linker_exe_cxx[:]
-+ else:
-+ linker = self.linker_so_cxx[:]
- else:
-- linker = self.linker_so[:]
-- if target_lang == "c++" and self.compiler_cxx:
-- # skip over environment variable settings if /usr/bin/env
-- # is used to set up the linker's environment.
-- # This is needed on OSX. Note: this assumes that the
-- # normal and C++ compiler have the same environment
-- # settings.
-- i = 0
-- if os.path.basename(linker[0]) == "env":
-- i = 1
-- while '=' in linker[i]:
-- i = i + 1
--
-- linker[i] = self.compiler_cxx[i]
-+ if target_desc == CCompiler.EXECUTABLE:
-+ linker = self.linker_exe[:]
-+ else:
-+ linker = self.linker_so[:]
-
- if sys.platform == 'darwin':
- linker = _osx_support.compiler_fixup(linker, ld_args)
---- a/Lib/_osx_support.py
-+++ b/Lib/_osx_support.py
-@@ -14,13 +14,13 @@
- # configuration variables that may contain universal build flags,
- # like "-arch" or "-isdkroot", that may need customization for
- # the user environment
--_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
-- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
-- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
-- 'PY_CORE_CFLAGS')
-+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
-+ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
-+ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
-+ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
-
- # configuration variables that may contain compiler calls
--_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
-+_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
-
- # prefix added to original configuration variable names
- _INITPRE = '_OSX_SUPPORT_INITIAL_'
diff --git a/var/spack/repos/builtin/packages/python/python-3.6.8-distutils-C++.patch b/var/spack/repos/builtin/packages/python/python-3.7.2-distutils-C++.patch
index 5728fad6f7..5728fad6f7 100644
--- a/var/spack/repos/builtin/packages/python/python-3.6.8-distutils-C++.patch
+++ b/var/spack/repos/builtin/packages/python/python-3.7.2-distutils-C++.patch
diff --git a/var/spack/repos/builtin/packages/python/tkinter.patch b/var/spack/repos/builtin/packages/python/tkinter-3.7.patch
index 87e1901807..87e1901807 100644
--- a/var/spack/repos/builtin/packages/python/tkinter.patch
+++ b/var/spack/repos/builtin/packages/python/tkinter-3.7.patch