Skip to content

Commit 617978b

Browse files
committed
Preliminary poetry packaging script
Using Maven to perform the string filtering, a.k.a substituting the placeholder with the actual package version in __init__.py.
1 parent 0d172e1 commit 617978b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

poetry-build.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")"
6+
7+
STATUS=$(git status --porcelain)
8+
9+
if [ -n "$STATUS" ]; then
10+
echo "===================================================================="
11+
echo "=============== ERROR: repository unclean, stopping! ==============="
12+
echo "===================================================================="
13+
echo
14+
git status
15+
echo
16+
echo "===================================================================="
17+
echo "=============== ERROR: repository unclean, stopping! ==============="
18+
echo "===================================================================="
19+
exit 1
20+
fi
21+
22+
# clean up old poetry artifacts:
23+
rm -rf dist/
24+
# clean up old maven artifacts:
25+
rm -rf target/
26+
# clean up potential leftovers from previous runs of this script:
27+
rm -rf sjlogging/
28+
29+
# call maven to perform the "string-filtering" which will substitute the version
30+
# placeholder in __init__.py by the (maven-derived) version string:
31+
mvn process-resources
32+
33+
# move the string-filtered source tree to the project root, so poetry will pick
34+
# it up automatically from there (without explicit configuration):
35+
mv target/classes/sjlogging/ .
36+
37+
# let poetry build the wheel (and tar.gz)
38+
poetry build -vv
39+
40+
# remove the string-filtered source tree:
41+
rm -rf sjlogging/

0 commit comments

Comments
 (0)