git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #56312 from costrouc/python-unstable

Fixes several broken python packages for python-unstable

commit0dbfd0e7f998e6d2b57dc7b7f95fb9a13ea67be1 authorRobert Schütz <rschuetz17@gmail.com> dateMon 25 Feb 2019, 17:13 (8 years ago) parent8dccb068effff1
7 files changed+205−46
pkgs/development/python-modules/gidgethub/default.nix+10−6 pkgs/development/python-modules/howdoi/default.nix+15−3 pkgs/development/python-modules/monty/default.nix+22−14 pkgs/development/python-modules/pint/default.nix+9−3 pkgs/development/python-modules/pynacl/default.nix+22−7 pkgs/development/python-modules/shapely/default.nix+18−13 pkgs/development/python-modules/shapely/library-paths.patch+109
pkgs/development/python-modules/gidgethub/default.nix+10−6
@@ -1,4 +1,4 @@
1−{ stdenv
1+{ lib
22, buildPythonPackage
33, fetchPypi
44, pythonOlder
@@ -15,24 +15,28 @@
1515
1616buildPythonPackage rec {
1717 pname = "gidgethub";
18− version = "3.0.0";
19− format = "flit";
18+ version = "3.1.0";
2019
2120 disabled = pythonOlder "3.6";
2221
2322 src = fetchPypi {
2423 inherit pname version;
25− sha256 = "1ebe79cf80ad64cb78c880efc7f30ac664e18b80dfd18ee201bf8685cf029628";
24+ sha256 = "52119435ba73ddd5e697dae7bec8b93a048bc738720b81691ebd4b4d81d2d762";
2625 };
2726
28− buildInputs = [ setuptools pytestrunner ];
27+ nativeBuildInputs = [ setuptools pytestrunner ];
2928 checkInputs = [ pytest pytest-asyncio twisted treq tornado aiohttp ];
3029 propagatedBuildInputs = [ uritemplate ];
3130
31+ postPatch = ''
32+ substituteInPlace setup.py \
33+ --replace "extras_require=extras_require," "extras_require=None,"
34+ '';
35+
3236 # requires network (reqests github.com)
3337 doCheck = false;
3438
35− meta = with stdenv.lib; {
39+ meta = with lib; {
3640 description = "An async GitHub API library";
3741 homepage = https://github.com/brettcannon/gidgethub;
3842 license = licenses.asl20;
pkgs/development/python-modules/howdoi/default.nix+15−3
@@ -1,5 +1,12 @@
1−{ stdenv, buildPythonPackage, fetchPypi
2−, six, requests-cache, pygments, pyquery }:
1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, six
5+, requests-cache
6+, pygments
7+, pyquery
8+, python
9+}:
310
411buildPythonPackage rec {
512 pname = "howdoi";
@@ -12,9 +19,14 @@ buildPythonPackage rec {
1219
1320 propagatedBuildInputs = [ six requests-cache pygments pyquery ];
1421
15− meta = with stdenv.lib; {
22+ preCheck = ''
23+ export HOME=$(mktemp -d)
24+ '';
25+
26+ meta = with lib; {
1627 description = "Instant coding answers via the command line";
1728 homepage = https://pypi.python.org/pypi/howdoi;
1829 license = licenses.mit;
30+ maintainers = [ maintainers.costrouc ];
1931 };
2032}
pkgs/development/python-modules/monty/default.nix+22−14
@@ -1,33 +1,42 @@
1−{ stdenv, buildPythonPackage, fetchFromGitHub, nose, numpy, six, ruamel_yaml, msgpack-python, coverage, coveralls, pymongo, lsof }:
1+{ lib
2+, buildPythonPackage
3+, fetchFromGitHub
4+, nose
5+, numpy
6+, six
7+, ruamel_yaml
8+, msgpack-python
9+, coverage
10+, coveralls
11+, pymongo
12+, lsof
13+}:
214
315buildPythonPackage rec {
416 pname = "monty";
5− version = "1.0.2";
17+ version = "1.0.4";
618
719 # No tests in Pypi
820 src = fetchFromGitHub {
921 owner = "materialsvirtuallab";
1022 repo = pname;
1123 rev = "v${version}";
12− sha256 = "0ss70fanavqdpj56yymj06lacgnknb4ap39m2q28v9lz32cs6xdg";
24+ sha256 = "0vqaaz0dw0ypl6sfwbycpb0qs3ap04c4ghbggklxih66spdlggh6";
1325 };
1426
15− propagatedBuildInputs = [ nose numpy six ruamel_yaml msgpack-python coverage coveralls pymongo lsof ];
16−
27+ checkInputs = [ lsof nose numpy msgpack-python coverage coveralls pymongo];
28+ propagatedBuildInputs = [ six ruamel_yaml ];
29+
1730 preCheck = ''
1831 substituteInPlace tests/test_os.py \
19− --replace 'def test_which(self):' '#' \
20− --replace 'py = which("python")' '#' \
21− --replace 'self.assertEqual(os.path.basename(py), "python")' '#' \
22− --replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#' \
23− --replace 'self.assertIs(which("non_existent_exe"), None)' '#' \
32+ --replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#'
2433 '';
2534
26− meta = with stdenv.lib; {
35+ meta = with lib; {
2736 description = "Serves as a complement to the Python standard library by providing a suite of tools to solve many common problems";
2837 longDescription = "
29− Monty implements supplementary useful functions for Python that are not part of the
30− standard library. Examples include useful utilities like transparent support for zipped files, useful design
38+ Monty implements supplementary useful functions for Python that are not part of the
39+ standard library. Examples include useful utilities like transparent support for zipped files, useful design
3140 patterns such as singleton and cached_class, and many more.
3241 ";
3342 homepage = https://github.com/materialsvirtuallab/monty;
@@ -35,4 +44,3 @@ buildPythonPackage rec {
3544 maintainers = with maintainers; [ psyanticy ];
3645 };
3746}
38−
pkgs/development/python-modules/pint/default.nix+9−3
@@ -1,6 +1,8 @@
1−{ stdenv
1+{ lib
22, buildPythonPackage
33, fetchPypi
4+, isPy27
5+, funcsigs
46}:
57
68buildPythonPackage rec {
@@ -8,14 +10,18 @@ buildPythonPackage rec {
810 version = "0.9";
911
1012 src = fetchPypi {
11− inherit pname version;
13+ inherit version;
14+ pname = "Pint";
1215 sha256 = "32d8a9a9d63f4f81194c0014b3b742679dce81a26d45127d9810a68a561fe4e2";
1316 };
1417
15− meta = with stdenv.lib; {
18+ propagatedBuildInputs = lib.optional isPy27 funcsigs;
19+
20+ meta = with lib; {
1621 description = "Physical quantities module";
1722 license = licenses.bsd3;
1823 homepage = "https://github.com/hgrecco/pint/";
24+ maintainers = [ maintainers.costrouc ];
1925 };
2026
2127}
pkgs/development/python-modules/pynacl/default.nix+22−7
@@ -1,21 +1,36 @@
1−{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, libsodium, cffi, six, hypothesis}:
1+{ stdenv
2+, buildPythonPackage
3+, fetchPypi
4+, pytest
5+, libsodium
6+, cffi
7+, six
8+, hypothesis
9+}:
210
311buildPythonPackage rec {
412 pname = "pynacl";
513 version = "1.3.0";
614
7− src = fetchFromGitHub {
8− owner = "pyca";
9− repo = pname;
10− rev = version;
11− sha256 = "0ac00d5bfdmz1x428h2scq5b34llp61yhxradl94qjwz7ikqv052";
15+ src = fetchPypi {
16+ inherit version;
17+ pname = "PyNaCl";
18+ sha256 = "0c6100edd16fefd1557da078c7a31e7b7d7a52ce39fdca2bec29d4f7b6e7600c";
1219 };
1320
1421 checkInputs = [ pytest hypothesis ];
15− propagatedBuildInputs = [ libsodium cffi six ];
22+ buildInputs = [ libsodium ];
23+ propagatedBuildInputs = [ cffi six ];
1624
1725 SODIUM_INSTALL = "system";
1826
27+ # fixed in next release 1.3.0+
28+ # https://github.com/pyca/pynacl/pull/480
29+ postPatch = ''
30+ substituteInPlace tests/test_bindings.py \
31+ --replace "average_size=128," ""
32+ '';
33+
1934 checkPhase = ''
2035 py.test
2136 '';
pkgs/development/python-modules/shapely/default.nix+18−13
@@ -1,5 +1,5 @@
1−{ stdenv, buildPythonPackage, fetchPypi
2−, geos, glibcLocales, pytest, cython
1+{ stdenv, buildPythonPackage, fetchPypi, substituteAll
2+, geos, pytest, cython
33, numpy
44}:
55
@@ -12,26 +12,31 @@ buildPythonPackage rec {
1212 sha256 = "c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f";
1313 };
1414
15− buildInputs = [ geos glibcLocales cython ];
15+ nativeBuildInputs = [
16+ geos # for geos-config
17+ cython
18+ ];
1619
1720 checkInputs = [ pytest ];
1821
1922 propagatedBuildInputs = [ numpy ];
2023
21− preConfigure = ''
22− export LANG="en_US.UTF-8";
23− '';
24+ # environment variable used in shapely/_buildcfg.py
25+ GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";
2426
25− patchPhase = let
26− libc = if stdenv.isDarwin then "libc.dylib" else "libc.so.6";
27− in ''
28− sed -i "s|_lgeos = load_dll('geos_c', fallbacks=.*)|_lgeos = load_dll('geos_c', fallbacks=['${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}'])|" shapely/geos.py
29− sed -i "s|free = load_dll('c').free|free = load_dll('c', fallbacks=['${stdenv.cc.libc}/lib/${libc}']).free|" shapely/geos.py
30− '';
27+ patches = [
28+ (substituteAll {
29+ src = ./library-paths.patch;
30+ libgeos_c = GEOS_LIBRARY_PATH;
31+ libc = "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}"
32+ + stdenv.lib.optionalString (!stdenv.isDarwin) ".6";
33+ })
34+ ];
3135
3236 # Disable the tests that improperly try to use the built extensions
3337 checkPhase = ''
34− py.test -k 'not test_vectorized and not test_fallbacks' tests
38+ rm -r shapely # prevent import of local shapely
39+ py.test tests
3540 '';
3641
3742 meta = with stdenv.lib; {
pkgs/development/python-modules/shapely/library-paths.patchnew file+109
@@ -0,0 +1,109 @@
1+diff --git a/shapely/geos.py b/shapely/geos.py
2+index 09bf1ab..837aa98 100644
3+--- a/shapely/geos.py
4++++ b/shapely/geos.py
5+@@ -55,100 +55,10 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
6+ "Could not find lib {0} or load any of its variants {1}.".format(
7+ libname, fallbacks or []))
8+
9+-_lgeos = None
10+-
11+-if sys.platform.startswith('linux'):
12+- # Test to see if we have a wheel repaired by 'auditwheel' containing its
13+- # own libgeos_c
14+- geos_whl_so = glob.glob(os.path.abspath(os.path.join(os.path.dirname(
15+- __file__), '.libs/libgeos_c-*.so.*')))
16+- if len(geos_whl_so) == 1:
17+- _lgeos = CDLL(geos_whl_so[0])
18+- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
19+- else:
20+- alt_paths = [
21+- 'libgeos_c.so.1',
22+- 'libgeos_c.so',
23+- # anaconda
24+- os.path.join(sys.prefix, "lib", "libgeos_c.so"),
25+- ]
26+- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
27+- free = load_dll('c').free
28+- free.argtypes = [c_void_p]
29+- free.restype = None
30+-
31+-elif sys.platform == 'darwin':
32+- # Test to see if we have a delocated wheel with a GEOS dylib.
33+- geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
34+- __file__), '.dylibs/libgeos_c.1.dylib'))
35+- if os.path.exists(geos_whl_dylib):
36+- _lgeos = CDLL(geos_whl_dylib)
37+- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
38+-
39+- else:
40+- if hasattr(sys, 'frozen'):
41+- try:
42+- # .app file from py2app
43+- alt_paths = [os.path.join(
44+- os.environ['RESOURCEPATH'], '..', 'Frameworks',
45+- 'libgeos_c.dylib')]
46+- except KeyError:
47+- # binary from pyinstaller
48+- alt_paths = [
49+- os.path.join(sys.executable, 'libgeos_c.dylib')]
50+- if hasattr(sys, '_MEIPASS'):
51+- alt_paths.append(
52+- os.path.join(sys._MEIPASS, 'libgeos_c.1.dylib'))
53+- else:
54+- alt_paths = [
55+- # anaconda
56+- os.path.join(sys.prefix, "lib", "libgeos_c.dylib"),
57+- # The Framework build from Kyng Chaos
58+- "/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
59+- # macports
60+- '/opt/local/lib/libgeos_c.dylib',
61+- ]
62+- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
63+-
64+- free = load_dll('c').free
65+- free.argtypes = [c_void_p]
66+- free.restype = None
67+-
68+-elif sys.platform == 'win32':
69+- try:
70+- egg_dlls = os.path.abspath(
71+- os.path.join(os.path.dirname(__file__), 'DLLs'))
72+- if hasattr(sys, "frozen"):
73+- wininst_dlls = os.path.normpath(
74+- os.path.abspath(sys.executable + '../../DLLS'))
75+- else:
76+- wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
77+- original_path = os.environ['PATH']
78+- os.environ['PATH'] = "%s;%s;%s" % \
79+- (egg_dlls, wininst_dlls, original_path)
80+- _lgeos = load_dll("geos_c.dll", fallbacks=[
81+- os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
82+- ])
83+- except (ImportError, WindowsError, OSError):
84+- raise
85+-
86+- def free(m):
87+- try:
88+- cdll.msvcrt.free(m)
89+- except WindowsError:
90+- # XXX: See http://trac.gispython.org/projects/PCL/ticket/149
91+- pass
92+-
93+-elif sys.platform == 'sunos5':
94+- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
95+- free = CDLL('libc.so.1').free
96+- free.argtypes = [c_void_p]
97+- free.restype = None
98+-else: # other *nix systems
99+- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
100+- free = load_dll('c', fallbacks=['libc.so.6']).free
101+- free.argtypes = [c_void_p]
102+- free.restype = None
103++_lgeos = CDLL('@libgeos_c@')
104++free = CDLL('@libc@').free
105++free.argtypes = [c_void_p]
106++free.restype = None
107+
108+
109+ def _geos_version():