-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create list-versions.py and download-and-unpackage.sh
- Loading branch information
Showing
4 changed files
with
70 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Positional arguments: | ||
# * `prefix` directory to unpack into | ||
# * Version to download, including build number | ||
|
||
this_dir=$(cd $(dirname $0) && pwd) | ||
prefix_dir=$(cd ${1:?} && pwd) | ||
version=${2:?} | ||
|
||
tmp_dir="/tmp/download-and-unpackage-$$" | ||
version_dir=$tmp_dir/$version | ||
mkdir -p $version_dir | ||
cd $version_dir | ||
wget -r -l1 --no-directories --accept .zip -e robots=off --user-agent Mozilla/5.0 \ | ||
https://repo.maven.apache.org/maven2/com/chaquo/python/target/$version | ||
|
||
echo | ||
echo Unpacking: | ||
$this_dir/unpackage-target.sh $prefix_dir $version_dir | ||
|
||
rm -rf $tmp_dir |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
from os.path import abspath, dirname | ||
import re | ||
|
||
parser = argparse.ArgumentParser() | ||
mode_group = parser.add_mutually_exclusive_group(required=True) | ||
mode_group.add_argument("--short", action="store_true") | ||
mode_group.add_argument("--long", action="store_true") | ||
args = parser.parse_args() | ||
|
||
product_dir = abspath(f"{dirname(__file__)}/../product") | ||
for line in open(f"{product_dir}/buildSrc/src/main/java/com/chaquo/python/Common.java"): | ||
match = re.search(r'PYTHON_VERSIONS.put\("(\d+)\.(\d+)\.(\d+)", "(\d+)"\)', line) | ||
if match: | ||
major, minor, micro, build = match.groups() | ||
if args.short: | ||
print(f"{major}.{minor}") | ||
elif args.long: | ||
print(f"{major}.{minor}.{micro}-{build}") | ||
else: | ||
raise AssertionError() | ||
|
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