aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/funcsigs
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-10-05 12:43:18 +0000
committerKatharina Fey <kookie@spacekookie.de>2019-10-05 12:44:52 +0000
commitcf85056ba64caf3267d43255ef4a1243e9c8ee3b (patch)
tree3051519e9c8275b870aac43f80af875715c9d124 /nixpkgs/pkgs/development/python-modules/funcsigs
parent1148b1d122bc03e9a3665856c9b7bb96bd4e3994 (diff)
parent2436c27541b2f52deea3a4c1691216a02152e729 (diff)
Add 'nixpkgs/' from commit '2436c27541b2f52deea3a4c1691216a02152e729'
git-subtree-dir: nixpkgs git-subtree-mainline: 1148b1d122bc03e9a3665856c9b7bb96bd4e3994 git-subtree-split: 2436c27541b2f52deea3a4c1691216a02152e729
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/funcsigs')
-rw-r--r--nixpkgs/pkgs/development/python-modules/funcsigs/default.nix25
-rw-r--r--nixpkgs/pkgs/development/python-modules/funcsigs/fix-pypy3-tests.patch94
2 files changed, 119 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/funcsigs/default.nix b/nixpkgs/pkgs/development/python-modules/funcsigs/default.nix
new file mode 100644
index 00000000000..5a4701df9c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/funcsigs/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, buildPythonPackage, fetchPypi
+, isPyPy, isPy3k, unittest2
+}:
+
+buildPythonPackage rec {
+ pname = "funcsigs";
+ version = "1.0.2";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "0l4g5818ffyfmfs1a924811azhjj8ax9xd1cffr1mzd3ycn0zfx7";
+ };
+
+ buildInputs = [ unittest2 ];
+
+ # https://github.com/testing-cabal/funcsigs/issues/10
+ patches = stdenv.lib.optional (isPyPy && isPy3k) [ ./fix-pypy3-tests.patch ];
+
+ meta = with stdenv.lib; {
+ description = "Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+";
+ homepage = https://github.com/aliles/funcsigs;
+ maintainers = with maintainers; [ ];
+ license = licenses.asl20;
+ };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/funcsigs/fix-pypy3-tests.patch b/nixpkgs/pkgs/development/python-modules/funcsigs/fix-pypy3-tests.patch
new file mode 100644
index 00000000000..f4ecec3b613
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/funcsigs/fix-pypy3-tests.patch
@@ -0,0 +1,94 @@
+diff --git a/tests/test_inspect.py b/tests/test_inspect.py
+index 98d6592..3a2a1f2 100644
+--- a/tests/test_inspect.py
++++ b/tests/test_inspect.py
+@@ -8,6 +8,7 @@ import unittest2 as unittest
+
+ import funcsigs as inspect
+
++import platform
+
+ class TestSignatureObject(unittest.TestCase):
+ @staticmethod
+@@ -409,7 +410,7 @@ def test_signature_on_decorated(self):
+ Ellipsis))
+ """)
+
+- if sys.version_info[0] > 2:
++ if sys.version_info[0] > 2 and platform.python_implementation() != "PyPy":
+ exec("""
+ def test_signature_on_class(self):
+ class C:
+@@ -493,41 +494,44 @@ def test_signature_on_class(self):
+ Ellipsis))
+ """)
+
+- def test_signature_on_callable_objects(self):
+- class Foo(object):
+- def __call__(self, a):
+- pass
++ if platform.python_implementation() != "PyPy":
++ exec("""
++def test_signature_on_callable_objects(self):
++ class Foo(object):
++ def __call__(self, a):
++ pass
+
+- self.assertEqual(self.signature(Foo()),
+- ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+- Ellipsis))
++ self.assertEqual(self.signature(Foo()),
++ ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
++ Ellipsis))
+
+- class Spam(object):
+- pass
+- with self.assertRaisesRegex(TypeError, "is not a callable object"):
+- inspect.signature(Spam())
++ class Spam(object):
++ pass
++ with self.assertRaisesRegex(TypeError, "is not a callable object"):
++ inspect.signature(Spam())
+
+- class Bar(Spam, Foo):
+- pass
++ class Bar(Spam, Foo):
++ pass
+
+- self.assertEqual(self.signature(Bar()),
+- ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+- Ellipsis))
++ self.assertEqual(self.signature(Bar()),
++ ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
++ Ellipsis))
+
+- class ToFail(object):
+- __call__ = type
+- with self.assertRaisesRegex(ValueError, "not supported by signature"):
+- inspect.signature(ToFail())
++ class ToFail(object):
++ __call__ = type
++ with self.assertRaisesRegex(ValueError, "not supported by signature"):
++ inspect.signature(ToFail())
+
+- if sys.version_info[0] < 3:
+- return
++ if sys.version_info[0] < 3:
++ return
+
+- class Wrapped(object):
+- pass
+- Wrapped.__wrapped__ = lambda a: None
+- self.assertEqual(self.signature(Wrapped),
+- ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+- Ellipsis))
++ class Wrapped(object):
++ pass
++ Wrapped.__wrapped__ = lambda a: None
++ self.assertEqual(self.signature(Wrapped),
++ ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
++ Ellipsis))
++""")
+
+ def test_signature_on_lambdas(self):
+ self.assertEqual(self.signature((lambda a=10: a)),