Unverified Commit 6b6c0dff authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #303369 from jnsgruk/charmcraft

charmcraft: init at 2.6.0
parents 2d3961e5 44f73650
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
{
  lib,
  git,
  python3Packages,
  fetchFromGitHub,
  nix-update-script,
}:

python3Packages.buildPythonApplication rec {
  pname = "charmcraft";
  version = "2.6.0";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "canonical";
    repo = "charmcraft";
    rev = "refs/tags/${version}";
    hash = "sha256-B0ZcOORW6yaSIpisPLnq5/S/CcqqvHNTXcfP1sKW2KQ=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail 'version=determine_version()' 'version="${version}"'
  '';

  propagatedBuildInputs = with python3Packages; [
    craft-cli
    craft-parts
    craft-providers
    craft-store
    distro
    humanize
    jinja2
    jsonschema
    pydantic_1
    python-dateutil
    pyyaml
    requests
    requests-toolbelt
    requests-unixsocket
    snap-helpers
    tabulate
    urllib3
  ];

  nativeBuildInputs = with python3Packages; [
    pythonRelaxDepsHook
    setuptools
  ];

  pythonRelaxDeps = [
    "urllib3"
  ];

  nativeCheckInputs = with python3Packages; [
    pyfakefs
    pytest-check
    pytest-mock
    pytest-subprocess
    pytestCheckHook
    responses
  ] ++ [ git ];

  preCheck = ''
    mkdir -p check-phase
    export HOME="$(pwd)/check-phase"
  '';

  pytestFlagsArray = [ "tests/unit" ];

  disabledTests = [
    # Relies upon the `charm` tool being installed
    "test_validate_missing_charm"
  ];

  passthru.updateScript = nix-update-script { };

  meta = {
    mainProgram = "charmcraft";
    description = "Build and publish Charmed Operators for deployment with Juju";
    homepage = "https://github.com/canonical/charmcraft";
    changelog = "https://github.com/canonical/charmcraft/releases/tag/${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ jnsgruk ];
    platforms = lib.platforms.linux;
  };
}
+5 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
, squashfsTools
, setuptools
, setuptools-scm
, stdenv
}:

buildPythonPackage rec {
@@ -103,6 +104,10 @@ buildPythonPackage rec {
    "tests/unit/packages/test_apt_cache.py"
    "tests/unit/packages/test_deb.py"
    "tests/unit/packages/test_chisel.py"
  ] ++ lib.optionals stdenv.isAarch64 [
    # These tests have hardcoded "amd64" strings which fail on aarch64
    "tests/unit/executor/test_environment.py"
    "tests/unit/features/overlay/test_executor_environment.py"
  ];

  passthru.updateScript = nix-update-script { };
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@

buildPythonPackage rec {
  pname = "craft-providers";
  version = "1.23.0";
  version = "1.23.1";

  pyproject = true;

@@ -29,7 +29,7 @@ buildPythonPackage rec {
    owner = "canonical";
    repo = "craft-providers";
    rev = "refs/tags/${version}";
    hash = "sha256-9ZoNgpuGytwozRsw0wnS3d2UBOIsh3VI/uzB1RD2Zac=";
    hash = "sha256-opVgOtbwZD+uQJ10Q8QlgQaS9KjRFnQ4h98Ak7Ze5qQ=";
  };

  patches = [
@@ -46,7 +46,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==67.8.0" "setuptools" \
      --replace-fail "setuptools==69.1.1" "setuptools" \
      --replace-fail "urllib3<2" "urllib3"
  '';

+76 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nix-update-script,
  setuptools,
  setuptools-scm,
  pytest-check,
  pytest-mock,
  pydantic_1,
  pyyaml,
  pytestCheckHook,
  keyring,
  macaroonbakery,
  overrides,
  pyxdg,
  requests,
  requests-toolbelt,
}:

buildPythonPackage rec {
  pname = "craft-store";
  version = "2.6.0";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "canonical";
    repo = "craft-store";
    rev = "refs/tags/${version}";
    hash = "sha256-VtKOe3IrvGcNWfp1/tg1cO94xtfkP7AbIHh0WTdlfbQ=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools==67.7.2" "setuptools"
  '';

  nativeBuildInputs = [
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    keyring
    macaroonbakery
    overrides
    pydantic_1
    pyxdg
    requests
    requests-toolbelt
  ];

  pythonImportsCheck = [ "craft_store" ];

  nativeCheckInputs = [
    pydantic_1
    pytest-check
    pytest-mock
    pytestCheckHook
    pyyaml
  ];

  pytestFlagsArray = [ "tests/unit" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Interfaces for communicating with Canonical Stores (e.g. Snap Store)";
    homepage = "https://github.com/canonical/craft-store";
    changelog = "https://github.com/canonical/craft-store/releases/tag/${version}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ jnsgruk ];
    platforms = lib.platforms.linux;
  };
}
+60 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nix-update-script,
  protobuf3,
  pymacaroons,
  pynacl,
  pyrfc3339,
  requests,
  setuptools,
  httmock,
  fixtures,
  pytestCheckHook,
  mock,
}:

buildPythonPackage rec {
  pname = "macaroonbakery";
  version = "1.3.4";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "go-macaroon-bakery";
    repo = "py-macaroon-bakery";
    rev = "refs/tags/${version}";
    hash = "sha256-NEhr8zkrHceeLbAyuUvc7U6dyQxkpkj0m5LlnBMafA0=";
  };

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    protobuf3
    pymacaroons
    pynacl
    pyrfc3339
    requests
  ];

  pythonImportsCheck = [ "macaroonbakery" ];

  nativeCheckInputs = [
    fixtures
    httmock
    mock
    pytestCheckHook
  ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "A Python library for working with macaroons";
    homepage = "https://github.com/go-macaroon-bakery/py-macaroon-bakery";
    changelog = "https://github.com/go-macaroon-bakery/py-macaroon-bakery/releases/tag/${version}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ jnsgruk ];
    platforms = lib.platforms.linux;
  };
}
Loading