diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2019-08-11 22:00:36 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2019-08-11 13:00:36 -0700 |
commit | ab4b5deb97bca14c75cbf9aaa6b4bf03033191af (patch) | |
tree | 66ba79fa91f4ecedf5de9e76734a58aabc47d59b | |
parent | 172fcb0225a2bcccc1e4bc1f5841a4bfafe4b4a6 (diff) | |
download | spack-ab4b5deb97bca14c75cbf9aaa6b4bf03033191af.tar.gz spack-ab4b5deb97bca14c75cbf9aaa6b4bf03033191af.tar.bz2 spack-ab4b5deb97bca14c75cbf9aaa6b4bf03033191af.tar.xz spack-ab4b5deb97bca14c75cbf9aaa6b4bf03033191af.zip |
bugfix: Python 2.6 parsing error (#11867)
Apparently shlex.split can't deal with unicode encoded characters in
Python2.6. The solution is to convert to str before calling the
function.
-rw-r--r-- | lib/spack/spack/parse.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/release_jobs.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/test/spec_syntax.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/util/editor.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/util/executable.py | 2 |
5 files changed, 4 insertions, 12 deletions
diff --git a/lib/spack/spack/parse.py b/lib/spack/spack/parse.py index b5cf366dc0..836b40c3a6 100644 --- a/lib/spack/spack/parse.py +++ b/lib/spack/spack/parse.py @@ -143,7 +143,7 @@ class Parser(object): def setup(self, text): if isinstance(text, string_types): - text = shlex.split(text) + text = shlex.split(str(text)) self.text = text self.push_tokens(self.lexer.lex(text)) diff --git a/lib/spack/spack/test/cmd/release_jobs.py b/lib/spack/spack/test/cmd/release_jobs.py index 512650723c..7768b7d8c1 100644 --- a/lib/spack/spack/test/cmd/release_jobs.py +++ b/lib/spack/spack/test/cmd/release_jobs.py @@ -3,10 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import pytest - import json -import sys from jsonschema import validate @@ -39,11 +36,6 @@ def test_specs_deps(tmpdir, config): validate(deps_object, specs_deps_schema) -@pytest.mark.skipif( - sys.version_info[:2] < (2, 7), - reason="For some reason in Python2.6 we get a utf-32 string " - "that can't be parsed" -) def test_specs_staging(config): """Make sure we achieve the best possible staging for the following spec DAG:: diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index 9437cb31fa..699ecc987c 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -97,7 +97,7 @@ class TestSpecSyntax(object): def check_lex(self, tokens, spec): """Check that the provided spec parses to the provided token list.""" - spec = shlex.split(spec) + spec = shlex.split(str(spec)) lex_output = sp.SpecLexer().lex(spec) for tok, spec_tok in zip(tokens, lex_output): if tok.type == sp.ID or tok.type == sp.VAL: diff --git a/lib/spack/spack/util/editor.py b/lib/spack/spack/util/editor.py index 22db247c6a..ce5010d99f 100644 --- a/lib/spack/spack/util/editor.py +++ b/lib/spack/spack/util/editor.py @@ -41,7 +41,7 @@ def _find_exe_from_env_var(var): return None, [] # split env var into executable and args if needed - args = shlex.split(exe) + args = shlex.split(str(exe)) if not args: return None, [] diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index de18d24922..e383a533af 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -20,7 +20,7 @@ class Executable(object): """Class representing a program that can be run on the command line.""" def __init__(self, name): - self.exe = shlex.split(name) + self.exe = shlex.split(str(name)) self.default_env = {} self.returncode = None |