dragnpkgs/pkgs/python/feedvalidator/default.nix

62 lines
1.3 KiB
Nix

{
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" ];
}