Merge pull request #202902 from dotlambda/txt2tags-3

txt2tags: 2.6 -> unstable-2022-10-17
This commit is contained in:
Robert Schütz 2022-11-26 16:52:30 -08:00 committed by GitHub
commit 25a00ae734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,35 +1,38 @@
{ lib, stdenv, fetchurl, python2 }:
{ lib
, python3
, fetchFromGitHub
, fetchpatch
}:
stdenv.mkDerivation rec {
version = "2.6";
python3.pkgs.buildPythonApplication rec {
pname = "txt2tags";
version = "unstable-2022-10-17";
dontBuild = true;
format = "setuptools";
# Python script, needs the interpreter
propagatedBuildInputs = [ python2 ];
src = fetchFromGitHub {
owner = "txt2tags";
repo = "txt2tags";
rev = "114ab24ea9111060df136bfc1c8b1a35a59fe0f2";
hash = "sha256-h2OtlUMzEHKyJ9AIO1Uo9Lx7jMYZNMtC6U+usBu7gNU=";
};
installPhase = ''
mkdir -p "$out/bin"
mkdir -p "$out/share/doc"
mkdir -p "$out/share/man/man1/"
sed '1s|/usr/bin/env python|${python2}/bin/python|' < txt2tags > "$out/bin/txt2tags"
chmod +x "$out/bin/txt2tags"
gzip - < doc/manpage.man > "$out/share/man/man1/txt2tags.1.gz"
cp doc/userguide.pdf "$out/share/doc"
cp -r extras/ samples/ test/ "$out/share"
postPatch = ''
substituteInPlace test/lib.py \
--replace 'TXT2TAGS = os.path.join(TEST_DIR, "..", "txt2tags.py")' \
'TXT2TAGS = "${placeholder "out"}/bin/txt2tags"' \
--replace "[PYTHON] + TXT2TAGS" "TXT2TAGS"
'';
src = fetchurl {
url = "http://txt2tags.googlecode.com/files/${pname}-${version}.tgz";
sha256 = "0p5hql559pk8v5dlzgm75yrcxwvz4z30f1q590yzng0ghvbnf530";
};
checkPhase = ''
${python3.interpreter} test/run.py
'';
meta = {
changelog = "https://github.com/txt2tags/txt2tags/blob/${src.rev}/CHANGELOG.md";
description = "Convert between markup languages";
homepage = "https://txt2tags.org/";
description = "A KISS markup language";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ kovirobi ];
platforms = with lib.platforms; unix;
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ dotlambda kovirobi ];
};
}