summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2016-05-14 17:39:59 -0700
committerTom Scogland <scogland1@llnl.gov>2016-05-14 17:39:59 -0700
commitdf30182a10ec98212a85cb2c2a8209b5d837b001 (patch)
tree87f5223bdd4674b77f49d24ea7cf5539637a7439
parent0668b6d7bab8e96834251d39d2bcda5ba016e34d (diff)
downloadspack-df30182a10ec98212a85cb2c2a8209b5d837b001.tar.gz
spack-df30182a10ec98212a85cb2c2a8209b5d837b001.tar.bz2
spack-df30182a10ec98212a85cb2c2a8209b5d837b001.tar.xz
spack-df30182a10ec98212a85cb2c2a8209b5d837b001.zip
appeasing flake8 in environment
-rw-r--r--lib/spack/spack/environment.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index ee5afb15dd..900036441a 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -64,7 +64,8 @@ class SetPath(NameValueModifier):
class AppendPath(NameValueModifier):
def execute(self):
environment_value = os.environ.get(self.name, '')
- directories = environment_value.split(self.separator) if environment_value else []
+ directories = environment_value.split(
+ self.separator) if environment_value else []
directories.append(os.path.normpath(self.value))
os.environ[self.name] = self.separator.join(directories)
@@ -72,7 +73,8 @@ class AppendPath(NameValueModifier):
class PrependPath(NameValueModifier):
def execute(self):
environment_value = os.environ.get(self.name, '')
- directories = environment_value.split(self.separator) if environment_value else []
+ directories = environment_value.split(
+ self.separator) if environment_value else []
directories = [os.path.normpath(self.value)] + directories
os.environ[self.name] = self.separator.join(directories)
@@ -80,9 +82,9 @@ class PrependPath(NameValueModifier):
class RemovePath(NameValueModifier):
def execute(self):
environment_value = os.environ.get(self.name, '')
- directories = environment_value.split(self.separator) if environment_value else []
- directories = [os.path.normpath(x)
- for x in directories
+ directories = environment_value.split(
+ self.separator) if environment_value else []
+ directories = [os.path.normpath(x) for x in directories
if x != os.path.normpath(self.value)]
os.environ[self.name] = self.separator.join(directories)
@@ -257,16 +259,13 @@ def set_or_unset_not_first(variable, changes, errstream):
Check if we are going to set or unset something after other modifications
have already been requested
"""
- indexes = [ii
- for ii, item in enumerate(changes)
+ indexes = [ii for ii, item in enumerate(changes)
if ii != 0 and type(item) in [SetEnv, UnsetEnv]]
if indexes:
good = '\t \t{context} at {filename}:{lineno}'
nogood = '\t--->\t{context} at {filename}:{lineno}'
message = 'Suspicious requests to set or unset the variable \'{var}\' found' # NOQA: ignore=E501
- errstream(
- message.format(
- var=variable))
+ errstream(message.format(var=variable))
for ii, item in enumerate(changes):
print_format = nogood if ii in indexes else good
errstream(print_format.format(**item.args))