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
This commit is contained in:
		 Adam J. Stewart
					Adam J. Stewart
				
			
				
					committed by
					
						 Todd Gamblin
						Todd Gamblin
					
				
			
			
				
	
			
			
			 Todd Gamblin
						Todd Gamblin
					
				
			
						parent
						
							30c9609c4e
						
					
				
				
					commit
					338a532e07
				
			
							
								
								
									
										26
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -18,12 +18,12 @@ jobs: | |||||||
|   fast_finish: true |   fast_finish: true | ||||||
|   include: |   include: | ||||||
|     - stage: 'style checks' |     - stage: 'style checks' | ||||||
|       python: '3.7' |       python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: TEST_SUITE=flake8 |       env: TEST_SUITE=flake8 | ||||||
| # Shell integration with module files | # Shell integration with module files | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=bootstrap ] |       env: [ TEST_SUITE=bootstrap ] | ||||||
| @@ -46,10 +46,14 @@ jobs: | |||||||
|       language: python |       language: python | ||||||
|       env: TEST_SUITE=unit |       env: TEST_SUITE=unit | ||||||
|     - python: '3.7' |     - python: '3.7' | ||||||
|  |       os: linux | ||||||
|  |       language: python | ||||||
|  |       env: TEST_SUITE=unit | ||||||
|  |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=unit, COVERAGE=true ] |       env: [ TEST_SUITE=unit, COVERAGE=true ] | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: TEST_SUITE=doc |       env: TEST_SUITE=doc | ||||||
| @@ -64,41 +68,41 @@ jobs: | |||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=mpich' ] |       env: [ TEST_SUITE=build, 'SPEC=mpich' ] | ||||||
| # astyle (MakefilePackage) | # astyle (MakefilePackage) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=astyle' ] |       env: [ TEST_SUITE=build, 'SPEC=astyle' ] | ||||||
| # tut (WafPackage) | # tut (WafPackage) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=tut' ] |       env: [ TEST_SUITE=build, 'SPEC=tut' ] | ||||||
| # py-setuptools (PythonPackage) | # py-setuptools (PythonPackage) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=py-setuptools' ] |       env: [ TEST_SUITE=build, 'SPEC=py-setuptools' ] | ||||||
| # perl-dbi (PerlPackage) | # perl-dbi (PerlPackage) | ||||||
| #    - python: '2.7' | #    - python: '3.8' | ||||||
| #      os: linux | #      os: linux | ||||||
| #      language: python | #      language: python | ||||||
| #      env: [ TEST_SUITE=build, 'SPEC=perl-dbi' ] | #      env: [ TEST_SUITE=build, 'SPEC=perl-dbi' ] | ||||||
| # openjpeg (CMakePackage + external cmake) | # openjpeg (CMakePackage + external cmake) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=openjpeg' ] |       env: [ TEST_SUITE=build, 'SPEC=openjpeg' ] | ||||||
| # r-rcpp (RPackage + external R) | # r-rcpp (RPackage + external R) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=r-rcpp' ] |       env: [ TEST_SUITE=build, 'SPEC=r-rcpp' ] | ||||||
| # mpich (AutotoolsPackage) | # mpich (AutotoolsPackage) | ||||||
|     - python: '3.7' |     - python: '3.8' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|       env: [ TEST_SUITE=build, 'SPEC=mpich' ] |       env: [ TEST_SUITE=build, 'SPEC=mpich' ] | ||||||
|     - python: '3.6' |     - python: '3.8' | ||||||
|       stage: 'docker build' |       stage: 'docker build' | ||||||
|       os: linux |       os: linux | ||||||
|       language: python |       language: python | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ Prerequisites | |||||||
| Spack has the following minimum requirements, which must be installed | Spack has the following minimum requirements, which must be installed | ||||||
| before Spack is run: | 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 | #. A C/C++ compiler for building | ||||||
| #. The ``make`` executable for building | #. The ``make`` executable for building | ||||||
| #. The ``git`` and ``curl`` commands for fetching | #. The ``git`` and ``curl`` commands for fetching | ||||||
|   | |||||||
| @@ -178,6 +178,12 @@ def add_pattern_exemptions(line, codes): | |||||||
|  |  | ||||||
| def filter_file(source, dest, output=False): | def filter_file(source, dest, output=False): | ||||||
|     """Filter a single file through all the patterns in pattern_exemptions.""" |     """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: |     with open(source) as infile: | ||||||
|         parent = os.path.dirname(dest) |         parent = os.path.dirname(dest) | ||||||
|         mkdirp(parent) |         mkdirp(parent) | ||||||
| @@ -197,6 +203,12 @@ def filter_file(source, dest, output=False): | |||||||
|                                 line_errors.append(code) |                                 line_errors.append(code) | ||||||
|                                 break |                                 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: |                 if line_errors: | ||||||
|                     line = add_pattern_exemptions(line, line_errors) |                     line = add_pattern_exemptions(line, line_errors) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ | |||||||
| from __future__ import division | from __future__ import division | ||||||
|  |  | ||||||
| import argparse | import argparse | ||||||
| import cgi |  | ||||||
| import fnmatch | import fnmatch | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
| @@ -23,6 +22,11 @@ | |||||||
| import spack.cmd.common.arguments as arguments | import spack.cmd.common.arguments as arguments | ||||||
| from spack.version import VersionList | 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" | description = "list and search available packages" | ||||||
| section = "basic" | section = "basic" | ||||||
| level = "short" | level = "short" | ||||||
| @@ -217,7 +221,7 @@ def head(n, span_id, title, anchor=None): | |||||||
|         out.write('<dd><ul class="first last simple">\n') |         out.write('<dd><ul class="first last simple">\n') | ||||||
|         out.write(('<li>' |         out.write(('<li>' | ||||||
|                    '<a class="reference external" href="%s">%s</a>' |                    '<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('</ul></dd>\n') | ||||||
|  |  | ||||||
|         out.write('<dt>Spack package:</dt>\n') |         out.write('<dt>Spack package:</dt>\n') | ||||||
| @@ -249,7 +253,7 @@ def head(n, span_id, title, anchor=None): | |||||||
|  |  | ||||||
|         out.write('<dt>Description:</dt>\n') |         out.write('<dt>Description:</dt>\n') | ||||||
|         out.write('<dd>\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('\n') | ||||||
|         out.write('</dd>\n') |         out.write('</dd>\n') | ||||||
|         out.write('</dl>\n') |         out.write('</dl>\n') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user