Skip to content

Commit 9d41eba

Browse files
committed
Fixed setup_project.sh
1 parent b77cf12 commit 9d41eba

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

setup_project.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ else
2929
exit 1
3030
fi
3131

32-
# 3. Replace import in src/**/*.py
32+
# 3. Replace import in src/**/*.py and entry points
3333
# from app.main import main -> from <appname_with_underscores>.main import main
34+
# Also replace "app.main:main" -> "<appname_with_underscores>.main:main" in pyproject.toml
3435

3536
find src -type f -name "*.py" -print0 | while IFS= read -r -d '' file; do
3637
LC_ALL=C sed -i.bak \
@@ -39,6 +40,12 @@ find src -type f -name "*.py" -print0 | while IFS= read -r -d '' file; do
3940
rm -f "${file}.bak"
4041
done
4142

43+
# Replace app.main:main entry point in pyproject.toml
44+
if [[ -f "pyproject.toml" ]]; then
45+
LC_ALL=C sed -i.bak "s/app\.main:main/${APPNAME_UNDERSCORE}.main:main/g" "pyproject.toml"
46+
rm -f "pyproject.toml.bak"
47+
fiand entry points
48+
4249

4350
echo "Done:"
4451
echo " Replaced 'template-python' → '${APPNAME}'"

0 commit comments

Comments
 (0)