-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
# SPDX-FileCopyrightText: 2023 geisserml <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause | ||
|
||
import re | ||
import sys | ||
import json | ||
import argparse | ||
from pathlib import Path | ||
sys.path.insert(0, str(Path(__file__).parents[1])) | ||
|
@@ -21,15 +21,12 @@ def main(): | |
args.pdfium_ver = int(args.pdfium_ver) | ||
|
||
# parse existing releases to automatically handle arbitrary version builds | ||
search = run_cmd(["conda", "search", "pypdfium2_raw", "--override-channels", "-c", "pypdfium2-team"], cwd=None, capture=True) | ||
print(search, file=sys.stderr) | ||
|
||
search = [(int(v), int(b.split("_")[1])) for (v, b) in [re.split(r"\s+", l)[1:3] for l in reversed(search.split("\n")[2:])]] | ||
print(search, file=sys.stderr) | ||
search = run_cmd(["conda", "search", "--json", "pypdfium2_raw", "--override-channels", "-c", "pypdfium2-team"], cwd=None, capture=True) | ||
search = reversed(json.loads(search)["pypdfium2_raw"]) | ||
|
||
# determine build number | ||
# TODO `search` is ordered descendingly, so we could break the iteration when we find a match. though for a new version, we have to traverse the full list anyway... | ||
build = max([b for v, b in search if v == args.pdfium_ver], default=None) | ||
# TODO `search` is ordered descendingly, so we could break the iteration when we find a matching version. though for a new version, we have to traverse the full list anyway... | ||
build = max([d["build_number"] for d in search if int(d["version"]) == args.pdfium_ver], default=None) | ||
build = 0 if build is None else build+1 | ||
print(build, file=sys.stderr) | ||
|
||
|