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.8.1";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "bcc17f0b3a29670dd777d6f0755a4c04f28815395bca279cdcb213b97199a6b8";
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 # Permission Error
76 "test_bad_exe_py_info_no_raise"
77 ];
78
79 pythonImportsCheck = [ "virtualenv" ];
80
81 meta = with lib; {
82 description = "A tool to create isolated Python environments";
83 homepage = "http://www.virtualenv.org";
84 license = licenses.mit;
85 maintainers = with maintainers; [ goibhniu ];
86 };
87}