Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions pkgs/by-name/it/itstool/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
stdenv,
lib,
fetchurl,
fetchpatch,
python3,
autoreconfHook,
versionCheckHook,
}:

stdenv.mkDerivation rec {
Expand All @@ -14,18 +17,31 @@ stdenv.mkDerivation rec {
hash = "sha256-a5p80poSu5VZj1dQ6HY87niDahogf4W3TYsydbJ+h8o=";
};

patches = [
# https://github.com/itstool/itstool/pull/51
(fetchpatch {
name = "fix-insufficiently-quoted-regular-expressions-pr51";
url = "https://github.com/itstool/itstool/commit/19f9580f27aa261ea383b395fdef7e153f3f9e6d.patch";
hash = "sha256-5J4mRXQu24o2rqVtaXN/ETgj6A8R0Ym+YkZhqhZTzIc=";
})
];

strictDeps = true;

postPatch = ''
# Do not let autoconf find Python, but set it directly. This fixes cross-compilation.
substituteInPlace configure.ac \
--replace-fail 'AM_PATH_PYTHON([2.6])' "" \
--replace-fail 'AC_MSG_ERROR(Python module $py_module is needed to run this package)' ""
substituteInPlace itstool.in \
--replace-fail "@PYTHON@" "${python3.interpreter}"
'';

nativeBuildInputs = [
python3
autoreconfHook
python3.pkgs.wrapPython
];

buildInputs = [
python3
python3.pkgs.libxml2
];

pythonPath = [
python3.pkgs.libxml2
];
Expand All @@ -34,6 +50,9 @@ stdenv.mkDerivation rec {
wrapPythonPrograms
'';

nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;

meta = {
homepage = "https://itstool.org/";
description = "XML to PO and back again";
Expand Down