1{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, python }:
2
3let
4 testDir = if isPy3k then "src" else "python2";
5
6in buildPythonPackage rec {
7 pname = "typing";
8 version = "3.7.4.1";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "91dfe6f3f706ee8cc32d38edbbf304e9b7583fb37108fef38229617f8b3eba23";
13 };
14
15 # Error for Python3.6: ImportError: cannot import name 'ann_module'
16 # See https://github.com/python/typing/pull/280
17 # Also, don't bother on PyPy: AssertionError: TypeError not raised
18 doCheck = pythonOlder "3.6" && !isPyPy;
19
20 checkPhase = ''
21 cd ${testDir}
22 ${python.interpreter} -m unittest discover
23 '';
24
25 meta = with lib; {
26 description = "Backport of typing module to Python versions older than 3.5";
27 homepage = https://docs.python.org/3/library/typing.html;
28 license = licenses.psfl;
29 };
30}