python310Packages.ua-parser: run tests

This commit is contained in:
Robert Schütz 2022-06-02 01:32:55 +00:00 committed by Robert Schütz
parent ca7a28fa6e
commit a1a9aa11f6
2 changed files with 49 additions and 8 deletions

View file

@ -1,20 +1,44 @@
{ lib, buildPythonPackage, fetchPypi }:
{ lib
, buildPythonPackage
, fetchFromGitHub
, pyyaml
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "ua-parser";
version = "0.10.0";
src = fetchPypi {
inherit pname version;
sha256 = "0csh307zfz666kkk5idrw3crj1x8q8vsqgwqil0r1n1hs4p7ica7";
format = "setuptools";
src = fetchFromGitHub {
owner = "ua-parser";
repo = "uap-python";
rev = version;
fetchSubmodules = true;
hash = "sha256-kaTAfUtHj2vH7i7eIU61efuB4/XVHoc/z6o3ny+sgrQ=";
};
postPatch = ''
substituteInPlace setup.py \
--replace '"pyyaml"' ""
patches = [
./dont-fetch-submodule.patch
];
nativeBuildInputs = [
pyyaml
];
preBuild = ''
mkdir -p build/lib/ua_parser
'';
doCheck = false; # requires files from uap-core
checkInputs = [
pytestCheckHook
];
preCheck = ''
# import from $out
rm ua_parser/__init__.py
'';
pythonImportsCheck = [ "ua_parser" ];

View file

@ -0,0 +1,17 @@
diff --git a/setup.py b/setup.py
index a976eee..6919795 100644
--- a/setup.py
+++ b/setup.py
@@ -64,12 +64,6 @@ class build_regexes(Command):
def run(self):
work_path = self.work_path
- if not os.path.exists(os.path.join(work_path, ".git")):
- return
-
- log.info("initializing git submodules")
- check_output(["git", "submodule", "init"], cwd=work_path)
- check_output(["git", "submodule", "update"], cwd=work_path)
yaml_src = os.path.join(work_path, "uap-core", "regexes.yaml")
if not os.path.exists(yaml_src):