From 0905b34da67c145403f25fa09fb0fcc2b75c67e0 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 25 Jul 2024 09:01:18 +0100 Subject: [PATCH 1/2] python3Packages.craft-platforms: init at 0.1.1 --- .../craft-platforms/default.nix | 62 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 64 insertions(+) create mode 100644 pkgs/development/python-modules/craft-platforms/default.nix diff --git a/pkgs/development/python-modules/craft-platforms/default.nix b/pkgs/development/python-modules/craft-platforms/default.nix new file mode 100644 index 0000000000000..3cd303990859c --- /dev/null +++ b/pkgs/development/python-modules/craft-platforms/default.nix @@ -0,0 +1,62 @@ +{ + lib, + buildPythonPackage, + annotated-types, + distro, + fetchFromGitHub, + nix-update-script, + pytest-check, + pytestCheckHook, + pythonOlder, + setuptools, + setuptools-scm, +}: + +buildPythonPackage rec { + pname = "craft-platforms"; + version = "0.1.1"; + pyproject = true; + + disabled = pythonOlder "3.10"; + + src = fetchFromGitHub { + owner = "canonical"; + repo = "craft-platforms"; + rev = "refs/tags/${version}"; + hash = "sha256-KzskmSw7NsH1CAYjPf2281Ob71Jd6AhWxtp5tR3IqyU="; + }; + + postPatch = '' + substituteInPlace craft_platforms/__init__.py --replace-fail "dev" "${version}" + ''; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + annotated-types + distro + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-check + ]; + + pythonImportsCheck = [ "craft_platforms" ]; + + pytestFlagsArray = [ "tests/unit" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Manage platforms and architectures for charm applications"; + homepage = "https://github.com/canonical/craft-platforms"; + changelog = "https://github.com/canonical/craft-platforms/releases/tag/${version}"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ jnsgruk ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4f2d7ec087dfc..494ad0860323f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2567,6 +2567,8 @@ self: super: with self; { craft-parts = callPackage ../development/python-modules/craft-parts { }; + craft-platforms = callPackage ../development/python-modules/craft-platforms { }; + craft-providers = callPackage ../development/python-modules/craft-providers { }; craft-store = callPackage ../development/python-modules/craft-store { }; From 53dede428741013cfedae8c528e532e8082a3d0d Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 25 Jul 2024 09:01:36 +0100 Subject: [PATCH 2/2] charmcraft: 2.7.0 -> 3.1.1 --- pkgs/by-name/ch/charmcraft/package.nix | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/ch/charmcraft/package.nix b/pkgs/by-name/ch/charmcraft/package.nix index 78f48f85a7c48..fc5ef145d1bc1 100644 --- a/pkgs/by-name/ch/charmcraft/package.nix +++ b/pkgs/by-name/ch/charmcraft/package.nix @@ -30,7 +30,7 @@ let in python.pkgs.buildPythonApplication rec { pname = "charmcraft"; - version = "2.7.0"; + version = "3.1.1"; pyproject = true; @@ -38,24 +38,22 @@ python.pkgs.buildPythonApplication rec { owner = "canonical"; repo = "charmcraft"; rev = "refs/tags/${version}"; - hash = "sha256-yMcGXi7OxEtfOv3zLEUlnZrR90TkFc0y9RB9jS34ZWs="; + hash = "sha256-oxNbAIf7ltdDYkGJj29zvNDNXT6vt1jWaIqHJoMr7gU="; }; postPatch = '' - substituteInPlace setup.py \ - --replace-fail 'version=determine_version()' 'version="${version}"' - - # TODO remove setuptools from dependencies once this is removed - substituteInPlace charmcraft/env.py \ - --replace-fail "distutils.util" "setuptools.dist" + substituteInPlace charmcraft/__init__.py --replace-fail "dev" "${version}" ''; dependencies = with python.pkgs; [ + craft-application craft-cli craft-parts + craft-platforms craft-providers craft-store distro + docker humanize jinja2 jsonschema @@ -65,19 +63,22 @@ python.pkgs.buildPythonApplication rec { requests requests-toolbelt requests-unixsocket - setuptools # see substituteInPlace above snap-helpers tabulate urllib3 ]; - build-system = with python.pkgs; [ setuptools ]; + build-system = with python.pkgs; [ + setuptools + setuptools-scm + ]; pythonRelaxDeps = [ "urllib3" ]; nativeCheckInputs = with python.pkgs; [ + hypothesis pyfakefs pytest-check pytest-mock