Commit 0d9aa56b authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files
parent c33faa16
Loading
Loading
Loading
Loading
+20 −18
Original line number Diff line number Diff line
{
  lib,
  poetry-core,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  importlib-metadata,

  # build-system
  poetry-core,

  # dependencies
  packaging,

  # tests
  addBinToPathHook,
  gitMinimal,
  pytestCheckHook,
  git,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "dunamai";
  version = "1.22.0";
  version = "1.23.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "mtkennerly";
    repo = "dunamai";
    tag = "v${version}";
    hash = "sha256-oOchPGBRHf3PT1Ynci56CF/eW4TkRVPV9inVNX2QQrk=";
    hash = "sha256-JuW/VL8kfzz5mSXRHtrg/hHykgcewaQYfDuO2PALbWc=";
  };

  nativeBuildInputs = [ poetry-core ];
  build-system = [ poetry-core ];

  propagatedBuildInputs = [ packaging ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
  dependencies = [ packaging ];

  # needs to be able to run dunami from PATH
  preCheck = ''
    export PATH=$PATH:$out/bin
    export HOME=$(mktemp -d)

    git config --global user.email "nobody@example.com"
    git config --global user.name "Nobody"
  '';

  nativeCheckInputs = [
    git
    addBinToPathHook
    gitMinimal
    pytestCheckHook
    writableTmpDirAsHomeHook
  ];

  disabledTests = [
@@ -49,12 +51,12 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "dunamai" ];

  meta = with lib; {
  meta = {
    description = "Dynamic version generation";
    mainProgram = "dunamai";
    homepage = "https://github.com/mtkennerly/dunamai";
    changelog = "https://github.com/mtkennerly/dunamai/blob/v${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ jmgilman ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jmgilman ];
  };
}