summary refs log tree commit diff
path: root/pkgs/development/python-modules/afdko
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2021-10-05 19:18:01 +0200
committersterni <sternenseemann@systemli.org>2021-11-23 11:45:00 +0100
commitf51df005e2c2024df73a9c38c7300b35b80439d3 (patch)
tree35c5bb2b2060ca3c343770ed89c0b33316951f62 /pkgs/development/python-modules/afdko
parentac1f59665b669878a73d1977c6da3c5804703420 (diff)
downloadnixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar.gz
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar.bz2
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar.lz
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar.xz
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.tar.zst
nixpkgs-f51df005e2c2024df73a9c38c7300b35b80439d3.zip
python3Packages.afdko: 3.5.1 -> 3.7.1
Diffstat (limited to 'pkgs/development/python-modules/afdko')
-rw-r--r--pkgs/development/python-modules/afdko/default.nix45
-rw-r--r--pkgs/development/python-modules/afdko/no-pypi-build-tools.patch24
-rw-r--r--pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch43
3 files changed, 91 insertions, 21 deletions
diff --git a/pkgs/development/python-modules/afdko/default.nix b/pkgs/development/python-modules/afdko/default.nix
index c06929176d9..7dd2fa9287f 100644
--- a/pkgs/development/python-modules/afdko/default.nix
+++ b/pkgs/development/python-modules/afdko/default.nix
@@ -1,38 +1,45 @@
-{ lib, stdenv, buildPythonPackage, fetchPypi, fetchpatch, pythonOlder
+{ lib, stdenv, buildPythonPackage, fetchPypi, pythonOlder
 , fonttools, defcon, lxml, fs, unicodedata2, zopfli, brotlipy, fontpens
 , brotli, fontmath, mutatormath, booleanoperations
 , ufoprocessor, ufonormalizer, psautohint, tqdm
-, setuptools-scm
+, setuptools-scm, scikit-build
+, cmake
+, antlr4_9
 , pytestCheckHook
 }:
 
 buildPythonPackage rec {
   pname = "afdko";
-  version = "3.5.1";
+  version = "3.7.1";
 
   disabled = pythonOlder "3.6";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1qg7dgl81yq0sp50pkhgvmf8az1svx20zmpkfa68ka9d0ssh1wjw";
+    sha256 = "05hj2mw3ppfjaig5zdk5db9vfrbbq5gmv5rzggmvvrj0yyfpr0pd";
   };
 
+  format = "pyproject";
+
+  nativeBuildInputs = [
+    setuptools-scm
+    scikit-build
+    cmake
+  ];
+
+  buildInputs = [
+    antlr4_9.runtime.cpp
+  ];
+
   patches = [
-    # Skip date-dependent test. See
-    # https://github.com/adobe-type-tools/afdko/pull/1232
-    # https://github.com/NixOS/nixpkgs/pull/98158#issuecomment-704321117
-    (fetchpatch {
-      url = "https://github.com/adobe-type-tools/afdko/commit/2c36ad10f9d964759f643e8ed7b0972a27aa26bd.patch";
-      sha256 = "0p6a485mmzrbfldfbhgfghsypfiad3cabcw7qlw2rh993ivpnibf";
-    })
-    # fix tests for fonttools 4.21.1
-    (fetchpatch {
-      url = "https://github.com/adobe-type-tools/afdko/commit/0919e7454a0a05a1b141c23bf8134c67e6b688fc.patch";
-      sha256 = "0glly85swyl1kcc0mi8i0w4bm148bb001jz1winz5drfrw3a63jp";
-    })
+    # Don't try to install cmake and ninja using pip
+    ./no-pypi-build-tools.patch
+    # Use antlr4 runtime from nixpkgs and link it dynamically
+    ./use-dynamic-system-antlr4-runtime.patch
   ];
 
-  nativeBuildInputs = [ setuptools-scm ];
+  # setup.py will always (re-)execute cmake in buildPhase
+  dontConfigure = true;
 
   propagatedBuildInputs = [
     booleanoperations
@@ -53,10 +60,6 @@ buildPythonPackage rec {
     tqdm
   ];
 
-  # tests are broken on non x86_64
-  # https://github.com/adobe-type-tools/afdko/issues/1163
-  # https://github.com/adobe-type-tools/afdko/issues/1216
-  doCheck = stdenv.isx86_64;
   checkInputs = [ pytestCheckHook ];
   preCheck = ''
     export PATH=$PATH:$out/bin
diff --git a/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch b/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch
new file mode 100644
index 00000000000..4acc351e7bd
--- /dev/null
+++ b/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch
@@ -0,0 +1,24 @@
+commit 72b0ab672d1080049431eeee07ae6d2556ae9e4a
+Author: sternenseemann <sternenseemann@systemli.org>
+Date:   Tue Oct 5 18:17:20 2021 +0200
+
+    Don't use pypi distributions of build tools
+    
+    We want to use regular cmake and ninja and not the pypi projects which
+    somehow wrap and vendor a version of the proper tool.
+
+diff --git a/setup.py b/setup.py
+index 50deb781..81417971 100644
+--- a/setup.py
++++ b/setup.py
+@@ -196,9 +196,7 @@ def main():
+           setup_requires=[
+               'wheel',
+               'setuptools_scm',
+-              'scikit-build',
+-              'cmake',
+-              'ninja'
++              'scikit-build'
+           ],
+           tests_require=[
+               'pytest',
diff --git a/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch b/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch
new file mode 100644
index 00000000000..25e399e78d9
--- /dev/null
+++ b/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch
@@ -0,0 +1,43 @@
+commit 105daa26f09034af58eb13ac7c5c4ff5420c1724
+Author: sternenseemann <sternenseemann@systemli.org>
+Date:   Tue Oct 5 18:16:10 2021 +0200
+
+    Link against system antlr4 runtime, dynamically
+    
+    Instead of cloning a antlr4 version from git, use the system one. Also
+    don't link it statically, but dynamically by default (the library is
+    called antlr4-runtime, not antlr4_static).
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d7f86fb6..c43c4456 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -36,13 +36,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+ # https://www.antlr.org/download/antlr4-cpp-runtime-4.9.2-source.zip
+ # set(ANTLR4_ZIP_REPOSITORY "/path_to_antlr4_archive/a4.zip")
+ 
+-add_definitions(-DANTLR4CPP_STATIC)
+ set(ANTLR4_WITH_STATIC_CRT OFF)
+ # Use slightly more recent commit than 4.9.2 to deal with utfcpp test
+ # compilation problems
+ # set(ANTLR4_TAG tags/4.9.2)
+ set(ANTLR4_TAG 916f03366edf15bf8b50010b11d479c189bf9f96)
+-include(ExternalAntlr4Cpp)
++find_path(ANTLR4_HEADER antlr4-runtime.h PATH_SUFFIXES antlr4-runtime)
++set(ANTLR4_INCLUDE_DIRS ${ANTLR4_HEADER})
+ 
+ # sanitizer support
+ # work around https://github.com/pypa/setuptools/issues/1928 with environment
+diff --git a/c/makeotf/lib/hotconv/CMakeLists.txt b/c/makeotf/lib/hotconv/CMakeLists.txt
+index 82257bf2..02eb2e30 100644
+--- a/c/makeotf/lib/hotconv/CMakeLists.txt
++++ b/c/makeotf/lib/hotconv/CMakeLists.txt
+@@ -69,7 +69,7 @@ add_library(hotconv STATIC
+ 
+ set_property(TARGET hotconv PROPERTY C_STANDARD 99)
+ target_include_directories(hotconv PRIVATE AFTER $<$<COMPILE_LANGUAGE:CXX>:${ANTLR4_INCLUDE_DIRS}>)
+-target_link_libraries(hotconv PUBLIC antlr4_static)
++target_link_libraries(hotconv PUBLIC antlr4-runtime)
+ 
+ if ( CMAKE_COMPILER_IS_GNUCC )
+     target_compile_options(hotconv PRIVATE -Wall -Wno-attributes)