<commit_before>#!/bin/bash
#
# Positional arguments:
#  * Python major.minor version, e.g. "3.8"
#  * Python micro version and build number, separated by a dash, e.g. "1-2" (see Common.java)
#  * Maven target directory, e.g. /path/to/com/chaquo/python/target

set -eu

this_dir=$(dirname $(realpath $0))

short_ver="${1:?}"
micro_build="${2:?}"
full_ver="$short_ver.$micro_build"

mkdir -p "${3:?}"
target_dir="$(realpath $3)/$full_ver"
mkdir "$target_dir"
target_prefix="$target_dir/target-$full_ver"

tmp_dir="$target_dir/tmp"
rm -rf "$tmp_dir"
mkdir "$tmp_dir"
cd "$tmp_dir"

for toolchain_dir in $this_dir/toolchains/*; do
    abi=$(basename $toolchain_dir)
    echo "$abi"
    mkdir "$abi"
    cd "$abi"
    prefix="$toolchain_dir/sysroot/usr"
<commit_msg>Make package-target.sh create a POM file (refs #5618)<commit_after>#!/bin/bash
#
# Positional arguments:
#  * Python major.minor version, e.g. "3.8"
#  * Python micro version and build number, separated by a dash, e.g. "1-2" (see Common.java)
#  * Maven target directory, e.g. /path/to/com/chaquo/python/target

set -eu

this_dir=$(dirname $(realpath $0))

short_ver="${1:?}"
micro_build="${2:?}"
full_ver="$short_ver.$micro_build"

mkdir -p "${3:?}"
target_dir="$(realpath $3)/$full_ver"
mkdir "$target_dir"  # Fail if it already exists: we don't want to overwrite things by accident.
target_prefix="$target_dir/target-$full_ver"

cat > "$target_prefix.pom" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.chaquo.python</groupId>
    <artifactId>target</artifactId>
    <version>$full_ver</version>
    <packaging>pom</packaging>
</project>
EOF

tmp_dir="$target_dir/tmp"
rm -rf "$tmp_dir"
mkdir "$tmp_dir"
cd "$tmp_dir"

for toolchain_dir in $this_dir/toolchains/*; do
    abi=$(basename $toolchain_dir)
    echo "$abi"
    mkdir "$abi"
    cd "$abi"
    prefix="$toolchain_dir/sysroot/usr"

{'fraction_non_alphanumeric': 0.18110236220472442, 'fraction_numerical': 0.019453450671607225, 'mean_word_length': 4.1063829787234045, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 1, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2726633', 'n_tokens_mistral': 858, 'n_tokens_neox': 807, 'n_words': 168}