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