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