Skip to content

Commit 403a240

Browse files
committed
python311Packages.bash-kernel: fix build
Substitute the bash path more carefully, as not all quoted bash strings are meant to be paths.
1 parent 8c87a8a commit 403a240

2 files changed

Lines changed: 38 additions & 18 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/bash_kernel/kernel.py b/bash_kernel/kernel.py
2+
index 0496f1e..bd13c4f 100644
3+
--- a/bash_kernel/kernel.py
4+
+++ b/bash_kernel/kernel.py
5+
@@ -88,7 +88,7 @@ class BashKernel(Kernel):
6+
@property
7+
def banner(self):
8+
if self._banner is None:
9+
- self._banner = check_output(['bash', '--version']).decode('utf-8')
10+
+ self._banner = check_output(['@bash@', '--version']).decode('utf-8')
11+
return self._banner
12+
13+
language_info = {'name': 'bash',
14+
@@ -116,7 +116,7 @@ class BashKernel(Kernel):
15+
# source code there for comments and context for
16+
# understanding the code here.
17+
bashrc = os.path.join(os.path.dirname(pexpect.__file__), 'bashrc.sh')
18+
- child = pexpect.spawn("bash", ['--rcfile', bashrc], echo=False,
19+
+ child = pexpect.spawn("@bash@", ['--rcfile', bashrc], echo=False,
20+
encoding='utf-8', codec_errors='replace')
21+
# Following comment stolen from upstream's REPLWrap:
22+
# If the user runs 'env', the value of PS1 will be in the output. To avoid

pkgs/development/python-modules/bash-kernel/default.nix

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,38 @@
44
, fetchpatch
55
, flit-core
66
, ipykernel
7-
, isPy27
87
, python
98
, pexpect
109
, bash
10+
, substituteAll
1111
}:
1212

1313
buildPythonPackage rec {
1414
pname = "bash-kernel";
1515
version = "0.9.1";
16-
format = "flit";
17-
disabled = isPy27;
16+
pyproject = true;
1817

1918
src = fetchPypi {
2019
pname = "bash_kernel";
2120
inherit version;
22-
sha256 = "sha256-AYPVPjYP+baEcQUqmiiagWIXMlFrA04njpcgtdFaFis=";
21+
hash = "sha256-AYPVPjYP+baEcQUqmiiagWIXMlFrA04njpcgtdFaFis=";
2322
};
2423

2524
patches = [
26-
(fetchpatch {
27-
url = "https://patch-diff.githubusercontent.com/raw/takluyver/bash_kernel/pull/69.diff";
28-
sha256 = "1qd7qjjmcph4dk6j0bl31h2fdmfiyyazvrc9xqqj8y21ki2sl33j";
25+
(substituteAll {
26+
src = ./bash-path.patch;
27+
bash = lib.getExe bash;
2928
})
3029
];
3130

32-
postPatch = ''
33-
substituteInPlace bash_kernel/kernel.py \
34-
--replace "'bash'" "'${bash}/bin/bash'" \
35-
--replace "\"bash\"" "'${bash}/bin/bash'"
36-
'';
37-
38-
nativeBuildInputs = [ flit-core ];
39-
40-
propagatedBuildInputs = [ ipykernel pexpect ];
31+
nativeBuildInputs = [
32+
flit-core
33+
];
4134

42-
# no tests
43-
doCheck = false;
35+
propagatedBuildInputs = [
36+
ipykernel
37+
pexpect
38+
];
4439

4540
preBuild = ''
4641
export HOME=$TMPDIR
@@ -50,6 +45,9 @@ buildPythonPackage rec {
5045
${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out
5146
'';
5247

48+
# no tests
49+
doCheck = false;
50+
5351
meta = with lib; {
5452
description = "Bash Kernel for Jupyter";
5553
homepage = "https://github.com/takluyver/bash_kernel";

0 commit comments

Comments
 (0)