Bug 1410938 - Make mach_commands.py flake8/pep8 compatible and add it the list of flake8 files r?gps
MozReview-Commit-ID: HKWsDehR0vZ
--- a/tools/lint/flake8.yml
+++ b/tools/lint/flake8.yml
@@ -23,16 +23,17 @@ flake8:
- testing/mozbase
- testing/mochitest
- testing/remotecppunittests.py
- testing/runcppunittests.py
- testing/talos/
- testing/xpcshell
- tools/git
- tools/lint
+ - tools/mach_commands.py
- tools/mercurial
- tools/tryselect
- toolkit/components/telemetry
# Excludes should be added to topsrcdir/.flake8 due to a bug in flake8 where
# specifying --exclude causes custom configuration files to be ignored.
exclude: []
# The configure option is used by the build system
extensions: ['configure', 'py']
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -213,19 +213,19 @@ class FormatProvider(MachCommandBase):
def locate_or_fetch(self, root, python_script=False):
# Download the clang-format binary & python clang-format-diff if doesn't
# exists
import urllib2
import hashlib
bin_sha = {
"Windows": "5b6a236425abde1a04ff09e74d8fd0fee1d49e5a35e228b24d77366cab03e1141b8073eec1b36c43e265a80bee707baaa7f96856b4820cbb02069775e58a3f9d", # noqa: E501
- "Linux": "64444efd9b6895447359a9f70d6781251e74d7881f993b5d81a19f8e6a8503f798d42506061fb9eb48729b7327c42a9d273c80dde18816a350fdbc020ebfa783", # noqa: E501
+ "Linux": "64444efd9b6895447359a9f70d6781251e74d7881f993b5d81a19f8e6a8503f798d42506061fb9eb48729b7327c42a9d273c80dde18816a350fdbc020ebfa783", # noqa: E501
"Darwin": "d9b08e21c233426628e39dd49bbb9b4e43cccb9aeb78d043dec2bdf6b1eacafddd13488558d38dfa0a0d39946b03b72c58933f1f79d638c045353cf3f4ae0fa4", # noqa: E501
- "python_script": "051b8c8932085616a775ef8b7b1384687db8f37660938f94e9389bf6dba6f6e244d2dc63d23e1d2bf8ab96c9bd5244faefc5218a1f90d5ec692698f0094a3238", # noqa: E501
+ "python_script": "051b8c8932085616a775ef8b7b1384687db8f37660938f94e9389bf6dba6f6e244d2dc63d23e1d2bf8ab96c9bd5244faefc5218a1f90d5ec692698f0094a3238", # noqa: E501
}
target = os.path.join(self._mach_context.state_dir, os.path.basename(root))
if not os.path.exists(target):
tooltool_url = "https://tooltool.mozilla-releng.net/sha512/"
if self.prompt and raw_input("Download clang-format executables from {0} (yN)? ".format(tooltool_url)).lower() != 'y': # noqa: E501,F821
print("Download aborted.")
@@ -318,17 +318,18 @@ class FormatProvider(MachCommandBase):
continue
if os.path.isdir(f):
# Processing a directory, generate the file list
for folder, subs, files in os.walk(f):
subs.sort()
for filename in sorted(files):
f_in_dir = os.path.join(folder, filename)
- if f_in_dir.endswith(extensions) and not re.match(ignored_dir_re, f_in_dir):
+ if (f_in_dir.endswith(extensions)
+ and not re.match(ignored_dir_re, f_in_dir)):
# Supported extension and accepted path
path_list.append(f_in_dir)
else:
if f.endswith(extensions):
path_list.append(f)
return path_list