about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOTABI Tomoya <tomoya.otabi@gmail.com>2023-11-12 12:45:23 +0900
committerGitHub <noreply@github.com>2023-11-12 12:45:23 +0900
commit18cb9535fa54422737c4e2517d86cf90214f60cf (patch)
tree5c92e559d03dc0db7e88b219f7059632447f8f72
parent67c0a676dd5e9998beb12d4f79ec44d676181802 (diff)
parent403a240615f2c98c768f4c43d93961d077700d19 (diff)
downloadnixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar.gz
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar.bz2
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar.lz
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar.xz
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.tar.zst
nixlib-18cb9535fa54422737c4e2517d86cf90214f60cf.zip
Merge pull request #266657 from mweinelt/bash-kernel-rename
python311Packages.bash-kernel: rename from bash_kernel
-rw-r--r--pkgs/development/python-modules/bash-kernel/bash-path.patch22
-rw-r--r--pkgs/development/python-modules/bash-kernel/default.nix (renamed from pkgs/development/python-modules/bash_kernel/default.nix)39
-rw-r--r--pkgs/top-level/python-aliases.nix1
-rw-r--r--pkgs/top-level/python-packages.nix2
4 files changed, 43 insertions, 21 deletions
diff --git a/pkgs/development/python-modules/bash-kernel/bash-path.patch b/pkgs/development/python-modules/bash-kernel/bash-path.patch
new file mode 100644
index 000000000000..98c3cc511ab7
--- /dev/null
+++ b/pkgs/development/python-modules/bash-kernel/bash-path.patch
@@ -0,0 +1,22 @@
+diff --git a/bash_kernel/kernel.py b/bash_kernel/kernel.py
+index 0496f1e..bd13c4f 100644
+--- a/bash_kernel/kernel.py
++++ b/bash_kernel/kernel.py
+@@ -88,7 +88,7 @@ class BashKernel(Kernel):
+     @property
+     def banner(self):
+         if self._banner is None:
+-            self._banner = check_output(['bash', '--version']).decode('utf-8')
++            self._banner = check_output(['@bash@', '--version']).decode('utf-8')
+         return self._banner
+ 
+     language_info = {'name': 'bash',
+@@ -116,7 +116,7 @@ class BashKernel(Kernel):
+             # source code there for comments and context for
+             # understanding the code here.
+             bashrc = os.path.join(os.path.dirname(pexpect.__file__), 'bashrc.sh')
+-            child = pexpect.spawn("bash", ['--rcfile', bashrc], echo=False,
++            child = pexpect.spawn("@bash@", ['--rcfile', bashrc], echo=False,
+                                   encoding='utf-8', codec_errors='replace')
+             # Following comment stolen from upstream's REPLWrap:
+             # If the user runs 'env', the value of PS1 will be in the output. To avoid
diff --git a/pkgs/development/python-modules/bash_kernel/default.nix b/pkgs/development/python-modules/bash-kernel/default.nix
index 5956d52de861..1c50b151f01e 100644
--- a/pkgs/development/python-modules/bash_kernel/default.nix
+++ b/pkgs/development/python-modules/bash-kernel/default.nix
@@ -4,42 +4,38 @@
 , fetchpatch
 , flit-core
 , ipykernel
-, isPy27
 , python
 , pexpect
 , bash
+, substituteAll
 }:
 
 buildPythonPackage rec {
-  pname = "bash_kernel";
+  pname = "bash-kernel";
   version = "0.9.1";
-  format = "flit";
-  disabled = isPy27;
+  pyproject = true;
 
   src = fetchPypi {
-    inherit pname version;
-    sha256 = "sha256-AYPVPjYP+baEcQUqmiiagWIXMlFrA04njpcgtdFaFis=";
+    pname = "bash_kernel";
+    inherit version;
+    hash = "sha256-AYPVPjYP+baEcQUqmiiagWIXMlFrA04njpcgtdFaFis=";
   };
 
   patches = [
-    (fetchpatch {
-      url = "https://patch-diff.githubusercontent.com/raw/takluyver/bash_kernel/pull/69.diff";
-      sha256 = "1qd7qjjmcph4dk6j0bl31h2fdmfiyyazvrc9xqqj8y21ki2sl33j";
+    (substituteAll {
+      src = ./bash-path.patch;
+      bash = lib.getExe bash;
     })
   ];
 
-  postPatch = ''
-    substituteInPlace bash_kernel/kernel.py \
-      --replace "'bash'" "'${bash}/bin/bash'" \
-      --replace "\"bash\"" "'${bash}/bin/bash'"
-  '';
-
-  nativeBuildInputs = [ flit-core ];
-
-  propagatedBuildInputs = [ ipykernel pexpect ];
+  nativeBuildInputs = [
+    flit-core
+  ];
 
-  # no tests
-  doCheck = false;
+  propagatedBuildInputs = [
+    ipykernel
+    pexpect
+  ];
 
   preBuild = ''
     export HOME=$TMPDIR
@@ -49,6 +45,9 @@ buildPythonPackage rec {
     ${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out
   '';
 
+  # no tests
+  doCheck = false;
+
   meta = with lib; {
     description = "Bash Kernel for Jupyter";
     homepage = "https://github.com/takluyver/bash_kernel";
diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix
index ea0ab64e2049..30a0d6472232 100644
--- a/pkgs/top-level/python-aliases.nix
+++ b/pkgs/top-level/python-aliases.nix
@@ -58,6 +58,7 @@ mapAliases ({
   backports_tempfile = throw "backports_tempfile has been removed, since we no longer need to backport to python3.3"; # added 2023-07-28
   backports_unittest-mock = throw "backports_unittest-mock has been removed, since we no longer need to backport to python3.2"; # added 2023-07-28
   backports_weakref = throw "backports_weakref has been removed, since we no longer need to backport to python3.3"; # added 2023-07-28
+  bash_kernel = bash-kernel; # added 2023-11-10
   beancount_docverif = beancount-docverif; # added 2023-10-08
   bedup = throw "bedup was removed because it was broken and abandoned upstream"; # added 2023-02-04
   bip_utils = bip-utils; # 2023-10-08
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 8837eaac5da0..41cf6b5344fc 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1321,7 +1321,7 @@ self: super: with self; {
 
   basemap-data = callPackage ../development/python-modules/basemap-data { };
 
-  bash_kernel = callPackage ../development/python-modules/bash_kernel { };
+  bash-kernel = callPackage ../development/python-modules/bash-kernel { };
 
   bashlex = callPackage ../development/python-modules/bashlex { };