pythonPackages.h3: init at 3.4.3
This commit is contained in:
parent
9d9bba120f
commit
ba3aeb1ca1
4 changed files with 97 additions and 0 deletions
35
pkgs/development/python-modules/h3/default.nix
Normal file
35
pkgs/development/python-modules/h3/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ stdenv
|
||||
, buildPythonPackage
|
||||
, cmake
|
||||
, fetchPypi
|
||||
, h3
|
||||
, python
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "h3";
|
||||
version = "3.4.3";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "07dlqpr1r4kzb3gci395plpss8gxvvrij40l6w0mylyg7fkab4m2";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./disable-custom-install.patch
|
||||
./hardcode-h3-path.patch
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
substituteInPlace h3/h3.py \
|
||||
--subst-var-by libh3_path ${h3}/lib/libh3${stdenv.hostPlatform.extensions.sharedLibrary}
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "https://github.com/uber/h3-py";
|
||||
description = "This library provides Python bindings for the H3 Core Library.";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.unix ++ platforms.darwin;
|
||||
maintainers = [ maintainers.kalbasit ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
diff --git a/setup.py b/setup.py
|
||||
index 8e1c220..45297b6 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -25,20 +25,6 @@ class CustomBuildExtCommand(build_ext):
|
||||
install_h3(h3_version)
|
||||
|
||||
|
||||
-# Tested with wheel v0.29.0
|
||||
-class BinaryDistribution(Distribution):
|
||||
- def __init__(self, attrs=None):
|
||||
- Distribution.__init__(self, attrs)
|
||||
- # The values used for the name and sources in the Extension below are
|
||||
- # not important, because we override the build_ext command above.
|
||||
- # The normal C extension building logic is never invoked, and is
|
||||
- # replaced with our own custom logic. However, ext_modules cannot be
|
||||
- # empty, because this signals to other parts of distutils that our
|
||||
- # package contains C extensions and thus needs to be built for
|
||||
- # different platforms separately.
|
||||
- self.ext_modules = [Extension('h3c', [])]
|
||||
-
|
||||
-
|
||||
long_description = open('README.rst').read()
|
||||
|
||||
setup(
|
||||
@@ -52,14 +38,10 @@ setup(
|
||||
url='https://github.com/uber/h3-py.git',
|
||||
packages=find_packages(exclude=['tests', 'tests.*']),
|
||||
install_requires=[],
|
||||
- cmdclass={
|
||||
- 'build_ext': CustomBuildExtCommand,
|
||||
- },
|
||||
package_data={
|
||||
'h-py':
|
||||
['out/*.dylib' if platform.system() == 'Darwin' else (
|
||||
'out/*.dll' if platform.system() == 'Windows' else
|
||||
'out/*.so.*')]
|
||||
},
|
||||
- license='Apache License 2.0',
|
||||
- distclass=BinaryDistribution)
|
||||
+ license='Apache License 2.0')
|
19
pkgs/development/python-modules/h3/hardcode-h3-path.patch
Normal file
19
pkgs/development/python-modules/h3/hardcode-h3-path.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
diff --git a/h3/h3.py b/h3/h3.py
|
||||
index 18cf168..2cc7812 100644
|
||||
--- a/h3/h3.py
|
||||
+++ b/h3/h3.py
|
||||
@@ -34,13 +34,7 @@ from ctypes import (
|
||||
POINTER,
|
||||
)
|
||||
|
||||
-_dirname = os.path.dirname(__file__)
|
||||
-libh3_path = ('{}/{}'.format(_dirname, 'out/libh3.1.dylib')
|
||||
- if platform.system() == 'Darwin' else (
|
||||
- '{}/{}'.format(_dirname, 'out/h3.dll') if platform.system() == 'Windows' else
|
||||
- '{}/{}'.format(_dirname, 'out/libh3.so.1')))
|
||||
-
|
||||
-libh3 = cdll.LoadLibrary(libh3_path)
|
||||
+libh3 = cdll.LoadLibrary('@libh3_path@')
|
||||
|
||||
# Type of an H3 index
|
||||
H3Index = c_ulonglong
|
|
@ -717,6 +717,8 @@ in {
|
|||
|
||||
gumath = callPackage ../development/python-modules/gumath { };
|
||||
|
||||
h3 = callPackage ../development/python-modules/h3 { inherit (pkgs) h3; };
|
||||
|
||||
h5py = callPackage ../development/python-modules/h5py {
|
||||
hdf5 = pkgs.hdf5;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue