1{
2 lib,
3 ascii-magic,
4 buildPythonPackage,
5 fetchFromGitHub,
6 oauthlib,
7 pillow,
8 pytestCheckHook,
9 pythonOlder,
10 requests,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "weconnect";
16 version = "0.60.2";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "tillsteinbach";
23 repo = "WeConnect-python";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-VM4qCe+VMnfKXioUHTjOeBSniwpq44fvbN1k1jG6puk=";
26 };
27
28 postPatch = ''
29 substituteInPlace weconnect/__version.py \
30 --replace-fail "0.0.0dev" "${version}"
31 substituteInPlace setup.py \
32 --replace-fail "setup_requires=SETUP_REQUIRED" "setup_requires=[]" \
33 --replace-fail "tests_require=TEST_REQUIRED" "tests_require=[]"
34 substituteInPlace pytest.ini \
35 --replace-fail "--cov=weconnect --cov-config=.coveragerc --cov-report html" "" \
36 --replace-fail "required_plugins = pytest-cov" ""
37 '';
38
39 nativeBuildInputs = [ setuptools ];
40
41 propagatedBuildInputs = [
42 oauthlib
43 requests
44 ];
45
46 passthru.optional-dependencies = {
47 Images = [
48 ascii-magic
49 pillow
50 ];
51 };
52
53 nativeCheckInputs = [ pytestCheckHook ];
54
55 pythonImportsCheck = [ "weconnect" ];
56
57 meta = with lib; {
58 description = "Python client for the Volkswagen WeConnect Services";
59 homepage = "https://github.com/tillsteinbach/WeConnect-python";
60 changelog = "https://github.com/tillsteinbach/WeConnect-python/releases/tag/v${version}";
61 license = with licenses; [ mit ];
62 maintainers = with maintainers; [ fab ];
63 };
64}