typ2docx: init at 0.8.0; python3Packages.{saxonche, pdfservices-sdk}: init (#467150)
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
{
|
||||
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";
|
||||
};
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"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,0 +1,54 @@
|
||||
#!/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)
|
||||
@@ -12020,6 +12020,8 @@ self: super: with self; {
|
||||
|
||||
pdfrw2 = callPackage ../development/python-modules/pdfrw2 { };
|
||||
|
||||
pdfservices-sdk = callPackage ../development/python-modules/pdfservices-sdk { };
|
||||
|
||||
pdftotext = callPackage ../development/python-modules/pdftotext { };
|
||||
|
||||
pdm-backend = callPackage ../development/python-modules/pdm-backend { };
|
||||
@@ -16957,6 +16959,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 { };
|
||||
|
||||
Reference in New Issue
Block a user