Marcel Telka
2023-02-22 e137565cbc9ff7be34948eef1d302c0c6a5e463d
tools/python-integrate-project: allow to specify target directory for integration

1 files modified
15 ■■■■■ changed files
tools/python-integrate-project 15 ●●●●● patch | view | raw | blame | history
tools/python-integrate-project
@@ -26,7 +26,7 @@
function usage
{
    [[ -n "$1" ]] && printf "ERROR: %s\n\n" "$1" >&2
    printf "Usage: %s [-l VERSION] [-o OBSOLETE].. [-u] PROJECT\n" "$THIS" >&2
    printf "Usage: %s [-d DIR] [-l VERSION] [-o OBSOLETE].. [-u] PROJECT\n" "$THIS" >&2
    [[ -n "$1" ]] && exit 1
    exit 0
}
@@ -35,9 +35,11 @@
VERSION=
OBSOLETE=
UPGRADE_ONLY=0
while getopts ":hl:o:u" OPT ; do
DIRECTORY=
while getopts ":hd:l:o:u" OPT ; do
    case "$OPT" in
    "?"|"h")    usage ;;
    "d")        DIRECTORY="$OPTARG" ;;
    "l")        VERSION="$OPTARG" ;;
    "o")        OBSOLETE="$OBSOLETE $OPTARG" ;;
    "u")        UPGRADE_ONLY=1 ;;
@@ -61,8 +63,8 @@
WS_TOP=$(git rev-parse --show-toplevel 2>/dev/null)
[[ -z "$WS_TOP" ]] && usage "The script must be run in git repo"
DIR="$WS_TOP/components/python"
[[ -d "$DIR" ]] || usage "Directory $DIR not found"
BASE_DIR="$WS_TOP/components"
[[ -d "$BASE_DIR" ]] || usage "Directory $BASE_DIR not found"
# Get data from pypi
@@ -123,7 +125,8 @@
# Prepare the directory
DIR="$DIR/$DISTRIBUTION"
[[ -z "$DIRECTORY" ]] && DIRECTORY="python/$DISTRIBUTION"
DIR="$BASE_DIR/$DIRECTORY"
mkdir -p "$DIR"
cd "$DIR"
git restore --staged . > /dev/null 2>&1
@@ -501,7 +504,7 @@
    fi
    [[ -z "$MSG" ]] && MSG="rebuild"
    MSG="python/$DISTRIBUTION: $MSG"
    MSG="$DIRECTORY: $MSG"
fi
# Commit the results