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.3";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "1187fb9c82fd670d10aa07bbb6cfcfe4bdda42d6fab8d5134f04e8c4d0b71cc9";
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}