python312Packages.jupyter-console: clean and fix on darwin (#350502)

This commit is contained in:
Peder Bergebakken Sundt 2024-10-23 00:33:22 +02:00 committed by GitHub
commit ad40aaf254
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,11 +1,13 @@
{
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
fetchFromGitHub,
# build-system
hatchling,
# dependencies
ipykernel,
exceptiongroup,
ipython,
jupyter-client,
jupyter-core,
@ -13,6 +15,8 @@
pygments,
pyzmq,
traitlets,
# tests
flaky,
pexpect,
pytestCheckHook,
@ -21,27 +25,29 @@
buildPythonPackage rec {
pname = "jupyter-console";
version = "6.6.3";
format = "pyproject";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
pname = "jupyter_console";
inherit version;
hash = "sha256-VmpL8xyHrb+t8izfhG4wabWace1dpx1rpNiqrRSlNTk=";
src = fetchFromGitHub {
owner = "jupyter";
repo = "jupyter_console";
rev = "refs/tags/v${version}";
hash = "sha256-jdSeZCspcjEQVBpJyxVnwJ5SAq+SS1bW9kqp/F/zwCQ=";
};
nativeBuildInputs = [ hatchling ];
postPatch = ''
# use wrapped executable in tests
postPatch =
# Use wrapped executable in tests
let
binPath = "${placeholder "out"}/bin/jupyter-console";
in
''
substituteInPlace jupyter_console/tests/test_console.py \
--replace "args = ['-m', 'jupyter_console', '--colors=NoColor']" "args = ['--colors=NoColor']" \
--replace "cmd = sys.executable" "cmd = '${placeholder "out"}/bin/jupyter-console'" \
--replace "check_output([sys.executable, '-m', 'jupyter_console'," "check_output(['${placeholder "out"}/bin/jupyter-console',"
--replace-fail "'-m', 'jupyter_console', " "" \
--replace-fail "sys.executable" "'${binPath}'"
'';
propagatedBuildInputs = [
build-system = [ hatchling ];
dependencies = [
ipykernel
ipython
jupyter-client
@ -50,7 +56,7 @@ buildPythonPackage rec {
pygments
pyzmq
traitlets
] ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];
];
pythonImportsCheck = [ "jupyter_console" ];
@ -64,6 +70,14 @@ buildPythonPackage rec {
export HOME=$TMPDIR
'';
disabledTests = [
# Flaky: pexpect.exceptions.TIMEOUT: Timeout exceeded
"test_console_starts"
"test_display_text"
];
__darwinAllowLocalNetworking = true;
meta = {
description = "Jupyter terminal console";
mainProgram = "jupyter-console";