NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.68k stars 13.82k forks source link

rpl 1.10: ModuleNotFoundError: No module named 'chardet' #169473

Open rkoe opened 2 years ago

rkoe commented 2 years ago

Describe the bug

The rpl-package broke recently:

$ rpl
Traceback (most recent call last):
  File "/nix/store/6s8s9w0nmbmh8a40ima1w275z7zfchxs-rpl-1.10/bin/.rpl-wrapped", line 30, in <module>
    from chardet.universaldetector import UniversalDetector
ModuleNotFoundError: No module named 'chardet'

Steps To Reproduce

Steps to reproduce the behavior:

  1. $ nix-env -iA nixos.rpl
  2. $ rpl

Notify maintainers

@teto

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.106, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.336847.e387bb3a4d0"`
 - channels(user): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
teto commented 2 years ago

I can reproduce. adding chardet to propagatedBuildInput fixed it. I tried adding the manpage but couldn't test it yet. I am a bit busy this WE so feel free to submit a PR otherwise, I will submit monday

diff --git a/pkgs/tools/text/rpl/default.nix b/pkgs/tools/text/rpl/default.nix
index 1677e9c3f96..7788a8e395e 100644
--- a/pkgs/tools/text/rpl/default.nix
+++ b/pkgs/tools/text/rpl/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, python3Packages }:
+{ lib, fetchFromGitHub, installShellFiles, python3Packages, help2man }:

 python3Packages.buildPythonApplication rec {
   pname = "rpl";
@@ -19,14 +19,30 @@ python3Packages.buildPythonApplication rec {
     ./remove-argparse-manpage.diff # quickfix for ImportError: No module named build_manpages.build_manpages
   ];

-  buildInputs = [
+  postPatch = "patchShebangs ./rpl";
+  nativeBuildInputs = [
+    help2man installShellFiles
+  ];
+
+  propagatedBuildInputs = [
     #python3Packages.argparse-manpage # TODO
     python3Packages.chardet
   ];

-  installPhase = ''
-    mkdir -p $out/bin
-    mv rpl $out/bin
+  # postBuild = "make rpl.1";
+
+  # installPhase = ''
+  #   mkdir -p $out/bin
+  #   mv rpl $out/bin
+
+  # '';
+
+  postInstall = ''
+    echo "PWD: $PWD"
+    ls -l
+    python ./rpl --help
+    make rpl.1
+    installManPage rpl.1
   '';

   meta = with lib; {
ghuntley commented 1 year ago

I can reproduce as well.

teto commented 1 year ago

any of you wanting to take over maintainership ?