1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, poetry-core
6, pytest-flakes
7, pytest-mock
8, pytest-socket
9, pytestCheckHook
10, six
11}:
12
13buildPythonPackage rec {
14 pname = "url-normalize";
15 version = "1.4.3";
16 format = "pyproject";
17
18 src = fetchFromGitHub {
19 owner = "niksite";
20 repo = pname;
21 rev = version;
22 hash = "sha256-WE3MM9B/voI23taFbLp2FYhl0uxOfuUWsaCTBG1hyiY=";
23 };
24
25 nativeBuildInputs = [
26 poetry-core
27 ];
28
29 propagatedBuildInputs = [
30 six
31 ];
32
33 checkInputs = [
34 pytest-flakes
35 pytest-mock
36 pytest-socket
37 pytestCheckHook
38 ];
39
40 patches = [
41 # Switch to poetry-core, https://github.com/niksite/url-normalize/pull/28
42 (fetchpatch {
43 name = "switch-to-poetry-core.patch";
44 url = "https://github.com/niksite/url-normalize/commit/b8557b10c977b191cc9d37e6337afe874a24ad08.patch";
45 sha256 = "sha256-SVCQATV9V6HbLmjOHs7V7eBagO0PuqZLubIJghBYfQQ=";
46 })
47 ];
48
49 postPatch = ''
50 sed -i "/--cov/d" tox.ini
51 sed -i "/--flakes/d" tox.ini
52 '';
53
54 pythonImportsCheck = [
55 "url_normalize"
56 ];
57
58 meta = with lib; {
59 description = "URL normalization for Python";
60 homepage = "https://github.com/niksite/url-normalize";
61 license = with licenses; [ mit ];
62 maintainers = with maintainers; [ fab ];
63 };
64}