From e62f5bcf37b3e888754ffb72357769c1b7c67487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Neum=C3=BCller?= Date: Fri, 15 Nov 2019 17:13:20 +0100 Subject: [PATCH] Fix linting missing files. Excluding `build` for black isn't a great idea when travis is checking out under `/home/travis/build/open-telemetry`. --- pyproject.toml | 2 -- scripts/eachdist.py | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bcbe4f7511..cb0d3b8bbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,8 +11,6 @@ exclude = ''' | \.venv.* | venv.* | \.vscode - | _build - | build | dist | ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen # generated files )/ diff --git a/scripts/eachdist.py b/scripts/eachdist.py index 16a442348b..c13699b6bb 100755 --- a/scripts/eachdist.py +++ b/scripts/eachdist.py @@ -23,10 +23,7 @@ def subprocess_run(*args, **kwargs): if check: subprocess.check_call(*args, **kwargs) return CompletedProcess(returncode=0) - else: - return CompletedProcess( - returncode=subprocess.call(*args, **kwargs) - ) + return CompletedProcess(returncode=subprocess.call(*args, **kwargs)) def parse_args(args=None): @@ -135,9 +132,9 @@ def find_targets(mode, rootpath): def keyfunc(path): path = path.relative_to(rootpath) - for i, pattern in enumerate(sortfirst): + for idx, pattern in enumerate(sortfirst): if path.match(pattern): - return i + return idx return float("inf") targets.sort(key=keyfunc) @@ -172,6 +169,8 @@ def runsubprocess(dry_run, params, *args, **kwargs): if cwd and isinstance(cwd, PurePath): kwargs["cwd"] = str(cwd) + check = kwargs.pop("check") # Enforce specifying check + print(">>>", cmdstr, file=sys.stderr) # This is a workaround for subprocess.run(['python']) leaving the virtualenv on Win32. @@ -189,7 +188,7 @@ def runsubprocess(dry_run, params, *args, **kwargs): if executable: params[0] = executable try: - return subprocess_run(params, *args, **kwargs) + return subprocess_run(params, *args, check=check, **kwargs) except OSError as exc: raise ValueError( "Failed executing " + repr(params) + ": " + str(exc) @@ -322,7 +321,8 @@ def lint_args(args): runsubprocess(args.dry_run, ("flake8", rootdir), check=True) execute_args( parse_subargs( - args, ("exec", "pylint {}", "--all", "--mode", "lintroots",), + args, + ("exec", "pylint scripts/ {}", "--all", "--mode", "lintroots",), ) )