pythonPackages.nototools: make python 3 compatible and use that one

This commit is contained in:
Frederik Rietdijk 2019-10-29 10:38:59 +01:00 committed by Frederik Rietdijk
parent 702c745241
commit accec23188
3 changed files with 29 additions and 12 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchzip, fetchFromGitHub, optipng, cairo, pythonPackages, pkgconfig, pngquant, which, imagemagick }: { stdenv, fetchzip, fetchFromGitHub, optipng, cairo, python3Packages, pkgconfig, pngquant, which, imagemagick }:
let let
mkNoto = { name, weights, sha256, }: mkNoto = { name, weights, sha256, }:
@ -102,7 +102,7 @@ in
buildInputs = [ cairo ]; buildInputs = [ cairo ];
nativeBuildInputs = [ pngquant optipng which cairo pkgconfig imagemagick ] nativeBuildInputs = [ pngquant optipng which cairo pkgconfig imagemagick ]
++ (with pythonPackages; [ python fonttools nototools ]); ++ (with python3Packages; [ python fonttools nototools ]);
postPatch = '' postPatch = ''
sed -i 's,^PNGQUANT :=.*,PNGQUANT := ${pngquant}/bin/pngquant,' Makefile sed -i 's,^PNGQUANT :=.*,PNGQUANT := ${pngquant}/bin/pngquant,' Makefile

View File

@ -1,28 +1,45 @@
{ fetchFromGitHub, pythonPackages, lib }: { fetchFromGitHub, lib, fetchpatch, buildPythonPackage, isPy3k, fonttools, numpy, pillow, six, bash }:
pythonPackages.buildPythonPackage rec { buildPythonPackage rec {
pname = "nototools"; pname = "nototools";
version = "unstable-2019-03-20"; version = "unstable-2019-10-21";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "googlefonts"; owner = "googlefonts";
repo = "nototools"; repo = "nototools";
rev = "9c4375f07c9adc00c700c5d252df6a25d7425870"; rev = "cae92ce958bee37748bf0602f5d7d97bb6db98ca";
sha256 = "0z9i23vl6xar4kvbqbc8nznq3s690mqc5zfv280l1c02l5n41smc"; sha256 = "1jqr0dz23rjqiyxw1w69l6ry16dwdcf3c6cysiy793g2v7pir2yi";
}; };
propagatedBuildInputs = with pythonPackages; [ fonttools numpy ]; propagatedBuildInputs = [ fonttools numpy ];
patches = lib.optionals isPy3k [
# Additional Python 3 compat https://github.com/googlefonts/nototools/pull/497
(fetchpatch {
url = https://github.com/googlefonts/nototools/commit/ded1f311b3260f015b5c5b80f05f7185392c4eff.patch;
sha256 = "0bn0rlbddxicw0h1dnl0cibgj6xjalja2qcm563y7kk3z5cdwhgq";
})
];
postPatch = '' postPatch = ''
sed -ie "s^join(_DATA_DIR_PATH,^join(\"$out/third_party/ucd\",^" nototools/unicode_data.py sed -ie "s^join(_DATA_DIR_PATH,^join(\"$out/third_party/ucd\",^" nototools/unicode_data.py
''; '';
checkInputs = [
pillow six bash
];
checkPhase = ''
patchShebangs tests/
cd tests
rm gpos_diff_test.py # needs ttxn?
./run_tests
'';
postInstall = '' postInstall = ''
cp -r third_party $out cp -r third_party $out
''; '';
disabled = pythonPackages.isPy3k;
meta = { meta = {
description = "Noto fonts support tools and scripts plus web site generation"; description = "Noto fonts support tools and scripts plus web site generation";
license = lib.licenses.asl20; license = lib.licenses.asl20;

View File

@ -7,7 +7,7 @@
, imagemagick , imagemagick
, pkg-config , pkg-config
, pngquant , pngquant
, python2 , python3
, which , which
, zopfli , zopfli
}: }:
@ -33,7 +33,7 @@ let
sha256 = "0vzmlp83vnk4njcfkn03jcc1vkg2rf12zf5kj3p3a373xr4ds1zn"; sha256 = "0vzmlp83vnk4njcfkn03jcc1vkg2rf12zf5kj3p3a373xr4ds1zn";
}; };
python = python2.withPackages (pp: with pp; [ python = python3.withPackages (pp: with pp; [
nototools nototools
]); ]);
in in