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