Skip to content

Instantly share code, notes, and snippets.

@alichherawalla
Last active September 6, 2023 11:33
Show Gist options
  • Save alichherawalla/4fc6259a4fd9ca7e5b31c7257685502f to your computer and use it in GitHub Desktop.
Save alichherawalla/4fc6259a4fd9ca7e5b31c7257685502f to your computer and use it in GitHub Desktop.
This script will create a distributable python library
#!/bin/bash
python3 -m pip install wheel
python3 setup.py bdist_wheel
export "BUCKET_NAME=$(yq e '.bucket_name' config/properties.yml)"
for JOB_DIR in ./src/jobs/job*; do
JOB_NAME_RAW=$(basename $JOB_DIR)
JOB_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${JOB_NAME_RAW:0:1})${JOB_NAME_RAW:1}" # Capitalizing the first letter
YAML_PATH=".Resources.Glue${JOB_NAME}.Properties.DefaultArguments"
key="--extra-py-files"
value="s3://$BUCKET_NAME/lib/$1"
yq_command="yq e '$YAML_PATH.\"$key\" = \"$value\"' -i assets/output.yaml"
eval $yq_command
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment