diff --git a/pkgs/by-name/op/opentype-sanitizer/package.nix b/pkgs/by-name/op/opentype-sanitizer/package.nix new file mode 100644 index 000000000000..2e7e7e62180e --- /dev/null +++ b/pkgs/by-name/op/opentype-sanitizer/package.nix @@ -0,0 +1,44 @@ +{ lib +, stdenv +, fetchFromGitHub +, freetype +, gtest +, lz4 +, meson +, ninja +, pkg-config +, woff2 +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "opentype-sanitizer"; + version = "9.1.0"; + + src = fetchFromGitHub { + owner = "khaledhosny"; + repo = "ots"; + rev = "v${finalAttrs.version}"; + hash = "sha256-gsNMPNPcfHyOgjJnIrJ5tLYHbCfIfTowEhcaGOUPb2Q="; + }; + + buildInputs = [ + freetype + gtest + lz4 + woff2 + ]; + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + doCheck = true; + + meta = with lib; { + description = "Sanitizing parser for OpenType fonts"; + homepage = "https://github.com/khaledhosny/ots"; + license = licenses.bsd3; + maintainers = with maintainers; [ danc86 ]; + }; +}) diff --git a/pkgs/development/python-modules/axisregistry/default.nix b/pkgs/development/python-modules/axisregistry/default.nix new file mode 100644 index 000000000000..5fba9f0f02dc --- /dev/null +++ b/pkgs/development/python-modules/axisregistry/default.nix @@ -0,0 +1,46 @@ +{ lib +, buildPythonPackage +, fetchPypi +, fonttools +, protobuf +, pythonRelaxDepsHook +, pytestCheckHook +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "axisregistry"; + version = "0.4.5"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-elQUcl6Zh/3xXLduFKbiXZ6uQsDE8C6M3QnTEwaJlaA="; + }; + + propagatedBuildInputs = [ + fonttools + protobuf + ]; + nativeBuildInputs = [ + pythonRelaxDepsHook + setuptools-scm + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + + # Relax the dependency on protobuf 3. Other packages in the Google Fonts + # ecosystem have begun upgrading from protobuf 3 to protobuf 4, + # so we need to use protobuf 4 here as well to avoid a conflict + # in the closure of fontbakery. It seems to be compatible enough. + pythonRelaxDeps = [ "protobuf" ]; + + meta = with lib; { + description = "Google Fonts registry of OpenType variation axis tags"; + homepage = "https://github.com/googlefonts/axisregistry"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/babelfont/default.nix b/pkgs/development/python-modules/babelfont/default.nix new file mode 100644 index 000000000000..4cd3e809a890 --- /dev/null +++ b/pkgs/development/python-modules/babelfont/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, cu2qu +, defcon +, fontfeatures +, fonttools +, glyphslib +, openstep-plist +, orjson +, poetry-core +, pytestCheckHook +, ufoLib2 +}: + +buildPythonPackage rec { + pname = "babelfont"; + version = "3.0.1"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "simoncozens"; + repo = pname; + rev = "v${version}"; + hash = "sha256-1DHcJDVaCgIAODyf5UUrXej8x3ySD4+6/KtxuF2yFV4="; + }; + + pyproject = true; + + propagatedBuildInputs = [ + cu2qu + fontfeatures + fonttools + glyphslib + openstep-plist + orjson + ufoLib2 + ]; + nativeBuildInputs = [ + poetry-core + ]; + + doCheck = true; + nativeCheckInputs = [ + defcon + pytestCheckHook + ]; + + meta = with lib; { + description = "Python library to load, examine, and save fonts in a variety of formats"; + homepage = "https://github.com/simoncozens/babelfont"; + license = licenses.bsd3; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/beziers/default.nix b/pkgs/development/python-modules/beziers/default.nix new file mode 100644 index 000000000000..0bfb5eeb29ee --- /dev/null +++ b/pkgs/development/python-modules/beziers/default.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, dotmap +, matplotlib +, pyclipper +, unittestCheckHook +}: + +buildPythonPackage rec { + pname = "beziers"; + version = "0.5.0"; + + # PyPI doesn't have a proper source tarball, fetch from Github instead + src = fetchFromGitHub { + owner = "simoncozens"; + repo = "beziers.py"; + rev = "v${version}"; + hash = "sha256-4014u7s47Tfdpa2Q9hKAoHg7Ebcs1/DVW5TpEmoh2bc="; + }; + + propagatedBuildInputs = [ + pyclipper + ]; + + doCheck = true; + nativeCheckInputs = [ + dotmap + matplotlib + unittestCheckHook + ]; + unittestFlagsArray = [ "-s" "test" "-v" ]; + + meta = with lib; { + description = "Python library for manipulating Bezier curves and paths in fonts"; + homepage = "https://github.com/simoncozens/beziers.py"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/collidoscope/default.nix b/pkgs/development/python-modules/collidoscope/default.nix new file mode 100644 index 000000000000..1398043f6b1c --- /dev/null +++ b/pkgs/development/python-modules/collidoscope/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchPypi +, babelfont +, kurbopy +, fonttools +, skia-pathops +, tqdm +, uharfbuzz +, unittestCheckHook +}: + +buildPythonPackage rec { + pname = "collidoscope"; + version = "0.6.5"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-D7MzJ8FZjA/NSXCqCJQ9a02FPPi3t4W0q65wRIDcfSA="; + }; + + propagatedBuildInputs = [ + babelfont + kurbopy + fonttools + skia-pathops + tqdm + uharfbuzz + ]; + + doCheck = true; + nativeCheckInputs = [ + unittestCheckHook + ]; + unittestFlagsArray = [ "-s" "test" "-v" ]; + + meta = with lib; { + description = "Python library to detect glyph collisions in fonts"; + homepage = "https://github.com/googlefonts/collidoscope"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/commandlines/default.nix b/pkgs/development/python-modules/commandlines/default.nix new file mode 100644 index 000000000000..70e37055c4dd --- /dev/null +++ b/pkgs/development/python-modules/commandlines/default.nix @@ -0,0 +1,31 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "commandlines"; + version = "0.4.1"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "chrissimpkins"; + repo = "commandlines"; + rev = "v${version}"; + hash = "sha256-x3iUeOTAaTKNW5Y5foMPMJcWVxu52uYZoY3Hhe3UvQ4="; + }; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Python library for command line argument parsing"; + homepage = "https://github.com/chrissimpkins/commandlines"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/dehinter/default.nix b/pkgs/development/python-modules/dehinter/default.nix new file mode 100644 index 000000000000..30eae7942765 --- /dev/null +++ b/pkgs/development/python-modules/dehinter/default.nix @@ -0,0 +1,36 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fonttools +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "dehinter"; + version = "4.0.0"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "source-foundry"; + repo = "dehinter"; + rev = "v${version}"; + hash = "sha256-l988SW6OWKXzJK0WGAJZR/QDFvgnSir+5TwMMvFcOxg="; + }; + + propagatedBuildInputs = [ + fonttools + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Utility for removing hinting data from TrueType and OpenType fonts"; + homepage = "https://github.com/source-foundry/dehinter"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/font-v/default.nix b/pkgs/development/python-modules/font-v/default.nix new file mode 100644 index 000000000000..8a43dd52adea --- /dev/null +++ b/pkgs/development/python-modules/font-v/default.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fonttools +, git +, gitpython +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "font-v"; + version = "2.1.0"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "source-foundry"; + repo = "font-v"; + rev = "v${version}"; + hash = "sha256-ceASyYcNul5aWPAPGajCQrqsQ3bN1sE+nMbCbj7f35w="; + }; + + propagatedBuildInputs = [ + fonttools + gitpython + ]; + + doCheck = true; + nativeCheckInputs = [ + git + pytestCheckHook + ]; + preCheck = '' + # Many tests assume they are running from a git checkout, although they + # don't care which one. Create a dummy git repo to satisfy the tests: + git init -b main + git config user.email test@example.invalid + git config user.name Test + git commit --allow-empty --message 'Dummy commit for tests' + ''; + disabledTests = [ + # These tests assume they are actually running from a font-v git checkout, + # so just skip them: + "test_utilities_get_gitrootpath_function" + ]; + + meta = with lib; { + description = "Python utility for manipulating font version headers"; + homepage = "https://github.com/source-foundry/font-v"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/fontbakery/default.nix b/pkgs/development/python-modules/fontbakery/default.nix new file mode 100644 index 000000000000..b824ca990b8a --- /dev/null +++ b/pkgs/development/python-modules/fontbakery/default.nix @@ -0,0 +1,146 @@ +{ lib +, buildPythonPackage +, callPackage +, fetchpatch +, fetchPypi +, axisregistry +, babelfont +, beautifulsoup4 +, beziers +, cmarkgfm +, collidoscope +, defcon +, dehinter +, fonttools +, font-v +, freetype-py +, gflanguages +, git +, glyphsets +, lxml +, installShellFiles +, munkres +, opentypespec +, ots-python +, packaging +, pip-api +, protobuf +, pytestCheckHook +, pytest-xdist +, pythonRelaxDepsHook +, pyyaml +, requests +, requests-mock +, rich +, setuptools-scm +, shaperglot +, stringbrewer +, toml +, unicodedata2 +, ufo2ft +, ufolint +, vharfbuzz +}: + +buildPythonPackage rec { + pname = "fontbakery"; + version = "0.10.4"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-Ye/TMGvURxSU2yoohwYbSo5RvrmbHKdMnFNj2lUvtMk="; + }; + + patches = [ + # Mock HTTP requests in tests (note we still have to skip some below) + # https://github.com/googlefonts/fontbakery/pull/4124 + (fetchpatch { + url = "https://github.com/fonttools/fontbakery/pull/4124.patch"; + hash = "sha256-NXuC2+TtxpHYMdd0t+cF0FJ3lrh4exP5yxspEasKKd0="; + }) + ]; + + propagatedBuildInputs = [ + axisregistry + babelfont + beautifulsoup4 + beziers + cmarkgfm + collidoscope + defcon + dehinter + fonttools + font-v + freetype-py + gflanguages + glyphsets + lxml + munkres + ots-python + opentypespec + packaging + pip-api + protobuf + pyyaml + requests + rich + shaperglot + stringbrewer + toml + ufolint + unicodedata2 + vharfbuzz + ufo2ft + ]; + nativeBuildInputs = [ + installShellFiles + pythonRelaxDepsHook + setuptools-scm + ]; + + pythonRelaxDeps = [ + "collidoscope" + "protobuf" + "vharfbuzz" + ]; + + doCheck = true; + nativeCheckInputs = [ + git + pytestCheckHook + pytest-xdist + requests-mock + ufolint + ]; + preCheck = '' + # Let the tests invoke 'fontbakery' command. + export PATH="$out/bin:$PATH" + # font-v tests assume they are running from a git checkout, although they + # don't care which one. Create a dummy git repo to satisfy the tests: + git init -b main + git config user.email test@example.invalid + git config user.name Test + git commit --allow-empty --message 'Dummy commit for tests' + ''; + disabledTests = [ + # These require network access: + "test_check_vertical_metrics_regressions" + "test_check_cjk_vertical_metrics_regressions" + "test_check_fontbakery_version_live_apis" + ]; + + postInstall = '' + installShellCompletion --bash --name fontbakery \ + snippets/fontbakery.bash-completion + ''; + + passthru.tests.simple = callPackage ./tests.nix { }; + + meta = with lib; { + description = "Tool for checking the quality of font projects"; + homepage = "https://github.com/googlefonts/fontbakery"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/fontbakery/tests.nix b/pkgs/development/python-modules/fontbakery/tests.nix new file mode 100644 index 000000000000..4725b1fee3e3 --- /dev/null +++ b/pkgs/development/python-modules/fontbakery/tests.nix @@ -0,0 +1,22 @@ +{ runCommand +, fontbakery +}: + +let + inherit (fontbakery) pname version src; +in + +runCommand "${pname}-tests" { meta.timeout = 5; } '' + # Check the version matches what we packaged. + ${fontbakery}/bin/fontbakery --version | grep -q "${version}" + + # Can it list its own subcommands? + ${fontbakery}/bin/fontbakery --list-subcommands >>$out + + # Unpack src to get some test fonts. + tar -xzf ${src} --strip-components=1 ${pname}-${version}/data/test + + # Run some font checks. + ${fontbakery}/bin/fontbakery check-ufo-sources --no-progress --no-colors data/test/test.ufo >>$out + # TODO add more +'' diff --git a/pkgs/development/python-modules/fontfeatures/default.nix b/pkgs/development/python-modules/fontfeatures/default.nix new file mode 100644 index 000000000000..2ea5247d38c8 --- /dev/null +++ b/pkgs/development/python-modules/fontfeatures/default.nix @@ -0,0 +1,50 @@ +{ lib +, buildPythonPackage +, fetchPypi +, fetchpatch +, beziers +, fonttools +, fs +, glyphtools +, lxml +, pytestCheckHook +, youseedee +}: + +buildPythonPackage rec { + pname = "fontfeatures"; + version = "1.8.0"; + + src = fetchPypi { + pname = "fontFeatures"; + inherit version; + hash = "sha256-XLJD91IyUUjeSqdhWFfIqv9yISPcbU4bgRvXETSHOiY="; + }; + + propagatedBuildInputs = [ + beziers + fonttools + fs + glyphtools + lxml + youseedee + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + disabledTestPaths = [ + # These tests require babelfont but we have to leave it out and skip them + # to break the cyclic dependency with babelfont. + "tests/test_shaping_generic.py" + "tests/test_shaping_harfbuzz.py" + ]; + + meta = with lib; { + description = "Python library for compiling OpenType font features"; + homepage = "https://github.com/simoncozens/fontFeatures"; + license = licenses.bsd3; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/gflanguages/default.nix b/pkgs/development/python-modules/gflanguages/default.nix new file mode 100644 index 000000000000..baaeeb6c9339 --- /dev/null +++ b/pkgs/development/python-modules/gflanguages/default.nix @@ -0,0 +1,48 @@ +{ lib +, buildPythonPackage +, fetchPypi +, protobuf +, setuptools-scm +, pythonRelaxDepsHook +, pytestCheckHook +, uharfbuzz +, youseedee +}: + +buildPythonPackage rec { + pname = "gflanguages"; + version = "0.5.10"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-JVeI7TlJjbKCa+gGmjylbNiEhX3qmpbLXiH3VpFqgXc="; + }; + + propagatedBuildInputs = [ + protobuf + ]; + nativeBuildInputs = [ + setuptools-scm + ]; + + doCheck = true; + nativeCheckInputs = [ + pythonRelaxDepsHook + pytestCheckHook + uharfbuzz + youseedee + ]; + + # Relax the dependency on protobuf 3. Other packages in the Google Fonts + # ecosystem have begun upgrading from protobuf 3 to protobuf 4, + # so we need to use protobuf 4 here as well to avoid a conflict + # in the closure of fontbakery. It seems to be compatible enough. + pythonRelaxDeps = [ "protobuf" ]; + + meta = with lib; { + description = "Python library for Google Fonts language metadata"; + homepage = "https://github.com/googlefonts/lang"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/glyphsets/0001-relax-setuptools-scm-dep.patch b/pkgs/development/python-modules/glyphsets/0001-relax-setuptools-scm-dep.patch new file mode 100644 index 000000000000..96a4047c5ced --- /dev/null +++ b/pkgs/development/python-modules/glyphsets/0001-relax-setuptools-scm-dep.patch @@ -0,0 +1,22 @@ +From de2e02a41b11a708d58dfd1e24d335b8882dd7bd Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Sun, 23 Apr 2023 12:15:47 +1000 +Subject: [PATCH] relax setuptools-scm dep + + +diff --git a/setup.py b/setup.py +index 2c122a7..42f9b61 100644 +--- a/setup.py ++++ b/setup.py +@@ -55,7 +55,7 @@ + 'Programming Language :: Python :: 3' + ], + python_requires=">=3.7", +- setup_requires=['setuptools_scm>=4,<6.1'], ++ setup_requires=['setuptools_scm'], + install_requires=[ + 'setuptools', + 'FontTools[ufo]', +-- +2.38.4 + diff --git a/pkgs/development/python-modules/glyphsets/default.nix b/pkgs/development/python-modules/glyphsets/default.nix new file mode 100644 index 000000000000..5088deb580b0 --- /dev/null +++ b/pkgs/development/python-modules/glyphsets/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, fetchPypi +, defcon +, fonttools +, glyphslib +, pytestCheckHook +, setuptools +, setuptools-scm +, unicodedata2 +}: + +buildPythonPackage rec { + pname = "glyphsets"; + version = "0.6.5"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-Zp4VLJ9h6lkz7KOM7LWKAj7UX1KziLobzeT9Dosv5UU="; + }; + + patches = [ + # Upstream has a needlessly strict version range for setuptools_scm, our + # setuptools-scm is newer. We can't use pythonRelaxDepsHook for this + # because it's in setup_requires which means we'll fail the requirement + # before pythonRelaxDepsHook can run. + ./0001-relax-setuptools-scm-dep.patch + ]; + + propagatedBuildInputs = [ + defcon + fonttools + glyphslib + setuptools + unicodedata2 + ]; + nativeBuildInputs = [ + setuptools-scm + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + preCheck = '' + export PATH="$out/bin:$PATH" + ''; + + meta = with lib; { + description = "Google Fonts glyph set metadata"; + homepage = "https://github.com/googlefonts/glyphsets"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/glyphtools/default.nix b/pkgs/development/python-modules/glyphtools/default.nix new file mode 100644 index 000000000000..f186863459a7 --- /dev/null +++ b/pkgs/development/python-modules/glyphtools/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, fetchPypi +, beziers +, glyphslib +, numpy +, setuptoolsCheckHook +}: + +buildPythonPackage rec { + pname = "glyphtools"; + version = "0.8.0"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-PXwXHWMJbsi6ZtN+daaXAnlw3gV5DFAhyRxdBa7UP+M="; + }; + + propagatedBuildInputs = [ + beziers + glyphslib + numpy + ]; + + # A unit test suite does exist, but it only contains a dummy test that + # doesn't test anything. It does import the module though so we still run it. + doCheck = true; + nativeCheckInputs = [ + # Upstream apparently prefers the deprecated setuptools 'test' command. + setuptoolsCheckHook + ]; + + meta = with lib; { + description = "Python library for extracting information from font glyphs"; + homepage = "https://github.com/simoncozens/glyphtools"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/kurbopy/default.nix b/pkgs/development/python-modules/kurbopy/default.nix new file mode 100644 index 000000000000..aa5e33f23757 --- /dev/null +++ b/pkgs/development/python-modules/kurbopy/default.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, fetchPypi +, fonttools +, pytestCheckHook +, python +, rustPlatform +, unzip +}: + +buildPythonPackage rec { + pname = "kurbopy"; + version = "0.10.40"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-dhpcDi20Na6SDbRxrC8N3SWdN1J/CWJgCUI3scJX/6s="; + }; + + propagatedBuildInputs = [ + fonttools + ]; + nativeBuildInputs = [ + rustPlatform.cargoSetupHook + rustPlatform.maturinBuildHook + ]; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + hash = "sha256-V3LeT0dqkfft1ftc+azwvuSzzdUJ7/wAp31fN7te9RQ="; + }; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + preCheck = '' + # pytestCheckHook puts . at the front of Python's sys.path, due to: + # https://github.com/NixOS/nixpkgs/issues/255262 + # So we need to prevent pytest from trying to import kurbopy from + # ./kurbopy, which contains the sources but not the newly built module. + # We want it to import kurbopy from the nix store via $PYTHONPATH instead. + rm -r kurbopy + ''; + + meta = with lib; { + description = "Python wrapper around the Rust kurbo library for 2D curve manipulation"; + homepage = "https://github.com/simoncozens/kurbopy"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/opentypespec/default.nix b/pkgs/development/python-modules/opentypespec/default.nix new file mode 100644 index 000000000000..c4bf0cde2c97 --- /dev/null +++ b/pkgs/development/python-modules/opentypespec/default.nix @@ -0,0 +1,29 @@ +{ lib +, buildPythonPackage +, fetchPypi +, unittestCheckHook +}: + +buildPythonPackage rec { + pname = "opentypespec"; + version = "1.9.1"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-fOEHmtlCkFhn1jyIA+CsHIfud7x3PPb7UWQsnrVyDqY="; + }; + + doCheck = true; + nativeCheckInputs = [ + unittestCheckHook + ]; + unittestFlagsArray = [ "-s" "test" "-v" ]; + + meta = with lib; { + description = "Python library for OpenType specification metadata"; + homepage = "https://github.com/simoncozens/opentypespec-py"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/ots-python/0001-use-packaged-ots.patch b/pkgs/development/python-modules/ots-python/0001-use-packaged-ots.patch new file mode 100644 index 000000000000..233e97d7b4b8 --- /dev/null +++ b/pkgs/development/python-modules/ots-python/0001-use-packaged-ots.patch @@ -0,0 +1,34 @@ +From 6ba3b97253cf540fdf4b36672f290def72386096 Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Sun, 23 Apr 2023 21:26:53 +1000 +Subject: [PATCH] use packaged ots + + +diff --git a/setup.py b/setup.py +index 6c3ccae..ca021da 100755 +--- a/setup.py ++++ b/setup.py +@@ -248,7 +248,6 @@ def run(self): + platforms=["posix", "nt"], + package_dir={"": "src/python"}, + packages=find_packages("src/python"), +- ext_modules=[ots_sanitize], + zip_safe=False, + cmdclass=cmdclass, + setup_requires=["setuptools_scm"], +diff --git a/src/python/ots/__init__.py b/src/python/ots/__init__.py +index 5fc1724..db9d21e 100644 +--- a/src/python/ots/__init__.py ++++ b/src/python/ots/__init__.py +@@ -3,7 +3,7 @@ + import sys + import os + +-OTS_SANITIZE = os.path.join(os.path.dirname(__file__), "ots-sanitize") ++OTS_SANITIZE = "@ots_sanitize@" + + __all__ = ["sanitize", "OTSError", "CalledProcessError"] + +-- +2.38.4 + diff --git a/pkgs/development/python-modules/ots-python/default.nix b/pkgs/development/python-modules/ots-python/default.nix new file mode 100644 index 000000000000..32863e2e4bd3 --- /dev/null +++ b/pkgs/development/python-modules/ots-python/default.nix @@ -0,0 +1,48 @@ +{ lib +, buildPythonPackage +, fetchPypi +, substituteAll +, opentype-sanitizer +, setuptools-scm +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "ots-python"; + version = "9.1.0"; + + src = fetchPypi { + pname = "opentype-sanitizer"; + inherit version; + hash = "sha256-1Zdd+eRECimZl8L8CCkm7pCjN0TafSsc5i2Y6/oH88I="; + }; + + patches = [ + # Invoke ots-sanitize from the opentype-sanitizer package instead of + # downloading precompiled binaries from the internet. + # (nixpkgs-specific, not upstreamable) + (substituteAll { + src = ./0001-use-packaged-ots.patch; + ots_sanitize = "${opentype-sanitizer}/bin/ots-sanitize"; + }) + ]; + + propagatedBuildInputs = [ + opentype-sanitizer + ]; + nativeBuildInputs = [ + setuptools-scm + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Python wrapper for ots (OpenType Sanitizer)"; + homepage = "https://github.com/googlefonts/ots-python"; + license = licenses.bsd3; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/rstr/default.nix b/pkgs/development/python-modules/rstr/default.nix new file mode 100644 index 000000000000..3c80a274ceaf --- /dev/null +++ b/pkgs/development/python-modules/rstr/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, setuptools-scm +, unittestCheckHook +}: + +buildPythonPackage rec { + pname = "rstr"; + version = "3.2.2"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-xKVk1N+0Ry2THRRcQ9HPGteMJFkhQud1W4hmF57qwBI="; + }; + + pyproject = true; + + nativeBuildInputs = [ + setuptools + setuptools-scm + ]; + + doCheck = true; + nativeCheckInputs = [ + unittestCheckHook + ]; + + meta = with lib; { + description = "Python library to generate random strings"; + homepage = "https://github.com/leapfrogonline/rstr"; + license = licenses.bsd3; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/shaperglot/default.nix b/pkgs/development/python-modules/shaperglot/default.nix new file mode 100644 index 000000000000..f1ea7e5a723a --- /dev/null +++ b/pkgs/development/python-modules/shaperglot/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, gflanguages +, num2words +, poetry-core +, protobuf +, pytestCheckHook +, strictyaml +, termcolor +, ufo2ft +, vharfbuzz +, youseedee +}: + +buildPythonPackage rec { + pname = "shaperglot"; + version = "0.3.1"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "googlefonts"; + repo = "shaperglot"; + rev = "v${version}"; + hash = "sha256-29MzD42rgh+7n/0kjqKGDxXPnUEvj/xxEIKWZg03pxw="; + }; + + pyproject = true; + + propagatedBuildInputs = [ + gflanguages + num2words + protobuf + strictyaml + termcolor + ufo2ft + vharfbuzz + youseedee + ]; + nativeBuildInputs = [ + poetry-core + ]; + + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Tool to test OpenType fonts for language support"; + homepage = "https://github.com/googlefonts/shaperglot"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/development/python-modules/sre-yield/default.nix b/pkgs/development/python-modules/sre-yield/default.nix new file mode 100644 index 000000000000..91e6904b5772 --- /dev/null +++ b/pkgs/development/python-modules/sre-yield/default.nix @@ -0,0 +1,34 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, unittestCheckHook +}: + +buildPythonPackage rec { + pname = "sre-yield"; + version = "1.2"; + + src = fetchPypi { + pname = "sre_yield"; + inherit version; + hash = "sha256-6U8aKjy6//4dzRXB1U5AGhUX4FKqZMfTFk+I3HYde4o="; + }; + + nativeBuildInputs = [ + setuptools + ]; + + doCheck = true; + nativeCheckInputs = [ + unittestCheckHook + ]; + + meta = with lib; { + description = "Python library to efficiently generate all values that can match a given regular expression"; + homepage = "https://github.com/sre-yield/sre-yield"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/stringbrewer/default.nix b/pkgs/development/python-modules/stringbrewer/default.nix new file mode 100644 index 000000000000..fc39d515a6ec --- /dev/null +++ b/pkgs/development/python-modules/stringbrewer/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, rstr +, sre-yield +, pythonImportsCheckHook +}: + +buildPythonPackage rec { + pname = "stringbrewer"; + version = "0.0.1"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-wtETgi+Tk1ALJzzIM6Ic5zkDbALGL0cELg8X75uepkk="; + }; + + propagatedBuildInputs = [ + rstr + sre-yield + ]; + nativeBuildInputs = [ + pythonImportsCheckHook + ]; + + # Package has no tests + doCheck = false; + pythonImportsCheck = [ "stringbrewer" ]; + + meta = with lib; { + description = "Python library to generate random strings matching a pattern"; + homepage = "https://github.com/simoncozens/stringbrewer"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/ufolint/default.nix b/pkgs/development/python-modules/ufolint/default.nix new file mode 100644 index 000000000000..c7b666c37fab --- /dev/null +++ b/pkgs/development/python-modules/ufolint/default.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, commandlines +, fonttools +, fs +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "ufolint"; + version = "1.2.0"; + + # PyPI source tarballs omit tests, fetch from Github instead + src = fetchFromGitHub { + owner = "source-foundry"; + repo = "ufolint"; + rev = "v${version}"; + hash = "sha256-sv8WbnDd2LFHkwNsB9FO04OlLhemdzwjq0tC9+Fd6/M="; + }; + + propagatedBuildInputs = [ + commandlines + fs + fonttools + ]; + + doCheck = true; + nativeBuildInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Linter for Unified Font Object (UFO) source code"; + homepage = "https://github.com/source-foundry/ufolint"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/vharfbuzz/default.nix b/pkgs/development/python-modules/vharfbuzz/default.nix new file mode 100644 index 000000000000..fb953a0e7be7 --- /dev/null +++ b/pkgs/development/python-modules/vharfbuzz/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, fonttools +, pythonImportsCheckHook +, uharfbuzz +}: + +buildPythonPackage rec { + pname = "vharfbuzz"; + version = "0.2.0"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-uDX2fYqxV4wmAAIMfA3dBohWmq1N0VurSTEFOjSRpmY="; + }; + + propagatedBuildInputs = [ + fonttools + uharfbuzz + ]; + nativeBuildInputs = [ + pythonImportsCheckHook + ]; + + # Package has no tests. + doCheck = false; + pythonImportsCheck = [ "vharfbuzz" ]; + + meta = with lib; { + description = "Utility for removing hinting data from TrueType and OpenType fonts"; + homepage = "https://github.com/source-foundry/dehinter"; + license = licenses.asl20; + maintainers = with maintainers; [ danc86 ]; + }; +} + diff --git a/pkgs/development/python-modules/youseedee/0001-use-packaged-unicode-data.patch b/pkgs/development/python-modules/youseedee/0001-use-packaged-unicode-data.patch new file mode 100644 index 000000000000..26af7ad24c92 --- /dev/null +++ b/pkgs/development/python-modules/youseedee/0001-use-packaged-unicode-data.patch @@ -0,0 +1,25 @@ +From 9013d36cfe7b2958eb18ce373f49193b66a0bbf6 Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Sun, 23 Apr 2023 16:14:55 +1000 +Subject: [PATCH] use packaged unicode data + + +diff --git a/lib/youseedee/__init__.py b/lib/youseedee/__init__.py +index 4424ef1..9a72f52 100644 +--- a/lib/youseedee/__init__.py ++++ b/lib/youseedee/__init__.py +@@ -11,10 +11,7 @@ + UCD_URL = "https://unicode.org/Public/UCD/latest/ucd/UCD.zip" + + def ucd_dir(): +- ucddir = os.path.expanduser("~/.youseedee") +- if not os.path.isdir(ucddir): +- os.mkdir(ucddir) +- return ucddir ++ return "@ucd_dir@" + + def ensure_files(): + if os.path.isfile(os.path.join(ucd_dir(), "UnicodeData.txt")): +-- +2.38.4 + diff --git a/pkgs/development/python-modules/youseedee/default.nix b/pkgs/development/python-modules/youseedee/default.nix new file mode 100644 index 000000000000..65a98c350b28 --- /dev/null +++ b/pkgs/development/python-modules/youseedee/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchPypi +, substituteAll +, requests +, unicode-character-database +}: + +buildPythonPackage rec { + pname = "youseedee"; + version = "0.4.1"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-fdI4CBUSMbdKW0qg4y22wjWI6bhotgDkQdFMc9X00as="; + }; + + patches = [ + # Load data files from the unicode-character-database package instead of + # downloading them from the internet. (nixpkgs-specific, not upstreamable) + (substituteAll { + src = ./0001-use-packaged-unicode-data.patch; + ucd_dir = "${unicode-character-database}/share/unicode"; + }) + ]; + + propagatedBuildInputs = [ + requests + ]; + + doCheck = true; + # Package has no unit tests, but we can check an example as per README.rst: + checkPhase = '' + runHook preCheck + python -m youseedee 0x078A | grep -q "'Block': 'Thaana'" + runHook postCheck + ''; + + meta = with lib; { + description = "Python library for querying the Unicode Character Database"; + homepage = "https://github.com/simoncozens/youseedee"; + license = licenses.mit; + maintainers = with maintainers; [ danc86 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 68bd58628dd1..543df1a05b1f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1772,6 +1772,8 @@ with pkgs; davinci-resolve-studio = callPackage ../applications/video/davinci-resolve { studioVariant = true; }; + dehinter = with python3Packages; toPythonApplication dehinter; + dolbybcsoftwaredecode = callPackage ../applications/audio/dolbybcsoftwaredecode { }; donkey = callPackage ../tools/security/donkey { }; @@ -1812,6 +1814,10 @@ with pkgs; ethq = callPackage ../os-specific/linux/ethq { }; + font-v = with python3Packages; toPythonApplication font-v; + + fontbakery = with python3Packages; toPythonApplication fontbakery; + weidu = callPackage ../tools/games/weidu { }; weylus = callPackage ../applications/graphics/weylus { @@ -2030,6 +2036,8 @@ with pkgs; sgrep = callPackage ../tools/text/sgrep { }; + shaperglot = with python3Packages; toPythonApplication shaperglot; + shell-genie = callPackage ../applications/misc/shell-genie { }; sloth = callPackage ../tools/misc/sloth { }; @@ -2100,6 +2108,8 @@ with pkgs; ttchat = callPackage ../tools/misc/ttchat { }; + ufolint = with python3Packages; toPythonApplication ufolint; + ukmm = callPackage ../tools/games/ukmm { }; unflac = callPackage ../tools/audio/unflac { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d285a37393a6..c731f4fd314e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1003,6 +1003,8 @@ self: super: with self; { axis = callPackage ../development/python-modules/axis { }; + axisregistry = callPackage ../development/python-modules/axisregistry { }; + azure-appconfiguration = callPackage ../development/python-modules/azure-appconfiguration { }; azure-applicationinsights = callPackage ../development/python-modules/azure-applicationinsights { }; @@ -1255,6 +1257,8 @@ self: super: with self; { babelfish = callPackage ../development/python-modules/babelfish { }; + babelfont = callPackage ../development/python-modules/babelfont { }; + babelgladeextractor = callPackage ../development/python-modules/babelgladeextractor { }; bambi = callPackage ../development/python-modules/bambi { }; @@ -1424,6 +1428,8 @@ self: super: with self; { betterproto = callPackage ../development/python-modules/betterproto { }; + beziers = callPackage ../development/python-modules/beziers { }; + bibtexparser = callPackage ../development/python-modules/bibtexparser { }; bidict = callPackage ../development/python-modules/bidict { }; @@ -2214,6 +2220,8 @@ self: super: with self; { collections-extended = callPackage ../development/python-modules/collections-extended { }; + collidoscope = callPackage ../development/python-modules/collidoscope { }; + colorama = callPackage ../development/python-modules/colorama { }; colorcet = callPackage ../development/python-modules/colorcet { }; @@ -2248,6 +2256,8 @@ self: super: with self; { comm = callPackage ../development/python-modules/comm { }; + commandlines = callPackage ../development/python-modules/commandlines { }; + commandparse = callPackage ../development/python-modules/commandparse { }; commentjson = callPackage ../development/python-modules/commentjson { }; @@ -2730,6 +2740,8 @@ self: super: with self; { defusedxml = callPackage ../development/python-modules/defusedxml { }; + dehinter = callPackage ../development/python-modules/dehinter { }; + deid = callPackage ../development/python-modules/deid { }; delegator-py = callPackage ../development/python-modules/delegator-py { }; @@ -4169,6 +4181,10 @@ self: super: with self; { fontawesomefree = callPackage ../development/python-modules/fontawesomefree { }; + fontbakery = callPackage ../development/python-modules/fontbakery { }; + + fontfeatures = callPackage ../development/python-modules/fontfeatures { }; + fontforge = toPythonModule (pkgs.fontforge.override { withPython = true; inherit python; @@ -4184,6 +4200,8 @@ self: super: with self; { fontmake = callPackage ../development/python-modules/fontmake { }; + font-v = callPackage ../development/python-modules/font-v { }; + skia-pathops = callPackage ../development/python-modules/skia-pathops { inherit (pkgs.darwin.apple_sdk.frameworks) ApplicationServices OpenGL; }; @@ -4200,8 +4218,12 @@ self: super: with self; { openstep-plist = callPackage ../development/python-modules/openstep-plist { }; + glyphsets = callPackage ../development/python-modules/glyphsets { }; + glyphslib = callPackage ../development/python-modules/glyphslib { }; + glyphtools = callPackage ../development/python-modules/glyphtools { }; + foobot-async = callPackage ../development/python-modules/foobot-async { }; foolscap = callPackage ../development/python-modules/foolscap { }; @@ -4467,6 +4489,8 @@ self: super: with self; { gflags = callPackage ../development/python-modules/gflags { }; + gflanguages = callPackage ../development/python-modules/gflanguages { }; + ghapi = callPackage ../development/python-modules/ghapi { }; ghdiff = callPackage ../development/python-modules/ghdiff { }; @@ -6050,6 +6074,8 @@ self: super: with self; { kubernetes = callPackage ../development/python-modules/kubernetes { }; + kurbopy = callPackage ../development/python-modules/kurbopy { }; + l18n = callPackage ../development/python-modules/l18n { }; labelbox = callPackage ../development/python-modules/labelbox { }; @@ -8625,6 +8651,8 @@ self: super: with self; { opentsne = callPackage ../development/python-modules/opentsne { }; + opentypespec = callPackage ../development/python-modules/opentypespec { }; + openvino = callPackage ../development/python-modules/openvino { openvino-native = pkgs.openvino.override { inherit python; @@ -8721,6 +8749,8 @@ self: super: with self; { ossfs = callPackage ../development/python-modules/ossfs { }; + ots-python = callPackage ../development/python-modules/ots-python { }; + outcome = callPackage ../development/python-modules/outcome { }; ovh = callPackage ../development/python-modules/ovh { }; @@ -12535,6 +12565,8 @@ self: super: with self; { rstcheck-core = callPackage ../development/python-modules/rstcheck-core { }; + rstr = callPackage ../development/python-modules/rstr { }; + rtmidi-python = callPackage ../development/python-modules/rtmidi-python { inherit (pkgs.darwin.apple_sdk.frameworks) CoreAudio CoreMIDI CoreServices; }; @@ -12893,6 +12925,8 @@ self: super: with self; { shapely = callPackage ../development/python-modules/shapely { }; + shaperglot = callPackage ../development/python-modules/shaperglot { }; + sharedmem = callPackage ../development/python-modules/sharedmem { }; sharkiq = callPackage ../development/python-modules/sharkiq { }; @@ -13479,6 +13513,8 @@ self: super: with self; { squarify = callPackage ../development/python-modules/squarify { }; + sre-yield = callPackage ../development/python-modules/sre-yield { }; + srp = callPackage ../development/python-modules/srp { }; srpenergy = callPackage ../development/python-modules/srpenergy { }; @@ -13599,6 +13635,8 @@ self: super: with self; { strictyaml = callPackage ../development/python-modules/strictyaml { }; + stringbrewer = callPackage ../development/python-modules/stringbrewer { }; + stringcase = callPackage ../development/python-modules/stringcase { }; stringly = callPackage ../development/python-modules/stringly { }; @@ -15289,6 +15327,8 @@ self: super: with self; { ufoLib2 = callPackage ../development/python-modules/ufoLib2 { }; + ufolint = callPackage ../development/python-modules/ufolint { }; + ufonormalizer = callPackage ../development/python-modules/ufonormalizer { }; ufoprocessor = callPackage ../development/python-modules/ufoprocessor { }; @@ -15537,6 +15577,8 @@ self: super: with self; { vg = callPackage ../development/python-modules/vg { }; + vharfbuzz = callPackage ../development/python-modules/vharfbuzz { }; + videocr = callPackage ../development/python-modules/videocr { }; vidstab = callPackage ../development/python-modules/vidstab { }; @@ -16071,6 +16113,8 @@ self: super: with self; { youless-api = callPackage ../development/python-modules/youless-api { }; + youseedee = callPackage ../development/python-modules/youseedee { }; + youtube-dl = callPackage ../tools/misc/youtube-dl { }; youtube-dl-light = callPackage ../tools/misc/youtube-dl {