Commit a3a919e2 authored by HHR2020's avatar HHR2020
Browse files

python3Packages.saxonche: init at 12.9.0



Co-authored-by: default avatardotlambda <github@dotlambda.de>
parent 324a174e
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
{
  lib,
  autoPatchelfHook,
  buildPythonPackage,
  fetchPypi,
  python,
  stdenv,
  zlib,
}:
let
  pythonVersionNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
  inherit (stdenv.hostPlatform) system;
  releases = lib.importJSON ./releases.json;
in
buildPythonPackage rec {
  pname = "saxonche";
  inherit (releases) version;
  format = "wheel";

  src = fetchPypi {
    pname = "saxonche";
    inherit version;
    format = "wheel";
    python = "cp${pythonVersionNoDot}";
    abi = "cp${pythonVersionNoDot}";
    dist = "cp${pythonVersionNoDot}";
    platform = releases."cp${pythonVersionNoDot}-${system}".platform or (throw "unsupported system");
    hash = releases."cp${pythonVersionNoDot}-${system}".hash or (throw "unsupported system");
  };

  dontBuild = true;

  nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];

  buildInputs = [
    zlib
  ];

  pythonImportsCheck = [ "saxonche" ];

  passthru.updateScript = ./update.py;

  meta = {
    description = "Official Python package for the SaxonC-HE processor";
    homepage = "https://www.saxonica.com/saxon-c/index.xml";
    license = lib.licenses.unfree;
    maintainers = with lib.maintainers; [ hhr2020 ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
  };
}
+99 −0
Original line number Diff line number Diff line
{
  "version": "12.9.0",
  "cp310-x86_64-darwin": {
    "platform": "macosx_10_11_x86_64",
    "hash": "sha256-SnYpDIY8EFfSkb3BynBB4ZH0+nZyPuWLNPXWR1CIMLY="
  },
  "cp310-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-3o9mr1BFQLZZCcpDZBxMmt88FD7XHJEBuJegXYBjaak="
  },
  "cp310-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-8nTz+9AWp4sle4wahXJKZL72OMfAP+moTJXBH3ILn5U="
  },
  "cp310-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-ITbgS01T8huu8QAUw2SHSCQgWdeoghX+UAsOVL2c4ww="
  },
  "cp311-x86_64-darwin": {
    "platform": "macosx_10_11_x86_64",
    "hash": "sha256-C+swRRRBF43QEVkjQp/0M00phpr+/PcDoesjIEuuS8o="
  },
  "cp311-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-DlHMuRRdBtkYdEGok8PomfSHcRXHuVpqKCM4rek5prg="
  },
  "cp311-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-ZWN2m242Q8u/cZ8rHzipx0YdfY3elQGnfFuFbCemGOI="
  },
  "cp311-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-hlqyyA2T1wSBZmKdE0KJ4TY+wUd3ADuTd5pFeY5C4MY="
  },
  "cp312-x86_64-darwin": {
    "platform": "macosx_10_11_x86_64",
    "hash": "sha256-wDl0O7SuQgqkzar66IBIqXNdP6jns9iS0orklSjbo7E="
  },
  "cp312-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-mXKva5ajdH5Lb6enbgNtK8SDEI3HH+ufeA7OUeNOBr4="
  },
  "cp312-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-Us12nO+baJ731z1Jfs/Lr3m+CuH1GtcZDMK6awsFw/E="
  },
  "cp312-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-SQ8w6UhnUPagZt4rRnEU39bhTSPIzmRcrWTmY/WASQo="
  },
  "cp313-x86_64-darwin": {
    "platform": "macosx_10_11_x86_64",
    "hash": "sha256-pnAVA41KuwOaUbk1ry6YaoMTj5/ibIPyiOlydkS/g9c="
  },
  "cp313-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-uqw/nArOticdA6hwBfbFMaq6wjserj7ssdxl1/iBfpE="
  },
  "cp313-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-Wxap5a54viT4PaaixeaYtZyk3o9ogAIvBRNRFwtp+dA="
  },
  "cp313-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-t9KV3erj58NVz1MDXsR6HbMBqLm8kXY2+JO1ajGkgYc="
  },
  "cp314-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-O0UUZ3D2RZ4QxwkR/SjodB/NLN4HtTY58gCPmNWxUGc="
  },
  "cp314-x86_64-darwin": {
    "platform": "macosx_11_0_x86_64",
    "hash": "sha256-y1k0A3c3+3ly9T6UCBZfGHxOzqXvIT/NvCG3hvRnp4Q="
  },
  "cp314-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-oaebbnE665TMMIFSU73pbG36vo6m8hSWntDkrmCYD2g="
  },
  "cp314-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-tq0/kHqHERdyuIexF1QrT9AwJTwjaxu3GQKXLO/PVdo="
  },
  "cp39-x86_64-darwin": {
    "platform": "macosx_10_11_x86_64",
    "hash": "sha256-FhKq8g/NedtAhhVoxxJqIg3iPreWXJQXM6CADOQmqts="
  },
  "cp39-aarch64-darwin": {
    "platform": "macosx_11_0_arm64",
    "hash": "sha256-9zNMcbScwKokc+sXvM1GH4GBE3Nsvm8kl/KKNbCqOxQ="
  },
  "cp39-aarch64-linux": {
    "platform": "manylinux_2_24_aarch64",
    "hash": "sha256-+fpWZqMiOOUJpLpEDYXF8aIHhq9Hn8wlXqYc5Cb9NHc="
  },
  "cp39-x86_64-linux": {
    "platform": "manylinux_2_24_x86_64",
    "hash": "sha256-37G/UxcYnNQKbaxJaN8D4TuA2UbDJK/EgAlx4G/3VP0="
  }
}
+54 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p 'python3.withPackages(ps: [ps.requests ps.packaging])'
import json
import requests
from pathlib import Path
from packaging.utils import parse_wheel_filename
import base64

HERE = Path(__file__).parent


def write_release(releases):
    with HERE.joinpath("releases.json").open("w") as fd:
        json.dump(releases, fd, indent=2)
        fd.write("\n")


wheels = {}

resp = requests.get("https://pypi.org/pypi/saxonche/json")
assert resp.status_code == 200
resp = resp.json()
version = resp["info"]["version"]
wheels["version"] = version

for file in resp["urls"]:
    python_version: str = file["python_version"]  # for example "cp310"
    _, _, _, tags = parse_wheel_filename(file["filename"])
    (tag,) = tags  # There should only be one tag, take it from the frozenset
    platform = tag.platform

    if "x86_64" in platform:
        isa = "x86_64"
    elif "arm64" in platform or "aarch64" in platform:
        isa = "aarch64"
    else:
        continue

    if "macosx" in platform:
        os = "darwin"
    elif "manylinux" in platform:
        os = "linux"
    else:
        continue

    hex_hash: str = file["digests"]["sha256"]
    sri_hash = f"sha256-{base64.b64encode(bytes.fromhex(hex_hash)).decode('utf-8')}"

    wheels[f"{python_version}-{isa}-{os}"] = {
        "platform": platform,
        "hash": sri_hash,
    }

write_release(wheels)
+2 −0
Original line number Diff line number Diff line
@@ -16955,6 +16955,8 @@ self: super: with self; {
  satel-integra = callPackage ../development/python-modules/satel-integra { };
  saxonche = callPackage ../development/python-modules/saxonche { };
  sbom2dot = callPackage ../development/python-modules/sbom2dot { };
  sbom4files = callPackage ../development/python-modules/sbom4files { };