1{ lib
2, buildPythonPackage
3, pythonOlder
4, isPy27
5, isPyPy
6, cython
7, distlib
8, fetchPypi
9, filelock
10, flaky
11, hatch-vcs
12, hatchling
13, importlib-metadata
14, importlib-resources
15, platformdirs
16, pytest-freezegun
17, pytest-mock
18, pytest-timeout
19, pytestCheckHook
20}:
21
22buildPythonPackage rec {
23 pname = "virtualenv";
24 version = "20.19.0";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.6";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-N6ZAuoLtQLImWZxSLUEeS+XtszmgwN4DDA3HtkbWFZA=";
32 };
33
34 nativeBuildInputs = [
35 hatch-vcs
36 hatchling
37 ];
38
39 propagatedBuildInputs = [
40 distlib
41 filelock
42 platformdirs
43 ] ++ lib.optionals (pythonOlder "3.7") [
44 importlib-resources
45 ] ++ lib.optionals (pythonOlder "3.8") [
46 importlib-metadata
47 ];
48
49 patches = lib.optionals (isPy27) [
50 ./0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch
51 ];
52
53 nativeCheckInputs = [
54 cython
55 flaky
56 pytest-freezegun
57 pytest-mock
58 pytest-timeout
59 pytestCheckHook
60 ];
61
62 preCheck = ''
63 export HOME=$(mktemp -d)
64 '';
65
66 disabledTestPaths = [
67 # Ignore tests which require network access
68 "tests/unit/create/test_creator.py"
69 "tests/unit/seed/embed/test_bootstrap_link_via_app_data.py"
70 ];
71
72 disabledTests = [
73 # Network access
74 "test_create_no_seed"
75 "test_seed_link_via_app_data"
76 # Permission Error
77 "test_bad_exe_py_info_no_raise"
78 ] ++ lib.optionals (isPyPy) [
79 # encoding problems
80 "test_bash"
81 # permission error
82 "test_can_build_c_extensions"
83 # fails to detect pypy version
84 "test_discover_ok"
85 ];
86
87 pythonImportsCheck = [
88 "virtualenv"
89 ];
90
91 meta = with lib; {
92 description = "A tool to create isolated Python environments";
93 homepage = "http://www.virtualenv.org";
94 changelog = "https://github.com/pypa/virtualenv/releases/tag/${version}";
95 license = licenses.mit;
96 maintainers = with maintainers; [ goibhniu ];
97 };
98}