-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRIVERS-3032 Add standalone clis for top level python scripts (#552)
- Loading branch information
Showing
12 changed files
with
189 additions
and
84 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
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,60 @@ | ||
#!/usr/bin/env bash | ||
# Install the drivers orchestration scripts. | ||
|
||
set -eux | ||
|
||
if [ -z "$BASH" ]; then | ||
echo "install-cli.sh must be run in a Bash shell!" 1>&2 | ||
return 1 | ||
fi | ||
|
||
if [ -z "${1:-}" ]; then | ||
echo "Must give a target directory!" | ||
fi | ||
|
||
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) | ||
. $SCRIPT_DIR/handle-paths.sh | ||
|
||
pushd $SCRIPT_DIR | ||
|
||
# Ensure pipx is writing assets to a contained location. | ||
export UV_CACHE_DIR=${DRIVERS_TOOLS}/.local/uv-cache | ||
export UV_TOOL_DIR=${DRIVERS_TOOLS}/.local/uv-tool | ||
|
||
. ./venv-utils.sh | ||
|
||
if [ ! -d $SCRIPT_DIR/venv ]; then | ||
|
||
. ./find-python3.sh | ||
|
||
echo "Ensuring python binary..." | ||
PYTHON=$(ensure_python3 2>/dev/null) | ||
echo "Ensuring python binary... done." | ||
|
||
echo "Creating virtual environment 'venv'..." | ||
venvcreate "${PYTHON:?}" venv | ||
echo "Creating virtual environment 'venv'... done." | ||
|
||
python -m pip install uv | ||
else | ||
venvactivate venv | ||
fi | ||
|
||
pushd $1 | ||
|
||
# On Windows, we have to do a bit of path manipulation. | ||
if [ "Windows_NT" == "${OS:-}" ]; then | ||
TMP_DIR=$(cygpath -m "$(mktemp -d)") | ||
PATH="$SCRIPT_DIR/venv/Scripts:$PATH" | ||
UV_TOOL_BIN_DIR=${TMP_DIR} uv tool install --force --editable . | ||
filenames=$(ls ${TMP_DIR}) | ||
for filename in $filenames; do | ||
mv $TMP_DIR/$filename "$1/${filename//.exe/}" | ||
done | ||
rm -rf $TMP_DIR | ||
else | ||
UV_TOOL_BIN_DIR=$(pwd) uv tool install --python "$(which python)" --force --editable . | ||
fi | ||
|
||
popd | ||
popd |
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
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,28 @@ | ||
[build-system] | ||
requires = ["hatchling>=1.26"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "drivers-evergreen-tools" | ||
version = "0.1.0" | ||
description = 'Scripts for drivers-evergreen-tools' | ||
requires-python = ">=3.8" | ||
license = "MIT" | ||
keywords = [] | ||
authors = [ | ||
{ name = "Steven Silvester", email = "[email protected]" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
] | ||
dependencies = [] | ||
|
||
[project.scripts] | ||
mongodl = "mongodl:main" | ||
mongosh-dl = "mongosh_dl:main" | ||
socks5srv = "socks5srv:main" | ||
|
||
[tool.hatch.build] | ||
include = ["mongodl.py", "mongosh_dl.py", "socks5srv.py"] |
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
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,64 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Test mongodl and mongosh_dl. | ||
set -eux | ||
|
||
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) | ||
. $SCRIPT_DIR/../handle-paths.sh | ||
|
||
pushd $SCRIPT_DIR/.. | ||
|
||
bash install-cli.sh . | ||
DOWNLOAD_DIR=mongodl_test | ||
|
||
./socks5srv --help | ||
./mongodl --help | ||
./mongosh-dl --help | ||
|
||
# Make sure we can install again. | ||
bash install-cli.sh . | ||
|
||
if [ "${OS:-}" != "Windows_NT" ]; then | ||
./mongodl --edition enterprise --version 7.0 --component archive-debug --no-download | ||
else | ||
DOWNLOAD_DIR=$(cygpath -m $DOWNLOAD_DIR) | ||
fi | ||
|
||
./mongodl --edition enterprise --version 7.0 --component archive --test | ||
./mongodl --edition enterprise --version 7.0 --component cryptd --out ${DOWNLOAD_DIR} --strip-path-components 1 | ||
./mongosh-dl --no-download | ||
./mongosh-dl --version 2.1.1 --no-download | ||
|
||
export PATH="${DOWNLOAD_DIR}/bin:$PATH" | ||
if [ "${OS:-}" != "Windows_NT" ]; then | ||
./mongosh-dl --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1 | ||
chmod +x ./mongodl_test/bin/mongosh | ||
./mongodl_test/bin/mongosh --version | ||
else | ||
./mongosh-dl --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1 | ||
fi | ||
|
||
if [ ${1:-} == "partial" ]; then | ||
popd | ||
make -C ${DRIVERS_TOOLS} test | ||
exit 0 | ||
fi | ||
|
||
# Ensure that all distros are accounted for in DISTRO_ID_TO_TARGET | ||
export VALIDATE_DISTROS=1 | ||
./mongodl --list | ||
./mongodl --edition enterprise --version 7.0.6 --component archive --no-download | ||
./mongodl --edition enterprise --version 3.6 --component archive --test | ||
./mongodl --edition enterprise --version 4.0 --component archive --test | ||
./mongodl --edition enterprise --version 4.2 --component archive --test | ||
./mongodl --edition enterprise --version 4.4 --component archive --test | ||
./mongodl --edition enterprise --version 5.0 --component archive --test | ||
./mongodl --edition enterprise --version 6.0 --component crypt_shared --test | ||
./mongodl --edition enterprise --version 8.0 --component archive --test | ||
./mongodl --edition enterprise --version rapid --component archive --test | ||
./mongodl --edition enterprise --version latest --component archive --out ${DOWNLOAD_DIR} | ||
./mongodl --edition enterprise --version v6.0-perf --component cryptd --test | ||
./mongodl --edition enterprise --version v8.0-perf --component cryptd --test | ||
|
||
popd | ||
make -C ${DRIVERS_TOOLS} test |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.