summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2013-12-25 15:40:32 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2013-12-25 15:40:32 -0800
commit0cd5866eead5676581b3164fdb328ae529b924c5 (patch)
tree5081eead7c14e27d43ddb5c8c129b0c2e0e03082
parent4ff8766a2210736adbf1cd8c709e4d75d0114fa1 (diff)
downloadspack-0cd5866eead5676581b3164fdb328ae529b924c5.tar.gz
spack-0cd5866eead5676581b3164fdb328ae529b924c5.tar.bz2
spack-0cd5866eead5676581b3164fdb328ae529b924c5.tar.xz
spack-0cd5866eead5676581b3164fdb328ae529b924c5.zip
Some fixes recommended by PyCharm
-rw-r--r--.gitignore1
-rw-r--r--lib/spack/spack/architecture.py2
-rw-r--r--lib/spack/spack/color.py2
-rw-r--r--lib/spack/spack/compilation.py8
-rw-r--r--lib/spack/spack/directory_layout.py5
-rw-r--r--lib/spack/spack/multimethod.py2
-rw-r--r--lib/spack/spack/packages/__init__.py2
-rw-r--r--lib/spack/spack/test/spec_dag.py3
-rw-r--r--lib/spack/spack/test/spec_semantics.py2
-rw-r--r--lib/spack/spack/test/spec_syntax.py2
-rw-r--r--lib/spack/spack/url.py2
-rw-r--r--lib/spack/spack/util/none_high.py8
-rw-r--r--lib/spack/spack/util/none_low.py8
-rw-r--r--lib/spack/spack/version.py6
14 files changed, 28 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 06cb4a2f04..0e239fa0bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
/var/
*~
.DS_Store
+.idea
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index c4914de1a0..a3e343e47a 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -58,7 +58,7 @@ def sys_type():
if sys_type: break
# Couldn't determine the sys_type for this machine.
- if sys_type == None:
+ if sys_type is None:
raise NoSysTypeError()
if not isinstance(sys_type, basestring):
diff --git a/lib/spack/spack/color.py b/lib/spack/spack/color.py
index b426c3eaa1..605b74b635 100644
--- a/lib/spack/spack/color.py
+++ b/lib/spack/spack/color.py
@@ -134,7 +134,7 @@ def cwrite(string, stream=sys.stdout, color=None):
then it will always write colored output. If not supplied,
then it will be set based on stream.isatty().
"""
- if color == None:
+ if color is None:
color = stream.isatty()
stream.write(colorize(string, color=color))
diff --git a/lib/spack/spack/compilation.py b/lib/spack/spack/compilation.py
index ecd3c63571..12503e2abd 100644
--- a/lib/spack/spack/compilation.py
+++ b/lib/spack/spack/compilation.py
@@ -4,7 +4,7 @@ import sys
def get_env_var(name, required=True):
value = os.environ.get(name)
- if required and value == None:
+ if required and value is None:
print "%s must be run from spack." % os.path.abspath(sys.argv[0])
sys.exit(1)
return value
@@ -49,7 +49,7 @@ def parse_rpaths(arguments):
yield arg
elif arg == '-Xlinker':
target = get_next(arg, args)
- if target != None:
+ if target is not None:
yield target
else:
other_args.append(arg)
@@ -65,14 +65,14 @@ def parse_rpaths(arguments):
for arg in largs:
if arg == '-rpath':
target = get_next(arg, largs)
- if target != None:
+ if target is not None:
rpaths.append(target)
elif arg.startswith('-R'):
target = arg.replace('-R', '', 1)
if not target:
target = get_next(arg, largs)
- if target == None: break
+ if target is None: break
if os.path.isdir(target):
rpaths.append(target)
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index 86dd22b58f..aed42f4a2c 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -151,11 +151,12 @@ class SpecHashDirectoryLayout(DirectoryLayout):
spec_hash = self.hash_spec(spec)
installed_hash = self.hash_spec(installed_spec)
if installed_spec == spec_hash:
- raise SpecHashCollisionError(installed_hash, spec_hash)
+ raise SpecHashCollisionError(
+ installed_hash, spec_hash, self.prefix_size)
else:
raise InconsistentInstallDirectoryError(
'Spec file in %s does not match SHA-1 hash!'
- % (installed_spec, spec_file_path))
+ % spec_file_path)
mkdirp(path)
self.write_spec(spec, spec_file_path)
diff --git a/lib/spack/spack/multimethod.py b/lib/spack/spack/multimethod.py
index 8a9bd3696f..dc948d2861 100644
--- a/lib/spack/spack/multimethod.py
+++ b/lib/spack/spack/multimethod.py
@@ -53,7 +53,7 @@ class SpecMultiMethod(object):
To register a method, you can do something like this:
mf = SpecMultiMethod()
- mf.regsiter("^chaos_5_x86_64_ib", some_method)
+ mf.register("^chaos_5_x86_64_ib", some_method)
The object registered needs to be a Spec or some string that
will parse to be a valid spec.
diff --git a/lib/spack/spack/packages/__init__.py b/lib/spack/spack/packages/__init__.py
index 0caf195308..a97d8b5546 100644
--- a/lib/spack/spack/packages/__init__.py
+++ b/lib/spack/spack/packages/__init__.py
@@ -221,7 +221,7 @@ def exists(pkg_name):
def packages_module():
# TODO: replace this with a proper package DB class, instead of this hackiness.
packages_path = re.sub(spack.module_path + '\/+', 'spack.', spack.packages_path)
- packages_module = re.sub(r'\/', '.', packages_path)
+ packages_module = re.sub(r'/', '.', packages_path)
return packages_module
diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py
index efce8d8659..632cf5b3d6 100644
--- a/lib/spack/spack/test/spec_dag.py
+++ b/lib/spack/spack/test/spec_dag.py
@@ -74,7 +74,8 @@ class SpecDagTest(MockPackagesTest):
try:
mpileaks.package.validate_dependencies()
except spack.package.InvalidPackageDependencyError, e:
- self.fail("validate_dependencies raised an exception: %s", e.message)
+ self.fail("validate_dependencies raised an exception: %s"
+ % e.message)
# Normalize then add conflicting constraints to the DAG (this is an
# extremely unlikely scenario, but we test for it anyway)
diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py
index 3c6351c074..d1cd5ca1c5 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -18,7 +18,7 @@ class SpecSematicsTest(MockPackagesTest):
l.constrain(r)
r.constrain(l)
except SpecError, e:
- self.fail("Got a SpecError in constrain!", e.message)
+ self.fail("Got a SpecError in constrain! " + e.message)
def check_unsatisfiable(self, lspec, rspec):
diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py
index 6e430873e2..4079650246 100644
--- a/lib/spack/spack/test/spec_syntax.py
+++ b/lib/spack/spack/test/spec_syntax.py
@@ -42,7 +42,7 @@ class SpecSyntaxTest(unittest.TestCase):
If this is called with two arguments, the first argument is the expected
canonical form and the second is a non-canonical input to be parsed.
"""
- if spec == None:
+ if spec is None:
spec = expected
output = spack.spec.parse(spec)
parsed = (" ".join(str(spec) for spec in output))
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index c70c1107a9..1de89de212 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -51,7 +51,7 @@ class UndetectableNameError(UrlParseError):
"""Raised when we can't parse a package name from a string."""
def __init__(self, path):
super(UndetectableNameError, self).__init__(
- "Couldn't parse package name in: " + path)
+ "Couldn't parse package name in: " + path, path)
def parse_version_string_with_indices(path):
diff --git a/lib/spack/spack/util/none_high.py b/lib/spack/spack/util/none_high.py
index 897cf9ff8d..d40a3d8aa9 100644
--- a/lib/spack/spack/util/none_high.py
+++ b/lib/spack/spack/util/none_high.py
@@ -10,7 +10,7 @@ _builtin_max = max
def lt(lhs, rhs):
"""Less-than comparison. None is greater than any value."""
- return lhs != rhs and (rhs == None or (lhs != None and lhs < rhs))
+ return lhs != rhs and (rhs is None or (lhs is not None and lhs < rhs))
def le(lhs, rhs):
@@ -30,9 +30,9 @@ def ge(lhs, rhs):
def min(lhs, rhs):
"""Minimum function where None is greater than any value."""
- if lhs == None:
+ if lhs is None:
return rhs
- elif rhs == None:
+ elif rhs is None:
return lhs
else:
return _builtin_min(lhs, rhs)
@@ -40,7 +40,7 @@ def min(lhs, rhs):
def max(lhs, rhs):
"""Maximum function where None is greater than any value."""
- if lhs == None or rhs == None:
+ if lhs is None or rhs is None:
return None
else:
return _builtin_max(lhs, rhs)
diff --git a/lib/spack/spack/util/none_low.py b/lib/spack/spack/util/none_low.py
index c332989248..e9bdb54a01 100644
--- a/lib/spack/spack/util/none_low.py
+++ b/lib/spack/spack/util/none_low.py
@@ -10,7 +10,7 @@ _builtin_max = max
def lt(lhs, rhs):
"""Less-than comparison. None is lower than any value."""
- return lhs != rhs and (lhs == None or (rhs != None and lhs < rhs))
+ return lhs != rhs and (lhs is None or (rhs is not None and lhs < rhs))
def le(lhs, rhs):
@@ -30,7 +30,7 @@ def ge(lhs, rhs):
def min(lhs, rhs):
"""Minimum function where None is less than any value."""
- if lhs == None or rhs == None:
+ if lhs is None or rhs is None:
return None
else:
return _builtin_min(lhs, rhs)
@@ -38,9 +38,9 @@ def min(lhs, rhs):
def max(lhs, rhs):
"""Maximum function where None is less than any value."""
- if lhs == None:
+ if lhs is None:
return rhs
- elif rhs == None:
+ elif rhs is None:
return lhs
else:
return _builtin_max(lhs, rhs)
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 66ec870021..9c25140543 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -299,9 +299,9 @@ class VersionRange(object):
@coerced
def overlaps(self, other):
return (other in self or self in other or
- ((self.start == None or other.end == None or
+ ((self.start == None or other.end is None or
self.start <= other.end) and
- (other.start == None or self.end == None or
+ (other.start is None or self.end == None or
other.start <= self.end)))
@@ -346,7 +346,7 @@ class VersionList(object):
"""Sorted, non-redundant list of Versions and VersionRanges."""
def __init__(self, vlist=None):
self.versions = []
- if vlist != None:
+ if vlist is not None:
if isinstance(vlist, basestring):
vlist = _string_to_version(vlist)
if type(vlist) == VersionList: