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