1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pytestCheckHook,
7 pythonOlder,
8 setuptools,
9}:
10
11buildPythonPackage rec {
12 pname = "strenum";
13 version = "0.4.15";
14 pyproject = true;
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchFromGitHub {
19 owner = "irgeek";
20 repo = "StrEnum";
21 tag = "v${version}";
22 hash = "sha256-LrDLIWiV/zIbl7CwKh7DAy4LoLyY7+hfUu8nqduclnA=";
23 };
24
25 patches = [
26 # Replace SafeConfigParser and readfp, https://github.com/milanmeu/aioaseko/pull/6
27 (fetchpatch {
28 name = "replace-safeconfigparser.patch";
29 url = "https://github.com/irgeek/StrEnum/commit/896bef1b7e4a50c8b53d90c8d2fb5c0164f08ecd.patch";
30 hash = "sha256-dmmEzhy17huclo1wOubpBUDc2L7vqEU5b/6a5loM47A=";
31 })
32 ];
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace '"pytest-runner"' ""
37 substituteInPlace pytest.ini \
38 --replace " --cov=strenum --cov-report term-missing --black --pylint" ""
39 '';
40
41 nativeBuildInputs = [ setuptools ];
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 pythonImportsCheck = [ "strenum" ];
46
47 meta = with lib; {
48 description = "Module for enum that inherits from str";
49 homepage = "https://github.com/irgeek/StrEnum";
50 changelog = "https://github.com/irgeek/StrEnum/releases/tag/v${version}";
51 license = with licenses; [ mit ];
52 maintainers = with maintainers; [ fab ];
53 };
54}