Skip to content

Commit 2f00565

Browse files
Add build helper script.
1 parent 2a6ca7b commit 2f00565

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

app-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

scripts/build

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
# SET PWD TO DIRNAME OF THIS SCRIPT
4+
# this script should always be located next to
5+
# docker-compose.yml & the test_runner package
6+
# directory (containing python env & tests)
7+
current_dir=`dirname "$0"`
8+
cd $current_dir
9+
# Only use the following line if needing to enable
10+
# a python environment
11+
cd ..
12+
eval "$(direnv export bash)"
13+
14+
prefix="dist/db_wrapper-"
15+
current_version=`cat app-version`
16+
17+
# ../dist/db_wrapper-0.1.0a0-py3-none-any.whl
18+
# ../dist/db_wrapper-0.1.0a0.tar.gz
19+
20+
echo "Starting build script..."
21+
echo ""
22+
echo "Will build as version $current_version"
23+
24+
for file in "dist"/*; do
25+
file_version_and_suffix=${file#"$prefix"}
26+
if [[ $file_version_and_suffix == "$current_version.tar.gz" ]]; then
27+
echo "Found match: $file == $current_version"
28+
version_already_built=1
29+
fi
30+
done
31+
32+
if [ $version_already_built ]; then
33+
echo ""
34+
echo "Version specified in ./app-version already exists. Update version"
35+
echo "& run again, or if you want to override an already built version,"
36+
echo "run this script again, passing the override argument:"
37+
echo "./scripts/build override"
38+
39+
exit 1
40+
fi
41+
42+
echo ""
43+
python -m build

0 commit comments

Comments
 (0)