summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2019-10-31 14:20:46 -0500
committerGitHub <noreply@github.com>2019-10-31 14:20:46 -0500
commit536486f0e57b9bb6e6fe643472e8254a9d2aa5e8 (patch)
tree336769f90a8541f3445aef31d215d8bf2119fa48 /lib
parent14fdaca4b4ce4d52fbdae4aa34d31775baa45f9c (diff)
downloadspack-536486f0e57b9bb6e6fe643472e8254a9d2aa5e8.tar.gz
spack-536486f0e57b9bb6e6fe643472e8254a9d2aa5e8.tar.bz2
spack-536486f0e57b9bb6e6fe643472e8254a9d2aa5e8.tar.xz
spack-536486f0e57b9bb6e6fe643472e8254a9d2aa5e8.zip
Travis CI: Test Python 3.8 (#13347)
* Travis CI: Test Python 3.8 * Fix use of deprecated cgi.escape method * Fix version comparison * Fix flake8 F811 change in Python 3.8 * Make flake8 happy * Use Python 3.8 for all test categories
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/getting_started.rst2
-rw-r--r--lib/spack/spack/cmd/flake8.py12
-rw-r--r--lib/spack/spack/cmd/list.py10
3 files changed, 20 insertions, 4 deletions
diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst
index 319d7f3c88..4d316b3bfa 100644
--- a/lib/spack/docs/getting_started.rst
+++ b/lib/spack/docs/getting_started.rst
@@ -16,7 +16,7 @@ Prerequisites
Spack has the following minimum requirements, which must be installed
before Spack is run:
-#. Python 2 (2.6 or 2.7) or 3 (3.4 - 3.7) to run Spack
+#. Python 2 (2.6 or 2.7) or 3 (3.5 - 3.8) to run Spack
#. A C/C++ compiler for building
#. The ``make`` executable for building
#. The ``git`` and ``curl`` commands for fetching
diff --git a/lib/spack/spack/cmd/flake8.py b/lib/spack/spack/cmd/flake8.py
index 61f7dd567f..cc5b168c4b 100644
--- a/lib/spack/spack/cmd/flake8.py
+++ b/lib/spack/spack/cmd/flake8.py
@@ -178,6 +178,12 @@ def add_pattern_exemptions(line, codes):
def filter_file(source, dest, output=False):
"""Filter a single file through all the patterns in pattern_exemptions."""
+
+ # Prior to Python 3.8, `noqa: F811` needed to be placed on the `@when` line
+ # Starting with Python 3.8, it must be placed on the `def` line
+ # https://gitlab.com/pycqa/flake8/issues/583
+ ignore_f811_on_previous_line = False
+
with open(source) as infile:
parent = os.path.dirname(dest)
mkdirp(parent)
@@ -197,6 +203,12 @@ def filter_file(source, dest, output=False):
line_errors.append(code)
break
+ if 'F811' in line_errors:
+ ignore_f811_on_previous_line = True
+ elif ignore_f811_on_previous_line:
+ line_errors.append('F811')
+ ignore_f811_on_previous_line = False
+
if line_errors:
line = add_pattern_exemptions(line, line_errors)
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py
index 570dcc7e27..fe6983ce74 100644
--- a/lib/spack/spack/cmd/list.py
+++ b/lib/spack/spack/cmd/list.py
@@ -7,7 +7,6 @@ from __future__ import print_function
from __future__ import division
import argparse
-import cgi
import fnmatch
import os
import re
@@ -23,6 +22,11 @@ import spack.repo
import spack.cmd.common.arguments as arguments
from spack.version import VersionList
+if sys.version_info > (3, 1):
+ from html import escape
+else:
+ from cgi import escape
+
description = "list and search available packages"
section = "basic"
level = "short"
@@ -217,7 +221,7 @@ def html(pkg_names, out):
out.write('<dd><ul class="first last simple">\n')
out.write(('<li>'
'<a class="reference external" href="%s">%s</a>'
- '</li>\n') % (pkg.homepage, cgi.escape(pkg.homepage)))
+ '</li>\n') % (pkg.homepage, escape(pkg.homepage, True)))
out.write('</ul></dd>\n')
out.write('<dt>Spack package:</dt>\n')
@@ -249,7 +253,7 @@ def html(pkg_names, out):
out.write('<dt>Description:</dt>\n')
out.write('<dd>\n')
- out.write(cgi.escape(pkg.format_doc(indent=2)))
+ out.write(escape(pkg.format_doc(indent=2), True))
out.write('\n')
out.write('</dd>\n')
out.write('</dl>\n')