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