Skip to content
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

python312Packages.python-mapnik: drop nose dependency #330432

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

Sigmanificient
Copy link
Member

@Sigmanificient Sigmanificient commented Jul 27, 2024

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not clear if this is running all the tests, cf. https://github.com/mapnik/python-mapnik/blob/248003c9da0de1ec7996cebd007c982f9875f2a3/test/run_tests.py#L10-L20. Upstream was apparently in the process of moving to pytest: mapnik/python-mapnik#264. It looks like there’s only this one file referencing nose now, but I don’t feel extremely confident here. It does look like a bunch of tests are still running, so maybe it’s just an irrelevant test runner?

@dotlambda You commented on the upstream issue; do you know what’s going on here?

Would be good to bump the version and migrate to pyproject = true;.

@Sigmanificient
Copy link
Member Author

Sigmanificient commented Jul 27, 2024

To me it seems that run_tests.py is a sort of wrapperscript for the devs, considering there is a shebang and usage

@emilazy
Copy link
Member

emilazy commented Jul 27, 2024

Yeah, it seems like it’s probably fine. I don’t know if the doctests are running or not but it’s not a big deal. Could you move to pyproject = true; and bump to the latest commit (since this is on an unstable Git version anyway)?

@Sigmanificient
Copy link
Member Author

sure, give me a couple minutes

@Sigmanificient
Copy link
Member Author

Updating to lateset commit seems to cause trouble with the patches:

source root is source
calling 'postUnpack' function hook '_ensureNewerSources'
calling 'postUnpack' function hook '_updateSourceDateEpochFromSourceRoot'
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/test/visual.py
Running phase: patchPhase
applying patch /nix/store/5hajf0pbx3grazw5b3s166xasfwbal9f-find-libmapnik.patch
patching file build.py
patching file setup.py
Hunk #1 FAILED at 118.
1 out of 1 hunk FAILED -- saving rejects to file setup.py.rej

@emilazy
Copy link
Member

emilazy commented Jul 27, 2024

The std::optional patch was already merged, so it can be deleted. find-mapnik.patch just needs updating for some upstream formatting changes.

@Sigmanificient
Copy link
Member Author

Using the following changes:

diff --git a/pkgs/development/python-modules/python-mapnik/default.nix b/pkgs/development/python-modules/python-mapnik/default.nix
index e74607e83a48..3f6987a4208e 100644
--- a/pkgs/development/python-modules/python-mapnik/default.nix
+++ b/pkgs/development/python-modules/python-mapnik/default.nix
@@ -5,6 +5,7 @@
   substituteAll,
   isPyPy,
   python,
+  setuptools,
   pillow,
   pycairo,
   pkg-config,
@@ -24,18 +25,19 @@
   pytestCheckHook,
   darwin,
   sparsehash,
+  pybind11
 }:
 
 buildPythonPackage rec {
   pname = "python-mapnik";
   version = "3.0.16-unstable-2024-02-22";
-  format = "setuptools";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "mapnik";
     repo = "python-mapnik";
-    rev = "5ab32f0209909cc98c26e1d86ce0c8ef29a9bf3d";
-    hash = "sha256-OqijA1WcyBcyWO8gntqp+xNIaV1Jqa0n1eMDip2OCvY=";
+    rev = "248003c9da0de1ec7996cebd007c982f9875f2a3";
+    hash = "sha256-CsEy0BoV3OuSTtJiv22+d0YueaNV/Llfvtx3hEqsFpI=";
     # Only needed for test data
     fetchSubmodules = true;
   };
@@ -47,19 +49,18 @@ buildPythonPackage rec {
       src = ./find-libmapnik.patch;
       libmapnik = "${mapnik}/lib";
     })
-    # Use `std::optional` rather than `boost::optional`
-    # https://github.com/mapnik/python-mapnik/commit/e9f88a95a03dc081826a69da67bbec3e4cccd5eb
-    ./python-mapnik_std_optional.patch
   ];
 
   stdenv = if python.stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else python.stdenv;
 
+  build-system = [ setuptools ];
+
   nativeBuildInputs = [
     mapnik # for mapnik_config
     pkg-config
   ];
 
