summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAxel Huebl <axel.huebl@plasma.ninja>2016-11-05 00:27:17 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2016-11-04 16:27:17 -0700
commitc3d9dda0e563c6254982a57434d51d9226b7bc56 (patch)
treea00eb0317bb6c686b0f2b89f16e2ce8cd2b8bb97 /lib
parent401b4cb13736ad4d1abbe769ba2652339003c70f (diff)
downloadspack-c3d9dda0e563c6254982a57434d51d9226b7bc56.tar.gz
spack-c3d9dda0e563c6254982a57434d51d9226b7bc56.tar.bz2
spack-c3d9dda0e563c6254982a57434d51d9226b7bc56.tar.xz
spack-c3d9dda0e563c6254982a57434d51d9226b7bc56.zip
libSplash: Add 1.6.0 Release (#2244)
* libSplash: Add 1.6.0 Release Add the latest release of libSplash, version 1.6.0. * Fix flake8 checks (another loop inversion issue)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/flake8.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/spack/spack/cmd/flake8.py b/lib/spack/spack/cmd/flake8.py
index 3893815855..a4c607a640 100644
--- a/lib/spack/spack/cmd/flake8.py
+++ b/lib/spack/spack/cmd/flake8.py
@@ -52,6 +52,9 @@ exemptions = {
# Exempt lines with urls and descriptions from overlong line errors.
501: [r'^\s*homepage\s*=',
r'^\s*url\s*=',
+ r'^\s*git\s*=',
+ r'^\s*svn\s*=',
+ r'^\s*hg\s*=',
r'^\s*version\(.*\)',
r'^\s*variant\(.*\)',
r'^\s*depends_on\(.*\)',
@@ -63,7 +66,7 @@ exemptions = {
# exemptions applied to all files.
r'.py$': {
# Exempt lines with URLs from overlong line errors.
- 501: [r'^(https?|file)\:']
+ 501: [r'(https?|file)\:']
},
}
@@ -74,26 +77,30 @@ exemptions = dict((re.compile(file_pattern),
for file_pattern, error_dict in exemptions.items())
-def filter_file(source, dest):
+def filter_file(source, dest, output=False):
"""Filter a single file through all the patterns in exemptions."""
with open(source) as infile:
parent = os.path.dirname(dest)
mkdirp(parent)
with open(dest, 'w') as outfile:
- for file_pattern, errors in exemptions.items():
- if not file_pattern.search(source):
- continue
+ for line in infile:
+ line = line.rstrip()
- for line in infile:
- line = line.rstrip()
+ for file_pattern, errors in exemptions.items():
+ if not file_pattern.search(source):
+ continue
for code, patterns in errors.items():
for pattern in patterns:
if pattern.search(line):
line += (" # NOQA: ignore=%d" % code)
break
- outfile.write(line + '\n')
+
+ oline = line + '\n'
+ outfile.write(oline)
+ if output:
+ sys.stdout.write(oline)
def setup_parser(subparser):
@@ -102,6 +109,9 @@ def setup_parser(subparser):
help="Do not delete temporary directory where flake8 runs. "
"Use for debugging, to see filtered files.")
subparser.add_argument(
+ '-o', '--output', action='store_true',
+ help="Send filtered files to stdout as well as temp files.")
+ subparser.add_argument(
'-r', '--root-relative', action='store_true', default=False,
help="print root-relative paths (default is cwd-relative)")
subparser.add_argument(
@@ -142,7 +152,7 @@ def flake8(parser, args):
for filename in file_list:
src_path = os.path.join(spack.prefix, filename)
dest_path = os.path.join(temp, filename)
- filter_file(src_path, dest_path)
+ filter_file(src_path, dest_path, args.output)
# run flake8 on the temporary tree.
with working_dir(temp):