Remove support for running with Python 2.7 (#33063)
* Remove CI jobs related to Python 2.7 * Remove Python 2.7 specific code from Spack core * Remove externals for Python 2 only * Remove llnl.util.compat
This commit is contained in:

committed by
GitHub

parent
f4c3d98064
commit
3efa4ee26f
@@ -1,3 +1,7 @@
|
||||
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import os
|
||||
import sys
|
||||
from os.path import dirname as dn
|
||||
@@ -14,10 +18,6 @@ def main(argv=None):
|
||||
|
||||
# Add external libs
|
||||
spack_external_libs = os.path.join(spack_lib_path, "external")
|
||||
|
||||
if sys.version_info[:2] <= (2, 7):
|
||||
sys.path.insert(0, os.path.join(spack_external_libs, "py2"))
|
||||
|
||||
sys.path.insert(0, spack_external_libs)
|
||||
# Here we delete ruamel.yaml in case it has been already imported from site
|
||||
# (see #9206 for a broader description of the issue).
|
||||
@@ -31,29 +31,6 @@ def main(argv=None):
|
||||
if "ruamel" in sys.modules:
|
||||
del sys.modules["ruamel"]
|
||||
|
||||
# The following code is here to avoid failures when updating
|
||||
# the develop version, due to spurious argparse.pyc files remaining
|
||||
# in the libs/spack/external directory, see:
|
||||
# https://github.com/spack/spack/pull/25376
|
||||
# TODO: Remove in v0.18.0 or later
|
||||
try:
|
||||
import argparse # noqa: F401
|
||||
except ImportError:
|
||||
argparse_pyc = os.path.join(spack_external_libs, "argparse.pyc")
|
||||
if not os.path.exists(argparse_pyc):
|
||||
raise
|
||||
try:
|
||||
os.remove(argparse_pyc)
|
||||
import argparse # noqa: F401
|
||||
except Exception:
|
||||
msg = (
|
||||
"The file\n\n\t{0}\n\nis corrupted and cannot be deleted by Spack. "
|
||||
"Either delete it manually or ask some administrator to "
|
||||
"delete it for you."
|
||||
)
|
||||
print(msg.format(argparse_pyc))
|
||||
sys.exit(1)
|
||||
|
||||
import spack.main # noqa: E402
|
||||
|
||||
sys.exit(spack.main.main(argv))
|
||||
|
Reference in New Issue
Block a user