~andir/nixpkgs-dev

pythonPackages.cxxfilt: init at 0.2.2 v1 PROPOSED

: 1
 pythonPackages.cxxfilt: init at 0.2.2

 2 files changed, 25 insertions(+), 0 deletions(-)
William Casarin <jb55@jb55.com> writes:
Next
"Cole Helbling" <cole.e.helbling@outlook.com> writes:
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~andir/nixpkgs-dev/patches/21959/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] pythonPackages.cxxfilt: init at 0.2.2 Export this patch

From: Leon Schuermann <leon@is.currently.online>

Adds the cxxfilt Python package for demangling C++ symbols in
Python (interfacing to abi::__cxa_demangle).

It appears to work with both Python 2 and Python 3, although I could
only test it using Python 3.

The package uses its own mechanism on top of ctypes for discovering a
C++ standard library. With Nix this does not seem to work though, and
hence the absolute path of the shared object is specified
instead. This should also make Nix pick up this library as a runtime
dependency of the package. A simple substituteInPlace of the
respective Python method invocation seems fine here, as using a proper
patch would've required a substitution for the path anyways.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
---
 .../python-modules/cxxfilt/default.nix        | 23 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            |  2 ++
 2 files changed, 25 insertions(+)
 create mode 100644 pkgs/development/python-modules/cxxfilt/default.nix

diff --git a/pkgs/development/python-modules/cxxfilt/default.nix b/pkgs/development/python-modules/cxxfilt/default.nix
new file mode 100644
index 00000000000..0f74532ab1f
--- /dev/null
+++ b/pkgs/development/python-modules/cxxfilt/default.nix
@@ -0,0 +1,23 @@
{ lib, buildPythonPackage, fetchPypi, libcxx }:

buildPythonPackage rec {
  pname = "cxxfilt";
  version = "0.2.2";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0az9d4ncr38fb43wv6rzq072f7gxxvcf4wb3p48mrj8ndpki0s7g";
  };

  postPatch = ''
    substituteInPlace ./cxxfilt/__init__.py \
      --replace "find_any_library('stdc++', 'c++')" "\"${libcxx}/lib/libc++.so.1\""
  '';

  meta = with lib; {
    description = "Demangling C++ symbols in Python / interface to abi::__cxa_demangle";
    homepage = "https://github.com/afq984/python-cxxfilt";
    maintainers = with maintainers; [ ];
    platforms = platforms.all;
  };
}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 486a1b2c21e..64b773eb217 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1650,6 +1650,8 @@ in {

  cx_oracle = callPackage ../development/python-modules/cx_oracle { };

  cxxfilt = callPackage ../development/python-modules/cxxfilt { };

  cycler = callPackage ../development/python-modules/cycler { };

  cymem = callPackage ../development/python-modules/cymem { };

base-commit: f4af2f267a4a2e47277078e498b69400b6859478
-- 
2.30.1
Reviewed-by: William Casarin <jb55@jb55.com>
Tested-by: William Casarin <jb55@jb55.com>
Reviewed-by: Matthias Beyer <mail@beyermatthias.de>
pr'd here: https://github.com/NixOS/nixpkgs/pull/119239