port: advance MSVC600 CPython compatibility frontier
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Generate the CPython frozen getpath.py header into ignored build output.
|
||||
#
|
||||
# CPython's build documents this target in Makefile.pre.in:
|
||||
# Python/frozen_modules/getpath.h: Modules/getpath.py ...
|
||||
# Programs/_freeze_module.py getpath Modules/getpath.py Python/frozen_modules/getpath.h
|
||||
#
|
||||
# This script intentionally writes under build/generated/cpython/... so the
|
||||
# repository does not track generated bytecode headers or vendor files.
|
||||
#
|
||||
# Usage:
|
||||
# scripts/generate-getpath-frozen.sh [output-root]
|
||||
#
|
||||
# Output:
|
||||
# <output-root>/cpython/Python/frozen_modules/getpath.h
|
||||
# default output-root: build/generated
|
||||
|
||||
set -u
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CPYTHON_ROOT="$REPO_ROOT/cpython"
|
||||
OUTPUT_ROOT="${1:-$REPO_ROOT/build/generated}"
|
||||
OUT_DIR="$OUTPUT_ROOT/cpython/Python/frozen_modules"
|
||||
OUT_HEADER="$OUT_DIR/getpath.h"
|
||||
FREEZE_SCRIPT="$CPYTHON_ROOT/Programs/_freeze_module.py"
|
||||
INPUT="$CPYTHON_ROOT/Modules/getpath.py"
|
||||
|
||||
usage() {
|
||||
sed -n '11,19p' "$REPO_ROOT/scripts/generate-getpath-frozen.sh"
|
||||
}
|
||||
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for required in "$CPYTHON_ROOT" "$FREEZE_SCRIPT" "$INPUT"; do
|
||||
if [ ! -e "$required" ]; then
|
||||
echo "generate-getpath-frozen: missing prerequisite: $required" >&2
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "generate-getpath-frozen: missing prerequisite: python3" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
python3 "$FREEZE_SCRIPT" getpath "$INPUT" "$OUT_HEADER"
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo "generate-getpath-frozen: _freeze_module.py failed with exit $status" >&2
|
||||
exit "$status"
|
||||
fi
|
||||
|
||||
if [ ! -s "$OUT_HEADER" ]; then
|
||||
echo "generate-getpath-frozen: expected nonempty output missing: $OUT_HEADER" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
printf '%s\n' "${OUT_HEADER#$REPO_ROOT/}"
|
||||
Reference in New Issue
Block a user