add feedvalidator
This commit is contained in:
parent
f9d4b26906
commit
87c7af0e1c
4
TODO.md
4
TODO.md
|
@ -7,3 +7,7 @@ create NixOS VM test
|
|||
- test that ghidra-svrAdmin works as an unprivileged user in the `ghidra` group
|
||||
- possibly test remotely importing a binary. however, ghidra-svrAdmin working is a good indicator of
|
||||
the server being functional
|
||||
|
||||
## general
|
||||
|
||||
- meta info / license info for pkgs
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
ocamlPackages = prev.ocamlPackages.overrideScope (ofinal: oprev: {
|
||||
xlog = ofinal.callPackage ./pkgs/ocaml/xlog {};
|
||||
});
|
||||
|
||||
python312Packages = prev.python312Packages.overrideScope (pfinal: pprev: {
|
||||
feedvalidator = pfinal.callPackage ./pkgs/python/feedvalidator {};
|
||||
});
|
||||
|
||||
# add to top level because it has a binary
|
||||
feedvalidator = final.python312Packages.feedvalidator;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import argparse
|
||||
import sys
|
||||
|
||||
from . import compatibility, validateStream
|
||||
from .formatter.text_plain import Formatter
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="W3C feedvalidator")
|
||||
parser.add_argument("-b", "--base", type=str, required=False, default="",
|
||||
help="Base URL of document")
|
||||
parser.add_argument("file", type=argparse.FileType("rb"), help="File to validate")
|
||||
args = parser.parse_args()
|
||||
|
||||
events = validateStream(args.file, base=args.base)['loggedEvents']
|
||||
events = compatibility.AA(events)
|
||||
fmt = Formatter(events)
|
||||
if len(fmt) > 0:
|
||||
for f in fmt:
|
||||
print(f)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
stdenvNoCC,
|
||||
buildPythonPackage,
|
||||
|
||||
setuptools,
|
||||
wheel,
|
||||
|
||||
lxml,
|
||||
html5lib,
|
||||
rdflib
|
||||
}:
|
||||
|
||||
let feedvalidator_src = stdenvNoCC.mkDerivation {
|
||||
name = "feedvalidator-src";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "w3c";
|
||||
repo = "feedvalidator";
|
||||
rev = "1bbf6d9c68ef074b824c452fbc5d1f7817e6adae";
|
||||
sha256 = "sha256-sHc6cgjSNcd0BcYYeybGPayQNV8SK9GjUglWg9iOQko=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp -r src/feedvalidator/ "$out"
|
||||
cp "${./bin.py}" "$out/feedvalidator/bin.py"
|
||||
cp requirements.txt "$out"
|
||||
cat > "$out"/pyproject.toml <<EOF
|
||||
[build-system]
|
||||
requires = ["setuptools>=60", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
[project]
|
||||
name = "feedvalidator"
|
||||
version = "0.0.1+git"
|
||||
requires-python = ">=3.11"
|
||||
dynamic = ["dependencies"]
|
||||
[project.scripts]
|
||||
feedvalidator = "feedvalidator.bin:main"
|
||||
[tool.setuptools.dynamic]
|
||||
dependencies = {file = ["requirements.txt"]}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
in buildPythonPackage rec {
|
||||
pname = "feedvalidator";
|
||||
version = "git";
|
||||
pyproject = true;
|
||||
|
||||
src = feedvalidator_src;
|
||||
|
||||
nativeBuildInputs = [ setuptools wheel ];
|
||||
|
||||
# this should match requirements.txt
|
||||
propagatedBuildInputs = [ lxml html5lib rdflib ];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "feedvalidator" ];
|
||||
}
|
Loading…
Reference in New Issue