|
40 | 40 | - name: Pyflakes lint |
41 | 41 | shell: bash |
42 | 42 | run: | |
43 | | - set +e |
44 | | - python -m pip install pyflakes |
45 | | - python -c 'import subprocess, sys; files = subprocess.check_output(["git", "ls-files", "*.py"]).decode().splitlines(); files = [f for f in files if not f.startswith("thirdparty/")]; p = subprocess.Popen([sys.executable, "-m", "pyflakes"] + files, stdout=subprocess.PIPE, stderr=subprocess.STDOUT); out, _ = p.communicate(); lines = [l for l in out.decode().splitlines() if " redefines " not in l]; sys.exit(1) if lines else None; print("pyflakes: clean")' |
| 43 | + python - <<'PY' |
| 44 | + from __future__ import print_function |
| 45 | +
|
| 46 | + import subprocess |
| 47 | + import sys |
| 48 | +
|
| 49 | + subprocess.check_call([ |
| 50 | + sys.executable, "-m", "pip", "install", "pyflakes" |
| 51 | + ]) |
| 52 | +
|
| 53 | + files = subprocess.check_output( |
| 54 | + ["git", "ls-files", "*.py"] |
| 55 | + ).decode("utf-8").splitlines() |
| 56 | +
|
| 57 | + files = [ |
| 58 | + f for f in files |
| 59 | + if not f.startswith("thirdparty/") |
| 60 | + ] |
| 61 | +
|
| 62 | + proc = subprocess.Popen( |
| 63 | + [sys.executable, "-m", "pyflakes"] + files, |
| 64 | + stdout=subprocess.PIPE, |
| 65 | + stderr=subprocess.STDOUT, |
| 66 | + ) |
| 67 | + out, _ = proc.communicate() |
| 68 | +
|
| 69 | + text = out.decode("utf-8", "replace") |
| 70 | + lines = [ |
| 71 | + line for line in text.splitlines() |
| 72 | + if " redefines " not in line |
| 73 | + ] |
| 74 | +
|
| 75 | + if lines: |
| 76 | + print("\n".join(lines)) |
| 77 | + sys.exit(1) |
| 78 | +
|
| 79 | + if proc.returncode not in (0, 1): |
| 80 | + if text: |
| 81 | + print(text) |
| 82 | + print("pyflakes failed unexpectedly with status %s" % proc.returncode) |
| 83 | + sys.exit(proc.returncode or 1) |
| 84 | +
|
| 85 | + print("pyflakes: clean") |
| 86 | + PY |
46 | 87 |
|
47 | 88 | - name: Basic import test |
48 | 89 | run: python -c "import sqlmap; import sqlmapapi" |
|
0 commit comments