Unverified Commit 553064c6 authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

ubports-click: Modernise (#498886)

parents 10605584 69da66f2
Loading
Loading
Loading
Loading
+133 −134
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@
  python3Packages,
  vala,
  wrapGAppsHook3,
  writableTmpDirAsHomeHook,
}:

let
  self = python3Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication (finalAttrs: {
  pname = "click";
  version = "0.5.2";
  pyproject = false;
@@ -31,7 +31,7 @@ let
  src = fetchFromGitLab {
    owner = "ubports";
    repo = "development/core/click";
      rev = version;
    tag = finalAttrs.version;
    hash = "sha256-AV3n6tghvpV/6Ew6Lokf8QAGBIMbHFAnp6G4pefVn+8=";
  };

@@ -51,15 +51,18 @@ let
    })
  ];

    postPatch = ''
  postPatch =
    # These should be proper Requires, using the header needs their headers
    ''
      substituteInPlace lib/click/click-*.pc.in \
        --replace-fail 'Requires.private' 'Requires'

    ''
    # Don't completely override PKG_CONFIG_PATH
    + ''
      substituteInPlace click_package/tests/Makefile.am \
        --replace-fail 'PKG_CONFIG_PATH=$(top_builddir)/lib/click' 'PKG_CONFIG_PATH=$(top_builddir)/lib/click:$(PKG_CONFIG_PATH)'

    ''
    + ''
      patchShebangs bin/click
    '';

@@ -98,6 +101,7 @@ let
    dbus
    dpkg
    python3Packages.unittestCheckHook
    writableTmpDirAsHomeHook
  ];

  checkInputs = with python3Packages; [
@@ -127,14 +131,14 @@ let
    "click_package/tests/test_scripts.py"
  ];

    preCheck = ''
      export HOME=$TMP

  preCheck =
    # tests recompile some files for loaded predefines, doesn't use any optimisation level for it
    # makes test output harder to read, so make the warning go away
    ''
      export NIX_CFLAGS_COMPILE+=" -U_FORTIFY_SOURCE"

    ''
    # Haven't been able to get them excluded via disabledTest{s,Paths}, just deleting them
    + ''
      for path in $disabledTestPaths; do
        rm -v $path
      done
@@ -147,13 +151,17 @@ let
  '';

  passthru = {
    tests.pkg-config = testers.hasPkgConfigModules {
      package = finalAttrs.finalPackage;
      versionCheck = true;
    };
    updateScript = gitUpdater { };
  };

  meta = {
    description = "Tool to build click packages, mainly used for Ubuntu Touch";
    homepage = "https://gitlab.com/ubports/development/core/click";
      changelog = "https://gitlab.com/ubports/development/core/click/-/blob/${version}/ChangeLog";
    changelog = "https://gitlab.com/ubports/development/core/click/-/blob/${finalAttrs.version}/ChangeLog";
    license = lib.licenses.gpl3Only;
    mainProgram = "click";
    maintainers = with lib.maintainers; [
@@ -165,13 +173,4 @@ let
      "click-0.4"
    ];
  };
  };
in
self
// {
  passthru = self.passthru // {
    tests.pkg-config = testers.hasPkgConfigModules {
      package = self;
    };
  };
}
})