Unverified Commit 69b1dc1e authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

typ2docx: init at 0.8.0; python3Packages.{saxonche, pdfservices-sdk}: init (#467150)

parents 3ac21fa5 6c006d39
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
{
  lib,
  python3Packages,
  fetchFromGitHub,
  fetchurl,
  rustPlatform,

  pkg-config,
  openssl,

  pandoc,
}:
python3Packages.buildPythonApplication rec {
  pname = "typ2docx";
  version = "0.8.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "sghng";
    repo = "typ2docx";
    tag = "v${version}";
    hash = "sha256-8Jb13qiS+dpyfJS4m2T6STzORs1VzRKwC8GGgEwiVtU=";
  };

  lockFile = fetchurl {
    url = "https://github.com/sghng/typ2docx/releases/download/v${version}/Cargo.lock";
    hash = "sha256-irWv7+uqNyyq42JVLSy9WQz78ynYVsYuQ8fk5nardWw=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit
      pname
      version
      src
      postPatch
      ;
    hash = "sha256-Gvdj9izGCem0A3Cy7RBzNzJ57lxk5GRP8I2C2T6RsbY=";
  };

  postPatch = ''
    ln -s ${lockFile} Cargo.lock
  '';

  nativeBuildInputs = [
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
    pkg-config
  ];

  build-system = with python3Packages; [
    uv-build
  ];

  dependencies = with python3Packages; [
    pdf2docx
    pdfservices-sdk
    pypdf
    rich
    saxonche
    typer
  ];

  buildInputs = [
    openssl
  ];

  makeWrapperArgs = [
    "--prefix"
    "PATH"
    ":"
    "${lib.makeBinPath [ pandoc ]}"
    "--prefix"
    "PYTHONPATH"
    ":"
    "$PYTHONPATH"
  ];

  passthru.updateScript = ./update.sh;

  meta = {
    description = "Convert Math-Rich Typst Project to Microsoft Word Format";
    homepage = "https://github.com/sghng/typ2docx";
    changelog = "https://github.com/sghng/typ2docx/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ hhr2020 ];
    mainProgram = "typ2docx";
  };
}
+17 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts nix-update jq gnused

set -eou pipefail

currentVersion=$(nix eval --raw -f . typ2docx.version)
latestVersion=$(curl --fail --silent ${GITHUB_TOKEN:+-H "Authorization: Bearer $GITHUB_TOKEN"} https://api.github.com/repos/sghng/typ2docx/releases/latest | jq --raw-output .tag_name | sed 's/^v//')
echo "latest  version: $latestVersion"
echo "current version: $currentVersion"

if [[ "$latestVersion" == "$currentVersion" ]]; then
  echo "package is up-to-date"
  exit 0
fi

update-source-version typ2docx $latestVersion --source-key=lockFile --ignore-same-version
nix-update typ2docx --version skip
+48 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  defusedxml,
  requests,
  sphinx,
  sphinx-rtd-theme,
}:

buildPythonPackage rec {
  pname = "pdfservices-sdk";
  version = "4.2.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "adobe";
    repo = "pdfservices-python-sdk";
    tag = "v${version}";
    hash = "sha256-m2k+IS+M8UrdrpLnk2OwRolAVq73StMY1WnxzOujBIM=";
  };

  pythonRelaxDeps = true;

  build-system = [
    setuptools
  ];

  dependencies = [
    defusedxml
    requests
    sphinx
    sphinx-rtd-theme
  ];

  pythonImportsCheck = [
    "adobe.pdfservices"
  ];

  meta = {
    description = "Adobe PDFServices Python SDK";
    homepage = "https://github.com/adobe/pdfservices-python-sdk";
    license = lib.licenses.unfree;
    maintainers = with lib.maintainers; [ hhr2020 ];
    sourceProvenance = with lib.sourceTypes; [ fromSource ];
  };
}
+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="
  }
}
Loading