1{ stdenv
2, lib
3, buildPythonPackage
4, pythonOlder
5, isPy27
6, backports-entry-points-selectable
7, cython
8, distlib
9, fetchPypi
10, filelock
11, flaky
12, importlib-metadata
13, importlib-resources
14, pathlib2
15, platformdirs
16, pytest-freezegun
17, pytest-mock
18, pytest-timeout
19, pytestCheckHook
20, setuptools-scm
21, six
22}:
23
24buildPythonPackage rec {
25 pname = "virtualenv";
26 version = "20.16.5";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "sha256-In6huZlP3F6jGXe6M4PvKW10cuqFvp1nMuQqkcBOgNo=";
31 };
32
33 nativeBuildInputs = [
34 setuptools-scm
35 ];
36
37 propagatedBuildInputs = [
38 backports-entry-points-selectable
39 distlib
40 filelock
41 platformdirs
42 six
43 ] ++ lib.optionals (pythonOlder "3.4" && !stdenv.hostPlatform.isWindows) [
44 pathlib2
45 ] ++ lib.optionals (pythonOlder "3.7") [
46 importlib-resources
47 ] ++ lib.optionals (pythonOlder "3.8") [
48 importlib-metadata
49 ];
50
51 patches = lib.optionals (isPy27) [
52 ./0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch
53 ];
54
55 checkInputs = [
56 cython
57 flaky
58 pytest-freezegun
59 pytest-mock
60 pytest-timeout
61 pytestCheckHook
62 ];
63
64 preCheck = ''
65 export HOME=$(mktemp -d)
66 '';
67
68 # Ignore tests which require network access
69 disabledTestPaths = [
70 "tests/unit/create/test_creator.py"
71 "tests/unit/seed/embed/test_bootstrap_link_via_app_data.py"
72 ];
73
74 disabledTests = [
75 # Network access
76 "test_create_no_seed"
77 "test_seed_link_via_app_data"
78 # Permission Error
79 "test_bad_exe_py_info_no_raise"
80 ] ++ lib.optionals isPy27 [
81 "test_python_via_env_var"
82 "test_python_multi_value_prefer_newline_via_env_var"
83 ];
84
85 pythonImportsCheck = [ "virtualenv" ];
86
87 meta = with lib; {
88 description = "A tool to create isolated Python environments";
89 homepage = "http://www.virtualenv.org";
90 license = licenses.mit;
91 maintainers = with maintainers; [ goibhniu ];
92 };
93}