python3Packages.click: fix SystemExit(1) when using click.File's stdin support (#459528)

This commit is contained in:
dotlambda
2025-11-08 15:06:20 +00:00
committed by GitHub
9 changed files with 135 additions and 24 deletions
@@ -2,6 +2,7 @@
lib,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
importlib-metadata,
pytestCheckHook,
@@ -26,6 +27,15 @@ buildPythonPackage rec {
hash = "sha256-3FfLKwpfkiGfY2+H2fQoZwLBqfPlV46xw2Bc4YEsyps=";
};
patches = [
# https://github.com/pallets/click/pull/2940
(fetchpatch {
name = "fix-SystemExit-when-using-stdin.patch";
url = "https://github.com/pallets/click/commit/93c6966eb3a575c2b600434d1cc9f4b3aee505ac.patch";
hash = "sha256-DkVF0JnKbcsdAhgVjWJEDZZ8vr2sf6wba8P3SyRUy6o=";
})
];
build-system = [ flit-core ];
nativeCheckInputs = [ pytestCheckHook ];
@@ -18,6 +18,7 @@
hypothesis,
iso8601,
lzip,
moto,
msgpack,
postgresql,
postgresqlTestHook,
@@ -29,7 +30,9 @@
pytest-postgresql,
pytz,
requests-mock,
swh-model,
systemd,
tqdm,
types-deprecated,
types-psycopg2,
types-pytz,
@@ -41,7 +44,7 @@
buildPythonPackage rec {
pname = "swh-core";
version = "4.5.2";
version = "4.6.0";
pyproject = true;
src = fetchFromGitLab {
@@ -50,7 +53,7 @@ buildPythonPackage rec {
owner = "devel";
repo = "swh-core";
tag = "v${version}";
hash = "sha256-yNWij9GclQCysQe9Bukr4cHlZgSQqLAuX1KwGWzAK+0=";
hash = "sha256-dI+xfj0DnUbBdYIVycyJQg3B/jnH/eg/Ju8YX2k8Qkc=";
};
build-system = [
@@ -58,6 +61,11 @@ buildPythonPackage rec {
setuptools-scm
];
pythonRelaxDeps = [
# we patched click 8.2.1
"click"
];
dependencies = [
backports-entry-points-selectable
click
@@ -79,6 +87,7 @@ buildPythonPackage rec {
hypothesis
iso8601
lzip
moto
msgpack
postgresql
postgresqlTestHook
@@ -90,7 +99,9 @@ buildPythonPackage rec {
pytest-postgresql
pytz
requests-mock
swh-model
systemd
tqdm
types-deprecated
types-psycopg2
types-pytz
@@ -111,6 +122,7 @@ buildPythonPackage rec {
];
meta = {
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-core/-/tags/${src.tag}";
description = "Low-level utilities and helpers used by almost all other modules in the stack";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-core";
license = lib.licenses.gpl3Only;
@@ -18,7 +18,7 @@
tenacity,
swh-core,
swh-model,
swh-perfecthash,
swh-shard,
aiohttp,
azure-core,
azure-storage-blob,
@@ -40,7 +40,7 @@
buildPythonPackage rec {
pname = "swh-objstorage";
version = "4.0.0";
version = "5.1.0";
pyproject = true;
src = fetchFromGitLab {
@@ -49,7 +49,7 @@ buildPythonPackage rec {
owner = "devel";
repo = "swh-objstorage";
tag = "v${version}";
hash = "sha256-c0ZH2PMT9DVnpTV5PDyX0Yw4iHiJSolEgq/bMXEwXG8=";
hash = "sha256-NnNT9Lt/LGDIJpUmfkfPn6JnF3k8Usf2UVa88zHPKlg=";
};
build-system = [
@@ -71,7 +71,7 @@ buildPythonPackage rec {
tenacity
swh-core
swh-model
swh-perfecthash
swh-shard
];
preCheck = ''
@@ -110,6 +110,7 @@ buildPythonPackage rec {
];
meta = {
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-objstorage/-/tags/${src.tag}";
description = "Content-addressable object storage for the Software Heritage project";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-objstorage";
license = lib.licenses.gpl3Only;
@@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitLab,
fetchpatch,
setuptools,
setuptools-scm,
requests,
@@ -36,15 +35,6 @@ buildPythonPackage rec {
hash = "sha256-baUUuYFapBD7iuDaDP8CSR9f4glVZcS5qBpZddVf7z8=";
};
patches = [
# To be removed at the next release
# See https://gitlab.softwareheritage.org/swh/devel/swh-scanner/-/merge_requests/160
(fetchpatch {
url = "https://gitlab.softwareheritage.org/swh/devel/swh-scanner/-/commit/0eb273475826b0074844c7619b767c052562cfe4.patch";
hash = "sha256-i3hpaQJmHpIYgix+/npICQGtJ/IKVRXcCTm2O1VsR9M=";
})
];
build-system = [
setuptools
setuptools-scm
@@ -78,11 +68,14 @@ buildPythonPackage rec {
disabledTestPaths = [
# pytestRemoveBytecodePhase fails with: "error (ignored): error: opening directory "/tmp/nix-build-python3.12-swh-scanner-0.8.3.drv-5/build/pytest-of-nixbld/pytest-0/test_randomdir_policy_info_cal0/big-directory/dir/dir/dir/ ......"
"swh/scanner/tests/test_policy.py"
# TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr'
"swh/scanner/tests/test_cli.py"
];
meta = {
description = "Implementation of the Data model of the Software Heritage project, used to archive source code artifacts";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-model";
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-scanner/-/tags/${src.tag}";
description = "Source code scanner to analyze code bases and compare them with source code artifacts archived by Software Heritage";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-scanner";
license = lib.licenses.gpl3Only;
maintainers = [ ];
};
@@ -30,7 +30,7 @@
buildPythonPackage rec {
pname = "swh-scheduler";
version = "3.1.0";
version = "3.3.0";
pyproject = true;
src = fetchFromGitLab {
@@ -39,7 +39,7 @@ buildPythonPackage rec {
owner = "devel";
repo = "swh-scheduler";
tag = "v${version}";
hash = "sha256-YpMHeZVHK8IPIiuBaPNR0D/yB9lIQ3DK7NEAiBmjWpA=";
hash = "sha256-Kv5QH3sj/InKOSjxGtwVxtoAluHx5eIxO5GqcbOs0NY=";
};
build-system = [
@@ -47,6 +47,11 @@ buildPythonPackage rec {
setuptools-scm
];
pythonRelaxDeps = [
# we patched click 8.2.1
"click"
];
dependencies = [
celery
flask
@@ -80,6 +85,7 @@ buildPythonPackage rec {
disabledTests = [ "test_setup_log_handler_with_env_configuration" ];
meta = {
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-scheduler/-/tags/${src.tag}";
description = "Job scheduler for the Software Heritage project";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-scheduler";
license = lib.licenses.gpl3Only;
@@ -0,0 +1,72 @@
{
buildPythonPackage,
click,
cmake,
cmph,
fetchFromGitLab,
lib,
ninja,
pkg-config,
pybind11,
pytest-mock,
pytestCheckHook,
scikit-build-core,
setuptools-scm,
}:
buildPythonPackage rec {
pname = "swh-shard";
version = "2.2.0";
pyproject = true;
src = fetchFromGitLab {
domain = "gitlab.softwareheritage.org";
group = "swh";
owner = "devel";
repo = "swh-shard";
tag = "v${version}";
hash = "sha256-97oZ+Wa8GmyL2V4CnlSvaTbQZJ+mPbg6uVmWd0oxv1Q=";
};
build-system = [
cmake
ninja
pybind11
scikit-build-core
setuptools-scm
];
nativeBuildInputs = [
pkg-config
];
dontUseCmakeConfigure = true;
buildInputs = [
cmph
];
dependencies = [
click
];
pythonImportsCheck = [ "swh.shard" ];
nativeCheckInputs = [
pytest-mock
pytestCheckHook
];
preCheck = ''
# import from $out
rm src/swh/shard/*.py
'';
meta = {
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-shard/-/tags/v2.2.0";
description = "Shard File Format for the Software Heritage Object Storage";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-shard";
license = lib.licenses.gpl3Only;
maintainers = [ lib.maintainers.dotlambda ];
};
}
@@ -12,6 +12,8 @@
iso8601,
mypy-extensions,
psycopg,
psycopg-pool,
pyasyncore,
redis,
tenacity,
swh-core,
@@ -30,7 +32,7 @@
buildPythonPackage rec {
pname = "swh-storage";
version = "3.1.0";
version = "4.1.0";
pyproject = true;
src = fetchFromGitLab {
@@ -39,7 +41,7 @@ buildPythonPackage rec {
owner = "devel";
repo = "swh-storage";
tag = "v${version}";
hash = "sha256-Bxwc8OccmqadLjHtmhToHBYHGkD7Fw3Cl3go9VLV/Bs=";
hash = "sha256-JXeHE/wZ3Wcf1I1eGyCNlCGsreiQH6kCYZoDXV1h0A0=";
};
build-system = [
@@ -47,6 +49,11 @@ buildPythonPackage rec {
setuptools-scm
];
pythonRelaxDeps = [
# we patched click 8.2.1
"click"
];
dependencies = [
backports-entry-points-selectable
cassandra-driver
@@ -56,13 +63,14 @@ buildPythonPackage rec {
iso8601
mypy-extensions
psycopg
psycopg-pool
pyasyncore
redis
tenacity
swh-core
swh-model
swh-objstorage
]
++ psycopg.optional-dependencies.pool;
];
pythonImportsCheck = [ "swh.storage" ];
@@ -88,11 +96,13 @@ buildPythonPackage rec {
"swh/storage/tests/test_cassandra_migration.py"
"swh/storage/tests/test_cassandra_ttl.py"
"swh/storage/tests/test_cli_cassandra.py"
"swh/storage/tests/test_cli_object_references_cassandra.py"
# Failing tests
"swh/storage/tests/test_cli_object_references.py"
];
meta = {
changelog = "https://gitlab.softwareheritage.org/swh/devel/swh-storage/-/tags/${src.tag}";
description = "Abstraction layer over the archive, allowing to access all stored source code artifacts as well as their metadata";
homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-storage";
license = lib.licenses.gpl3Only;
@@ -37,6 +37,11 @@ buildPythonPackage rec {
setuptools-scm
];
pythonRelaxDeps = [
# we patched click 8.2.1
"click"
];
dependencies = [
click
dateutils
+2
View File
@@ -18096,6 +18096,8 @@ self: super: with self; {
swh-scheduler = callPackage ../development/python-modules/swh-scheduler { };
swh-shard = callPackage ../development/python-modules/swh-shard { };
swh-storage = callPackage ../development/python-modules/swh-storage { };
swh-web-client = callPackage ../development/python-modules/swh-web-client { };