summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-10-06 23:42:34 +0200
committerGitHub <noreply@github.com>2022-10-06 23:42:34 +0200
commit1a12ddbd2da6964cc9f2ac0e7d71c6f043ab68f7 (patch)
treecd32039b3a8a8bb42012f9d8abf5075d5660a29c /lib
parentf43887dd4ed67dcb81e9f4e4874976ca0b88f7c3 (diff)
downloadspack-1a12ddbd2da6964cc9f2ac0e7d71c6f043ab68f7.tar.gz
spack-1a12ddbd2da6964cc9f2ac0e7d71c6f043ab68f7.tar.bz2
spack-1a12ddbd2da6964cc9f2ac0e7d71c6f043ab68f7.tar.xz
spack-1a12ddbd2da6964cc9f2ac0e7d71c6f043ab68f7.zip
Add a warning on Python 2.7 deprecation (#33052)
Co-authored-by: alalazo <alalazo@users.noreply.github.com> Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/main.py6
-rw-r--r--lib/spack/spack/test/cmd/commands.py3
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index 78a0d47519..ed8604f1ff 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -547,6 +547,12 @@ def setup_main_options(args):
# Assign a custom function to show warnings
warnings.showwarning = send_warning_to_tty
+ if sys.version_info[:2] == (2, 7):
+ warnings.warn(
+ "Python 2.7 support is deprecated and will be removed in Spack v0.20.\n"
+ " Please move to Python 3.6 or higher."
+ )
+
# Set up environment based on args.
tty.set_verbose(args.verbose)
tty.set_debug(args.debug)
diff --git a/lib/spack/spack/test/cmd/commands.py b/lib/spack/spack/test/cmd/commands.py
index d972f86d7f..da20927589 100644
--- a/lib/spack/spack/test/cmd/commands.py
+++ b/lib/spack/spack/test/cmd/commands.py
@@ -22,6 +22,9 @@ parser = spack.main.make_argument_parser()
spack.main.add_all_commands(parser)
+@pytest.mark.skipif(
+ sys.version_info[:2] == (2, 7), reason="Fails as the output contains a warning on Python 2.7"
+)
def test_names():
"""Test default output of spack commands."""
out1 = commands().strip().split("\n")