-  buildInputs = [
+  dependencies = [
     mapnik
     boost
     cairo
@@ -74,6 +75,7 @@ buildPythonPackage rec {
     libxml2
     sqlite
     sparsehash
+    pybind11
   ];
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/python-mapnik/find-libmapnik.patch b/pkgs/development/python-modules/python-mapnik/find-libmapnik.patch
index cec557a2940a..ca8f7e94d972 100644
--- a/pkgs/development/python-modules/python-mapnik/find-libmapnik.patch
+++ b/pkgs/development/python-modules/python-mapnik/find-libmapnik.patch
@@ -14,17 +14,17 @@ index 0f94826b6..3cceb4546 100644
  if 'uninstall' not in COMMAND_LINE_TARGETS:
      pymapniklib = env.Install(target_path,_mapnik)
 diff --git a/setup.py b/setup.py
-index 9985da5a2..5a03a1ec8 100755
+index 9b73f0139..c9d14d98a 100755
 --- a/setup.py
 +++ b/setup.py
-@@ -118,8 +118,8 @@ linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
+@@ -18,8 +18,8 @@ linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
  linkflags.extend(check_output([mapnik_config, '--ldflags']).split(' '))
  linkflags.extend(check_output([mapnik_config, '--dep-libs']).split(' '))
  linkflags.extend([
--'-lmapnik-wkt',
--'-lmapnik-json',
-+'-lmapnikwkt',
-+'-lmapnikjson',
- ] + ['-l%s' % i for i in get_boost_library_names()])
+-    '-lmapnik-wkt',
+-    '-lmapnik-json',
++    '-lmapnikwkt',
++    '-lmapnikjson',
+ ])
  
  # Dynamically make the mapnik/paths.py file

I get the following compile error:

In file included from /nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapnik/datasource.hpp:28,
                 from src/mapnik_datasource.cpp:26:
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapnik/params.hpp: In instantiation of ‘mapnik::value_holder::value_holder(T&&) [with T = long long int]’:
src/mapnik_value_converter.hpp:183:42:   required from here
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapnik/params.hpp:58:49: error: no matching function for call to ‘mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>::variant(long long int)’
   58 |         : value_holder_base(std::forward<T>(obj))
      |                                                 ^
In file included from /nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapnik/util/variant.hpp:27,
                 from /nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapnik/params.hpp:29:
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:560:20: note: candidate: ‘template<class T, class Traits, class Enable> mapbox::util::variant<Types>::variant(T&&) [with Traits = T; Enable = Traits; Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]’
  560 |     VARIANT_INLINE variant(T&& val) noexcept(std::is_nothrow_constructible<typename Traits::target_type, T&&>::value)
      |                    ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:560:20: note:   template argument deduction/substitution failed:
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:559:15: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
  559 |               typename Enable = typename std::enable_if<Traits::is_valid && !std::is_same<variant<Types...>, typename Traits::value_type>::value>::type >
      |               ^~~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:572:20: note: candidate: ‘mapbox::util::variant<Types>::variant(mapbox::util::variant<Types>&&) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]’
  572 |     VARIANT_INLINE variant(variant<Types...>&& old)
      |                    ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:572:48: note:   no known conversion for argument 1 from ‘long long int’ to ‘mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>&&’
  572 |     VARIANT_INLINE variant(variant<Types...>&& old)
      |                            ~~~~~~~~~~~~~~~~~~~~^~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:566:20: note: candidate: ‘mapbox::util::variant<Types>::variant(const mapbox::util::variant<Types>&) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]’
  566 |     VARIANT_INLINE variant(variant<Types...> const& old)
      |                    ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:566:53: note:   no known conversion for argument 1 from ‘long long int’ to ‘const mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>&’
  566 |     VARIANT_INLINE variant(variant<Types...> const& old)
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:554:20: note: candidate: ‘mapbox::util::variant<Types>::variant(mapbox::util::no_init) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]’
  554 |     VARIANT_INLINE variant(no_init) noexcept
      |                    ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:554:28: note:   no known conversion for argument 1 from ‘long long int’ to ‘mapbox::util::no_init’
  554 |     VARIANT_INLINE variant(no_init) noexcept
      |                            ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:547:20: note: candidate: ‘mapbox::util::variant<Types>::variant() [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]’
  547 |     VARIANT_INLINE variant() noexcept(std::is_nothrow_default_constructible<first_type>::value)
      |                    ^~~~~~~
/nix/store/zcy9dhj0iqm068kgqsnz3lj9kvrx9l6c-mapnik-4.0.0/include/mapbox/variant.hpp:547:20: note:   candidate expects 0 arguments, 1 provided
error: command '/nix/store/kp2j7yn0wzwq5piy494r54dafrh83s6s-gcc-wrapper-13.3.0/bin/g++' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel

@emilazy
Copy link
Member

emilazy commented Jul 27, 2024

Okay, I guess there’s some incompatibility with Mapnik or something going on here; not worth the effort to figure out now. It’s okay to just migrate over to pyproject = true; and skip the bump. Thank you for trying, though!

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result of nixpkgs-review pr 330432 run on x86_64-linux 1

5 packages built:
  • nixpkgs-manual
  • python311Packages.python-mapnik
  • python311Packages.python-mapnik.dist
  • python312Packages.python-mapnik
  • python312Packages.python-mapnik.dist

@emilazy emilazy merged commit 5b87953 into NixOS:master Jul 28, 2024
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants