Done with flake8
This commit is contained in:
parent
4664b4353c
commit
4f2ee8e021
18 changed files with 66 additions and 71 deletions
tools
|
@ -14,10 +14,6 @@ load("@rules_zapp//zapp:zapp.bzl",
|
|||
"zapp_binary",
|
||||
)
|
||||
|
||||
load("//tools/flake8:flake8.bzl",
|
||||
"flake8",
|
||||
)
|
||||
|
||||
def py_requirement(*args, **kwargs):
|
||||
"""A re-export of requirement()"""
|
||||
return _py_requirement(*args, **kwargs)
|
||||
|
@ -211,12 +207,6 @@ def py_project(name=None,
|
|||
],
|
||||
)
|
||||
|
||||
# if lib_srcs:
|
||||
# flake8(
|
||||
# name = "flake8",
|
||||
# deps = [lib_name],
|
||||
# )
|
||||
|
||||
if main:
|
||||
py_binary(
|
||||
name=name,
|
||||
|
|
|
@ -58,7 +58,7 @@ LICENSES_BY_LOWERNAME = {
|
|||
|
||||
# Mash in some cases.
|
||||
LICENSES_BY_LOWERNAME.update(
|
||||
{l.split(" :: ")[-1].lower(): l for l in APPROVED_LICENSES}
|
||||
{lic.split(" :: ")[-1].lower(): lic for lic in APPROVED_LICENSES}
|
||||
)
|
||||
|
||||
# As a workaround for packages which don"t have correct meadata on PyPi, hand-verified packages
|
||||
|
@ -108,7 +108,7 @@ def licenses(package: Requirement):
|
|||
this problem.
|
||||
|
||||
"""
|
||||
l = []
|
||||
lics = []
|
||||
version = next((v for op, v in package.specs if op == "=="), None)
|
||||
print(package.name, version)
|
||||
|
||||
|
@ -120,7 +120,7 @@ def licenses(package: Requirement):
|
|||
headers={"Accept": "application/json"}
|
||||
).json()
|
||||
if ln := bash_license(blob.get("license")):
|
||||
l.append(ln)
|
||||
lics.append(ln)
|
||||
else:
|
||||
try:
|
||||
version = list(blob.get("releases", {}).keys())[-1]
|
||||
|
@ -133,16 +133,16 @@ def licenses(package: Requirement):
|
|||
f"https://pypi.org/pypi/{package.name}/{version}/json",
|
||||
headers={"Accept": "application/json"}
|
||||
).json()
|
||||
l = [
|
||||
lics.extend([
|
||||
c
|
||||
for c in blob.get("info", {}).get("classifiers", [])
|
||||
if c.startswith("License")
|
||||
]
|
||||
])
|
||||
ln = blob.get("info", {}).get("license")
|
||||
if ln and not l:
|
||||
l.append(bash_license(ln))
|
||||
if ln and not lics:
|
||||
lics.append(bash_license(ln))
|
||||
|
||||
return l
|
||||
return lics
|
||||
|
||||
|
||||
@pytest.mark.parametrize("package", PACKAGES)
|
||||
|
@ -151,5 +151,5 @@ def test_approved_license(package):
|
|||
|
||||
_licenses = licenses(package)
|
||||
assert package.name in APPROVED_PACKAGES or any(
|
||||
l in APPROVED_LICENSES for l in _licenses
|
||||
lic in APPROVED_LICENSES for lic in _licenses
|
||||
), f"{package} was not approved and its license(s) were unknown {_licenses!r}"
|
||||
|
|
|
@ -105,7 +105,7 @@ def do_build(
|
|||
|
||||
status = sys.stdout
|
||||
warning = sys.stderr
|
||||
error = sys.stderr
|
||||
# error = sys.stderr
|
||||
|
||||
confdir = confdir or sourcedir
|
||||
confoverrides = {} # FIXME: support these
|
||||
|
@ -176,7 +176,7 @@ def do_serve(host, port, sourcedir, outputdir):
|
|||
elif (
|
||||
not path.startswith(outputdir)
|
||||
and path not in ignorelist
|
||||
and not path in watchlist
|
||||
and path not in watchlist
|
||||
):
|
||||
# Watch any source file (file we open for reading)
|
||||
server.watch(path, build)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue