New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: Add Rtree library #36760
python: Add Rtree library #36760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the general and Python-specific contributing guidelines.
cc50e62
to
7b6f5ac
Compare
Oh dear, yes, I clearly failed here. Sorry about that. Let's try this again. |
b4fcb56
to
f5b440f
Compare
Alright, I believe this should be ready for review. Thanks @FRidh! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your commit message should start with pythonPackages.rtree
propagatedBuildInputs = [ libspatialindex ]; | ||
patchPhase = '' | ||
substituteInPlace rtree/core.py --replace \ | ||
"find_library('spatialindex_c')" "'${libspatialindex}/lib/libspatialindex_c.so.4'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very future-proof because of the .4
suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please use ${stdenv.hostPlatform.extensions.sharedLibrary}
name = "${pname}-${version}"; | ||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dear, good catch.
inherit pname version; | ||
sha256 = null; | ||
}; | ||
doCheck = false; # appears to be broken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More detail please. Did you try fixing the failures?
buildPythonPackage rec { | ||
pname = "Rtree"; | ||
version = "0.8.3"; | ||
name = "${pname}-${version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave this line out.
pkgs/top-level/python-packages.nix
Outdated
@@ -21125,6 +21125,8 @@ EOF | |||
wsproto = callPackage ../development/python-modules/wsproto { }; | |||
|
|||
h11 = callPackage ../development/python-modules/h11 { }; | |||
|
|||
Rtree = callPackage ../development/python-modules/Rtree { inherit (pkgs) libspatialindex; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Rtree/rtree/g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? The library is actually called Rtree
and I see plenty of other packages whose names reflect their actual capitalization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer lowercase, but I think it's up to you.
However, plaese try to stick with the alphabetical ordering of python-packages.nix
.
I believe I have fixed all of the noted issues save the test failures. Unfortunately the failures appear to be due to memory unsafe issues that I was unable to reproduce on under Debian with the same versions of
Nevertheless, I was able to use |
35e4b20
to
f56999c
Compare
@GrahamcOfBorg build python2.pkgs.Rtree python3.pkgs.Rtree |
Success on x86_64-linux (full log) Attempted: python2.pkgs.Rtree, python3.pkgs.Rtree Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: python2.pkgs.Rtree, python3.pkgs.Rtree Partial log (click to expand)
|
This is a commonly-used package for spatial indexing. Strangely enough, the tests are broken due to memory unsafety that I was unable to reproduce under Debian. For instance, when run with Python 3.6 valgrind reports, ==10453== Invalid read of size 4 ==10453== at 0x4EF1DFA: _PyObject_Free (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4FE7D96: _PyFaulthandler_Fini (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F8438D: Py_FinalizeEx (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F9F398: Py_Main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x400BDF: main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/bin/python3.6) ==10453== Address 0x67b1020 is 352 bytes inside a block of size 640 free'd ==10453== at 0x4C2DD6B: free (in /nix/store/6z028lfnxyhh8dlngpm6zrkwqxmbglj4-valgrind-3.13.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10453== by 0x4EDDC4A: free_keys_object (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4EDEE63: dict_dealloc (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4EECF59: module_clear (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4FA062B: collect (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4FA13A0: _PyGC_CollectNoFail (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F79CED: PyImport_Cleanup (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F8436F: Py_FinalizeEx (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F9F398: Py_Main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x400BDF: main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/bin/python3.6) ==10453== ==10453== Conditional jump or move depends on uninitialised value(s) ==10453== at 0x4EF1E03: _PyObject_Free (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4EFEF2D: type_dealloc (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4EFD009: subtype_dealloc (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4FA063E: collect (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4FA13A0: _PyGC_CollectNoFail (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F79DF8: PyImport_Cleanup (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F8436F: Py_FinalizeEx (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x4F9F398: Py_Main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/lib/libpython3.6m.so.1.0) ==10453== by 0x400BDF: main (in /nix/store/azw9ys2m2fpfzf730xjcxja890gpyp58-python3-3.6.4/bin/python3.6) ==10453== ...
Motivation for this change
This library is used by another package which I am working on packaging.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)