Merge pull request #56312 from costrouc/python-unstable

Fixes several broken python packages for python-unstable
This commit is contained in:
Robert Schütz 2019-02-25 17:13:11 +01:00 committed by GitHub
commit 0dbfd0e7f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 205 additions and 46 deletions

View File

@ -1,4 +1,4 @@
{ stdenv
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
@ -15,24 +15,28 @@
buildPythonPackage rec {
pname = "gidgethub";
version = "3.0.0";
format = "flit";
version = "3.1.0";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
sha256 = "1ebe79cf80ad64cb78c880efc7f30ac664e18b80dfd18ee201bf8685cf029628";
sha256 = "52119435ba73ddd5e697dae7bec8b93a048bc738720b81691ebd4b4d81d2d762";
};
buildInputs = [ setuptools pytestrunner ];
nativeBuildInputs = [ setuptools pytestrunner ];
checkInputs = [ pytest pytest-asyncio twisted treq tornado aiohttp ];
propagatedBuildInputs = [ uritemplate ];
postPatch = ''
substituteInPlace setup.py \
--replace "extras_require=extras_require," "extras_require=None,"
'';
# requires network (reqests github.com)
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "An async GitHub API library";
homepage = https://github.com/brettcannon/gidgethub;
license = licenses.asl20;

View File

@ -1,5 +1,12 @@
{ stdenv, buildPythonPackage, fetchPypi
, six, requests-cache, pygments, pyquery }:
{ lib
, buildPythonPackage
, fetchPypi
, six
, requests-cache
, pygments
, pyquery
, python
}:
buildPythonPackage rec {
pname = "howdoi";
@ -12,9 +19,14 @@ buildPythonPackage rec {
propagatedBuildInputs = [ six requests-cache pygments pyquery ];
meta = with stdenv.lib; {
preCheck = ''
export HOME=$(mktemp -d)
'';
meta = with lib; {
description = "Instant coding answers via the command line";
homepage = https://pypi.python.org/pypi/howdoi;
license = licenses.mit;
maintainers = [ maintainers.costrouc ];
};
}

View File

@ -1,29 +1,38 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, nose, numpy, six, ruamel_yaml, msgpack-python, coverage, coveralls, pymongo, lsof }:
{ lib
, buildPythonPackage
, fetchFromGitHub
, nose
, numpy
, six
, ruamel_yaml
, msgpack-python
, coverage
, coveralls
, pymongo
, lsof
}:
buildPythonPackage rec {
pname = "monty";
version = "1.0.2";
version = "1.0.4";
# No tests in Pypi
src = fetchFromGitHub {
owner = "materialsvirtuallab";
repo = pname;
rev = "v${version}";
sha256 = "0ss70fanavqdpj56yymj06lacgnknb4ap39m2q28v9lz32cs6xdg";
sha256 = "0vqaaz0dw0ypl6sfwbycpb0qs3ap04c4ghbggklxih66spdlggh6";
};
propagatedBuildInputs = [ nose numpy six ruamel_yaml msgpack-python coverage coveralls pymongo lsof ];
checkInputs = [ lsof nose numpy msgpack-python coverage coveralls pymongo];
propagatedBuildInputs = [ six ruamel_yaml ];
preCheck = ''
substituteInPlace tests/test_os.py \
--replace 'def test_which(self):' '#' \
--replace 'py = which("python")' '#' \
--replace 'self.assertEqual(os.path.basename(py), "python")' '#' \
--replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#' \
--replace 'self.assertIs(which("non_existent_exe"), None)' '#' \
--replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#'
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "Serves as a complement to the Python standard library by providing a suite of tools to solve many common problems";
longDescription = "
Monty implements supplementary useful functions for Python that are not part of the
@ -35,4 +44,3 @@ buildPythonPackage rec {
maintainers = with maintainers; [ psyanticy ];
};
}

View File

@ -1,6 +1,8 @@
{ stdenv
{ lib
, buildPythonPackage
, fetchPypi
, isPy27
, funcsigs
}:
buildPythonPackage rec {
@ -8,14 +10,18 @@ buildPythonPackage rec {
version = "0.9";
src = fetchPypi {
inherit pname version;
inherit version;
pname = "Pint";
sha256 = "32d8a9a9d63f4f81194c0014b3b742679dce81a26d45127d9810a68a561fe4e2";
};
meta = with stdenv.lib; {
propagatedBuildInputs = lib.optional isPy27 funcsigs;
meta = with lib; {
description = "Physical quantities module";
license = licenses.bsd3;
homepage = "https://github.com/hgrecco/pint/";
maintainers = [ maintainers.costrouc ];
};
}

View File

@ -1,21 +1,36 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, libsodium, cffi, six, hypothesis}:
{ stdenv
, buildPythonPackage
, fetchPypi
, pytest
, libsodium
, cffi
, six
, hypothesis
}:
buildPythonPackage rec {
pname = "pynacl";
version = "1.3.0";
src = fetchFromGitHub {
owner = "pyca";
repo = pname;
rev = version;
sha256 = "0ac00d5bfdmz1x428h2scq5b34llp61yhxradl94qjwz7ikqv052";
src = fetchPypi {
inherit version;
pname = "PyNaCl";
sha256 = "0c6100edd16fefd1557da078c7a31e7b7d7a52ce39fdca2bec29d4f7b6e7600c";
};
checkInputs = [ pytest hypothesis ];
propagatedBuildInputs = [ libsodium cffi six ];
buildInputs = [ libsodium ];
propagatedBuildInputs = [ cffi six ];
SODIUM_INSTALL = "system";
# fixed in next release 1.3.0+
# https://github.com/pyca/pynacl/pull/480
postPatch = ''
substituteInPlace tests/test_bindings.py \
--replace "average_size=128," ""
'';
checkPhase = ''
py.test
'';

View File

@ -1,5 +1,5 @@
{ stdenv, buildPythonPackage, fetchPypi
, geos, glibcLocales, pytest, cython
{ stdenv, buildPythonPackage, fetchPypi, substituteAll
, geos, pytest, cython
, numpy
}:
@ -12,26 +12,31 @@ buildPythonPackage rec {
sha256 = "c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f";
};
buildInputs = [ geos glibcLocales cython ];
nativeBuildInputs = [
geos # for geos-config
cython
];
checkInputs = [ pytest ];
propagatedBuildInputs = [ numpy ];
preConfigure = ''
export LANG="en_US.UTF-8";
'';
# environment variable used in shapely/_buildcfg.py
GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";
patchPhase = let
libc = if stdenv.isDarwin then "libc.dylib" else "libc.so.6";
in ''
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
sed -i "s|free = load_dll('c').free|free = load_dll('c', fallbacks=['${stdenv.cc.libc}/lib/${libc}']).free|" shapely/geos.py
'';
patches = [
(substituteAll {
src = ./library-paths.patch;
libgeos_c = GEOS_LIBRARY_PATH;
libc = "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}"
+ stdenv.lib.optionalString (!stdenv.isDarwin) ".6";
})
];
# Disable the tests that improperly try to use the built extensions
checkPhase = ''
py.test -k 'not test_vectorized and not test_fallbacks' tests
rm -r shapely # prevent import of local shapely
py.test tests
'';
meta = with stdenv.lib; {

View File

@ -0,0 +1,109 @@
diff --git a/shapely/geos.py b/shapely/geos.py
index 09bf1ab..837aa98 100644
--- a/shapely/geos.py
+++ b/shapely/geos.py
@@ -55,100 +55,10 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
"Could not find lib {0} or load any of its variants {1}.".format(
libname, fallbacks or []))
-_lgeos = None
-
-if sys.platform.startswith('linux'):
- # Test to see if we have a wheel repaired by 'auditwheel' containing its
- # own libgeos_c
- geos_whl_so = glob.glob(os.path.abspath(os.path.join(os.path.dirname(
- __file__), '.libs/libgeos_c-*.so.*')))
- if len(geos_whl_so) == 1:
- _lgeos = CDLL(geos_whl_so[0])
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
- else:
- alt_paths = [
- 'libgeos_c.so.1',
- 'libgeos_c.so',
- # anaconda
- os.path.join(sys.prefix, "lib", "libgeos_c.so"),
- ]
- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
- free = load_dll('c').free
- free.argtypes = [c_void_p]
- free.restype = None
-
-elif sys.platform == 'darwin':
- # Test to see if we have a delocated wheel with a GEOS dylib.
- geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
- __file__), '.dylibs/libgeos_c.1.dylib'))
- if os.path.exists(geos_whl_dylib):
- _lgeos = CDLL(geos_whl_dylib)
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
-
- else:
- if hasattr(sys, 'frozen'):
- try:
- # .app file from py2app
- alt_paths = [os.path.join(
- os.environ['RESOURCEPATH'], '..', 'Frameworks',
- 'libgeos_c.dylib')]
- except KeyError:
- # binary from pyinstaller
- alt_paths = [
- os.path.join(sys.executable, 'libgeos_c.dylib')]
- if hasattr(sys, '_MEIPASS'):
- alt_paths.append(
- os.path.join(sys._MEIPASS, 'libgeos_c.1.dylib'))
- else:
- alt_paths = [
- # anaconda
- os.path.join(sys.prefix, "lib", "libgeos_c.dylib"),
- # The Framework build from Kyng Chaos
- "/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
- # macports
- '/opt/local/lib/libgeos_c.dylib',
- ]
- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
-
- free = load_dll('c').free
- free.argtypes = [c_void_p]
- free.restype = None
-
-elif sys.platform == 'win32':
- try:
- egg_dlls = os.path.abspath(
- os.path.join(os.path.dirname(__file__), 'DLLs'))
- if hasattr(sys, "frozen"):
- wininst_dlls = os.path.normpath(
- os.path.abspath(sys.executable + '../../DLLS'))
- else:
- wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
- original_path = os.environ['PATH']
- os.environ['PATH'] = "%s;%s;%s" % \
- (egg_dlls, wininst_dlls, original_path)
- _lgeos = load_dll("geos_c.dll", fallbacks=[
- os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
- ])
- except (ImportError, WindowsError, OSError):
- raise
-
- def free(m):
- try:
- cdll.msvcrt.free(m)
- except WindowsError:
- # XXX: See http://trac.gispython.org/projects/PCL/ticket/149
- pass
-
-elif sys.platform == 'sunos5':
- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
- free = CDLL('libc.so.1').free
- free.argtypes = [c_void_p]
- free.restype = None
-else: # other *nix systems
- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
- free = load_dll('c', fallbacks=['libc.so.6']).free
- free.argtypes = [c_void_p]
- free.restype = None
+_lgeos = CDLL('@libgeos_c@')
+free = CDLL('@libc@').free
+free.argtypes = [c_void_p]
+free.restype = None
def _geos_version():