diff --git a/pkgs/by-name/ch/charmcraft/package.nix b/pkgs/by-name/ch/charmcraft/package.nix index 526da18da7bf..8ffad09d7a11 100644 --- a/pkgs/by-name/ch/charmcraft/package.nix +++ b/pkgs/by-name/ch/charmcraft/package.nix @@ -8,7 +8,7 @@ python3Packages.buildPythonApplication rec { pname = "charmcraft"; - version = "3.2.2"; + version = "3.4.2"; pyproject = true; @@ -16,7 +16,7 @@ python3Packages.buildPythonApplication rec { owner = "canonical"; repo = "charmcraft"; tag = version; - hash = "sha256-2MI2cbAohfTgbilxZcFvmxt/iVjR6zJ2o0gequB//hg="; + hash = "sha256-6ucF0iQxQrFFz7jlaktYsB538W8jbX+Sw5hP0/VoYsk="; }; postPatch = '' @@ -35,6 +35,7 @@ python3Packages.buildPythonApplication rec { humanize jinja2 jsonschema + pip pydantic python-dateutil pyyaml @@ -51,11 +52,14 @@ python3Packages.buildPythonApplication rec { pythonRelaxDeps = [ "urllib3" "craft-application" + "pip" + "pydantic" ]; nativeCheckInputs = with python3Packages; [ + freezegun hypothesis pyfakefs pytest-check diff --git a/pkgs/by-name/ro/rockcraft/package.nix b/pkgs/by-name/ro/rockcraft/package.nix index 15857bf97414..41ac37d47707 100644 --- a/pkgs/by-name/ro/rockcraft/package.nix +++ b/pkgs/by-name/ro/rockcraft/package.nix @@ -11,13 +11,13 @@ python3Packages.buildPythonApplication rec { pname = "rockcraft"; - version = "1.7.0"; + version = "1.8.0"; src = fetchFromGitHub { owner = "canonical"; repo = "rockcraft"; rev = version; - hash = "sha256-2Bo3qtpSSfNvqszlt9cCc9/rurDNDMySAaqLbvRmjjw="; + hash = "sha256-v7biDGgJoQO6cKRXG8xosCgd/mlOUEwHrqcgtL2R5L4="; }; pyproject = true; diff --git a/pkgs/by-name/sn/snapcraft/os-platform.patch b/pkgs/by-name/sn/snapcraft/os-platform.patch deleted file mode 100644 index d3c914e73c7b..000000000000 --- a/pkgs/by-name/sn/snapcraft/os-platform.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/snapcraft/utils.py b/snapcraft/utils.py -index 999a64ec..4f38b4cd 100644 ---- a/snapcraft/utils.py -+++ b/snapcraft/utils.py -@@ -94,7 +94,7 @@ def get_os_platform( - release = platform.release() - machine = platform.machine() - -- if system == "Linux": -+ if system == "Linux" and "NixOS" not in platform.version(): - try: - with filepath.open("rt", encoding="utf-8") as release_file: - lines = release_file.readlines() diff --git a/pkgs/by-name/sn/snapcraft/package.nix b/pkgs/by-name/sn/snapcraft/package.nix index 02c86328e71b..dd7d02d44775 100644 --- a/pkgs/by-name/sn/snapcraft/package.nix +++ b/pkgs/by-name/sn/snapcraft/package.nix @@ -13,7 +13,7 @@ python3Packages.buildPythonApplication rec { pname = "snapcraft"; - version = "8.5.1"; + version = "8.6.1"; pyproject = true; @@ -21,7 +21,7 @@ python3Packages.buildPythonApplication rec { owner = "canonical"; repo = "snapcraft"; tag = version; - hash = "sha256-7kIVWbVj5qse3JIdlCvRtVUfSa/rSjn4e8HJdVY3sOA="; + hash = "sha256-SbxsgvDptkUl8gHAIrJvnzIPOh0/R81n8cgJWBH7BXQ="; }; patches = [ @@ -29,11 +29,6 @@ python3Packages.buildPythonApplication rec { # path for LXD must be adjusted so that it's at the correct location for LXD # on NixOS. This patch will likely never be accepted upstream. ./lxd-socket-path.patch - # In certain places, Snapcraft expects an /etc/os-release file to determine - # host info which doesn't exist in our test environment. This is a - # relatively naive patch which helps the test suite pass - without it *many* - # of the tests fail. This patch will likely never be accepted upstream. - ./os-platform.patch # Snapcraft will try to inject itself as a snap *from the host system* into # the build system. This patch short-circuits that logic and ensures that # Snapcraft is installed on the build system from the snap store - because @@ -118,6 +113,7 @@ python3Packages.buildPythonApplication rec { build-system = with python3Packages; [ setuptools ]; pythonRelaxDeps = [ + "craft-parts" "docutils" "jsonschema" "pygit2" diff --git a/pkgs/development/python-modules/craft-application/default.nix b/pkgs/development/python-modules/craft-application/default.nix index 762f45403da3..2501fe7738fd 100644 --- a/pkgs/development/python-modules/craft-application/default.nix +++ b/pkgs/development/python-modules/craft-application/default.nix @@ -30,21 +30,19 @@ buildPythonPackage rec { pname = "craft-application"; - version = "4.8.2"; + version = "4.9.0"; pyproject = true; - disabled = pythonOlder "3.10"; - src = fetchFromGitHub { owner = "canonical"; repo = "craft-application"; tag = version; - hash = "sha256-rKeEi9z5eQfjn0Q4FR6CVIz9YDS7Ejg4cqcor5wtz0s="; + hash = "sha256-DprItAuGjw8AACeJDrIa6KIWLSyImuWI0qeROpPohtM="; }; postPatch = '' substituteInPlace pyproject.toml \ - --replace-fail "setuptools==75.2.0" "setuptools" + --replace-fail "setuptools==75.8.0" "setuptools" ''; build-system = [ setuptools-scm ]; diff --git a/pkgs/development/python-modules/craft-cli/default.nix b/pkgs/development/python-modules/craft-cli/default.nix index a11a840cca98..1ab9e9145629 100644 --- a/pkgs/development/python-modules/craft-cli/default.nix +++ b/pkgs/development/python-modules/craft-cli/default.nix @@ -4,6 +4,8 @@ fetchFromGitHub, nix-update-script, platformdirs, + jinja2, + overrides, pyyaml, setuptools-scm, pytest-check, @@ -13,7 +15,7 @@ buildPythonPackage rec { pname = "craft-cli"; - version = "2.13.0"; + version = "2.15.0"; pyproject = true; @@ -21,7 +23,7 @@ buildPythonPackage rec { owner = "canonical"; repo = "craft-cli"; tag = version; - hash = "sha256-IqK+eU2z63yDMJrHAhETHWoTz5lWK1er9bwYH9Oml18="; + hash = "sha256-L8hOQJhjVAMo/WxEHHEk2QorlSdDFMGdcL/Q3Pv6mT4="; }; postPatch = '' @@ -32,6 +34,8 @@ buildPythonPackage rec { build-system = [ setuptools-scm ]; dependencies = [ + jinja2 + overrides platformdirs pyyaml ]; diff --git a/pkgs/development/python-modules/craft-parts/bash-path.patch b/pkgs/development/python-modules/craft-parts/bash-path.patch index 80e63d48003d..f684b3bf6920 100644 --- a/pkgs/development/python-modules/craft-parts/bash-path.patch +++ b/pkgs/development/python-modules/craft-parts/bash-path.patch @@ -1,19 +1,8 @@ diff --git a/craft_parts/executor/step_handler.py b/craft_parts/executor/step_handler.py -index 404df69..f90e2ac 100644 +index 5eab915..bc26252 100644 --- a/craft_parts/executor/step_handler.py +++ b/craft_parts/executor/step_handler.py -@@ -243,8 +243,9 @@ class StepHandler: - print(script, file=script_file) - script_file.flush() - script_file.seek(0) -+ import shutil - process = subprocess.Popen( # pylint: disable=consider-using-with -- ["/bin/bash"], -+ [shutil.which("bash")], - stdin=script_file, - cwd=work_dir, - stdout=self._stdout, -@@ -394,7 +395,8 @@ def _create_and_run_script( +@@ -445,7 +445,8 @@ def _create_and_run_script( ) -> None: """Create a script with step-specific commands and execute it.""" with script_path.open("w") as run_file: @@ -22,12 +11,28 @@ index 404df69..f90e2ac 100644 + print(f"#!{shutil.which('bash')}", file=run_file) print("set -euo pipefail", file=run_file) - if build_environment_script_path: + if environment_script_path: +diff --git a/craft_parts/plugins/java_plugin.py b/craft_parts/plugins/java_plugin.py +index f2b4064..cb4e9e8 100644 +--- a/craft_parts/plugins/java_plugin.py ++++ b/craft_parts/plugins/java_plugin.py +@@ -71,9 +71,8 @@ class JavaPlugin(Plugin): + return None, "" + + def _find_javac(self) -> list[str]: +- cmd = ["find", "/usr/lib/jvm", "-path", "*/bin/javac", "-print"] +- output = subprocess.check_output(cmd, text=True) +- return [x for x in output.split("\n") if len(x) > 0] ++ import shutil ++ return [shutil.which("javac")] + + @override + def get_build_environment(self) -> dict[str, str]: diff --git a/craft_parts/plugins/validator.py b/craft_parts/plugins/validator.py -index b8d8f11..fce0e72 100644 +index 5b4c735..8ff30c2 100644 --- a/craft_parts/plugins/validator.py +++ b/craft_parts/plugins/validator.py -@@ -142,9 +142,9 @@ class PluginEnvironmentValidator: +@@ -141,9 +141,9 @@ class PluginEnvironmentValidator: print(self._env, file=env_file) print(cmd, file=env_file) env_file.flush() @@ -39,3 +44,56 @@ index b8d8f11..fce0e72 100644 check=True, capture_output=True, text=True, +diff --git a/tests/unit/executor/test_step_handler.py b/tests/unit/executor/test_step_handler.py +index 4e73c2b..b762fb8 100644 +--- a/tests/unit/executor/test_step_handler.py ++++ b/tests/unit/executor/test_step_handler.py +@@ -209,9 +209,10 @@ class TestStepHandlerBuiltins: + + assert get_mode(build_script_path) == 0o755 + with open(build_script_path) as file: ++ import shutil + assert file.read() == dedent( + f"""\ +- #!/bin/bash ++ #!{shutil.which('bash')} + set -euo pipefail + source {environment_script_path} + set -x +diff --git a/tests/unit/utils/test_process.py b/tests/unit/utils/test_process.py +index 84b29ad..dc2d772 100644 +--- a/tests/unit/utils/test_process.py ++++ b/tests/unit/utils/test_process.py +@@ -33,7 +33,8 @@ _RUN_TEST_CASES = [ + + @pytest.mark.parametrize(("out", "err"), _RUN_TEST_CASES) + def test_run(out, err): +- result = process.run(["/usr/bin/sh", "-c", f"echo {out};sleep 0;echo {err} >&2"]) ++ import shutil ++ result = process.run([shutil.which("sh"), "-c", f"echo {out};sleep 0;echo {err} >&2"]) + assert result.returncode == 0 + assert result.stdout == (out + "\n").encode() + assert result.stderr == (err + "\n").encode() +@@ -42,8 +43,9 @@ def test_run(out, err): + + @pytest.mark.parametrize(("out", "err"), _RUN_TEST_CASES) + def test_run_devnull(out, err): ++ import shutil + result = process.run( +- ["/usr/bin/sh", "-c", f"echo {out};echo {err} >&2"], ++ [shutil.which("sh"), "-c", f"echo {out};echo {err} >&2"], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) +@@ -78,9 +80,10 @@ def test_run_selector(out, err, new_dir): + + selector.register(sock, selectors.EVENT_READ, accept) + ++ import shutil + result = process.run( + [ +- "/usr/bin/sh", ++ shutil.which("sh"), + "-c", + f"echo {out};sleep 0;echo {err} >&2; echo -n {out}|socat - UNIX-CONNECT:{new_dir}/test.socket", + ], diff --git a/pkgs/development/python-modules/craft-parts/default.nix b/pkgs/development/python-modules/craft-parts/default.nix index eb462fcb5a98..e7bbf01087cb 100644 --- a/pkgs/development/python-modules/craft-parts/default.nix +++ b/pkgs/development/python-modules/craft-parts/default.nix @@ -18,13 +18,17 @@ jsonschema, git, squashfsTools, + socat, setuptools-scm, stdenv, + ant, + maven, + jdk, }: buildPythonPackage rec { pname = "craft-parts"; - version = "2.2.2"; + version = "2.6.0"; pyproject = true; @@ -32,7 +36,7 @@ buildPythonPackage rec { owner = "canonical"; repo = "craft-parts"; tag = version; - hash = "sha256-6ufcay1C2Qv3nnG0augnPWzwBVDMj1ypRwzHRAhHARA="; + hash = "sha256-SybDzprUrKeL+Jl7Gm4XYLlvmy056D1OtJB7v/W2flY="; }; patches = [ ./bash-path.patch ]; @@ -57,14 +61,18 @@ buildPythonPackage rec { pythonImportsCheck = [ "craft_parts" ]; nativeCheckInputs = [ + ant git hypothesis + jdk jsonschema + maven pytest-check pytest-mock pytest-subprocess pytestCheckHook requests-mock + socat squashfsTools ]; @@ -80,6 +88,8 @@ buildPythonPackage rec { "test_run_prime" "test_get_build_packages_with_source_type" "test_get_build_packages" + # Relies upon certain paths being present that don't make sense on Nix. + "test_java_plugin_jre_not_17" ]; disabledTestPaths = diff --git a/pkgs/development/python-modules/craft-providers/default.nix b/pkgs/development/python-modules/craft-providers/default.nix index 4ba9ad1adf4b..bcdbcf148b43 100644 --- a/pkgs/development/python-modules/craft-providers/default.nix +++ b/pkgs/development/python-modules/craft-providers/default.nix @@ -15,12 +15,12 @@ responses, freezegun, pytest-subprocess, - pytest-logdog, + logassert, }: buildPythonPackage rec { pname = "craft-providers"; - version = "2.1.0"; + version = "2.1.1"; pyproject = true; @@ -28,7 +28,7 @@ buildPythonPackage rec { owner = "canonical"; repo = "craft-providers"; tag = version; - hash = "sha256-+j3uwvecffl8cK+yNidWbL243VnPkX72DMYv8RXMaXE="; + hash = "sha256-aW3efKy3c7ZGXS4wsvby0ww3Gwjt+1tMKsJCGprkcZo="; }; patches = [ @@ -50,7 +50,7 @@ buildPythonPackage rec { # The urllib3 incompat: https://github.com/msabramo/requests-unixsocket/pull/69 # This is already patched in nixpkgs. substituteInPlace pyproject.toml \ - --replace-fail "setuptools==73.0.1" "setuptools" + --replace-fail "setuptools==75.2.0" "setuptools" ''; pythonRelaxDeps = [ "requests" ]; @@ -69,10 +69,10 @@ buildPythonPackage rec { nativeCheckInputs = [ freezegun + logassert pytest-check pytest-mock pytest-subprocess - pytest-logdog pytestCheckHook responses ]; diff --git a/pkgs/development/python-modules/craft-store/default.nix b/pkgs/development/python-modules/craft-store/default.nix index 4c44e30fa514..14d258fdb4f8 100644 --- a/pkgs/development/python-modules/craft-store/default.nix +++ b/pkgs/development/python-modules/craft-store/default.nix @@ -25,7 +25,7 @@ buildPythonPackage rec { pname = "craft-store"; - version = "3.1.0"; + version = "3.2.1"; pyproject = true; @@ -33,12 +33,12 @@ buildPythonPackage rec { owner = "canonical"; repo = "craft-store"; tag = version; - hash = "sha256-pTG0JJRoHjmcLg+lAgg53rvC+7d3TLlTLe+Rxhy8wqg="; + hash = "sha256-rJ7FXHDrJ7w+dFPBs7MhT4iqN6KCWaqrmlCni5kUEKI="; }; postPatch = '' substituteInPlace pyproject.toml \ - --replace-fail "setuptools==75.6.0" "setuptools" + --replace-fail "setuptools==75.8.0" "setuptools" ''; build-system = [ diff --git a/pkgs/development/python-modules/logassert/default.nix b/pkgs/development/python-modules/logassert/default.nix new file mode 100644 index 000000000000..04640d926e9a --- /dev/null +++ b/pkgs/development/python-modules/logassert/default.nix @@ -0,0 +1,42 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, + flake8, + structlog, +}: + +buildPythonPackage rec { + pname = "logassert"; + version = "8.2"; + + pyproject = true; + + src = fetchFromGitHub { + owner = "facundobatista"; + repo = "logassert"; + tag = version; + hash = "sha256-wtSX1jAHanHCF58cSNluChWY3lrrsgludnnW+xVJuOo="; + }; + + build-system = [ setuptools ]; + + pythonImportsCheck = [ "logassert" ]; + + nativeCheckInputs = [ + flake8 + pytestCheckHook + structlog + ]; + + meta = { + description = "A simple Log Assertion mechanism for Python unittests"; + homepage = "https://github.com/facundobatista/logassert"; + changelog = "https://github.com/facundobatista/logassert/releases/tag/${version}"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ jnsgruk ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/development/python-modules/macaroonbakery/default.nix b/pkgs/development/python-modules/macaroonbakery/default.nix index f1598d432e1b..110bdc0ffd20 100644 --- a/pkgs/development/python-modules/macaroonbakery/default.nix +++ b/pkgs/development/python-modules/macaroonbakery/default.nix @@ -44,6 +44,8 @@ buildPythonPackage rec { requests ]; + pythonRelaxDeps = true; + pythonImportsCheck = [ "macaroonbakery" ]; nativeCheckInputs = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6c8a9c3e0318..a128bbcc871e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7748,6 +7748,8 @@ self: super: with self; { log-symbols = callPackage ../development/python-modules/log-symbols { }; + logassert = callPackage ../development/python-modules/logassert { }; + logbook = callPackage ../development/python-modules/logbook { }; logfury = callPackage ../development/python-modules/logfury { };