nixpkgs/pkgs/by-name/ch/charmcraft/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
2.4 KiB
Nix
Raw Normal View History

2024-04-11 13:58:30 +00:00
{
lib,
git,
2024-07-24 14:53:10 +00:00
python3,
2024-04-11 13:58:30 +00:00
fetchFromGitHub,
nix-update-script,
}:
2024-07-24 14:53:10 +00:00
let
python = python3.override {
packageOverrides = self: super: {
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (old: rec {
version = "0.11.2";
src = fetchFromGitHub {
owner = "NowanIlfideme";
repo = "pydantic-yaml";
rev = "refs/tags/v${version}";
hash = "sha256-AeUyVav0/k4Fz69Qizn4hcJKoi/CDR9eUan/nJhWsDY=";
};
dependencies = with self; [
deprecated
importlib-metadata
pydantic_1
ruamel-yaml
types-deprecated
];
});
};
};
in
python.pkgs.buildPythonApplication rec {
2024-04-11 13:58:30 +00:00
pname = "charmcraft";
2024-06-22 12:27:01 +00:00
version = "2.7.0";
2024-04-11 13:58:30 +00:00
pyproject = true;
src = fetchFromGitHub {
owner = "canonical";
repo = "charmcraft";
rev = "refs/tags/${version}";
2024-06-22 12:27:01 +00:00
hash = "sha256-yMcGXi7OxEtfOv3zLEUlnZrR90TkFc0y9RB9jS34ZWs=";
2024-04-11 13:58:30 +00:00
};
postPatch = ''
substituteInPlace setup.py \
--replace-fail 'version=determine_version()' 'version="${version}"'
substituteInPlace charmcraft/env.py \
--replace-fail "distutils.util" "setuptools.dist"
2024-04-11 13:58:30 +00:00
'';
2024-07-24 14:53:10 +00:00
dependencies = with python.pkgs; [
2024-04-11 13:58:30 +00:00
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
];
2024-07-24 14:53:10 +00:00
build-system = with python.pkgs; [ setuptools ];
2024-04-11 13:58:30 +00:00
2024-07-09 11:47:37 +00:00
pythonRelaxDeps = [ "urllib3" ];
2024-04-11 13:58:30 +00:00
2024-07-09 11:47:37 +00:00
nativeCheckInputs =
2024-07-24 14:53:10 +00:00
with python.pkgs;
2024-07-09 11:47:37 +00:00
[
pyfakefs
pytest-check
pytest-mock
pytest-subprocess
pytestCheckHook
responses
setuptools
]
++ [ git ];
2024-04-11 13:58:30 +00:00
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;
};
}