Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions makefiles/Makefile.python.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,18 @@ show-venv:: | check-venv
@echo "++ $@"
@echo "$(VIRTUAL_ENV)"

install-poetry::
set-pyproject-vers:: check-venv
@echo "++ $@"
# will install poetry in this venv
pip install --quiet --upgrade poetry
uv version $(VERSION)

set-pyproject-vers:: check-venv install-poetry
@echo "++ $@"
poetry version $(VERSION)

install-deps:: check-venv install-poetry
install-deps:: check-venv
@echo "++ $@"
# will install deps in this venv
poetry install --no-ansi
uv sync --frozen --dev

show-installed-deps::
@echo "++ $@"
poetry show
uv tree --locked --all-groups

check: test lint type-check
@echo "++ $@"
Expand All @@ -80,12 +75,10 @@ test-integration:: check-venv install-deps

package:: check-venv set-pyproject-vers install-deps test-all
@echo "++ $@"
poetry build --no-ansi
poetry version 0.0.0 &>/dev/null
uv build

publish:: check-venv package
@echo "++ $@"
poetry config repositories.testpypi https://test.pypi.org/legacy/
. $(ROOT_DIR)/plox-common/scripts/publish/python.sh && publish

extra-docker-args:
Expand Down
9 changes: 9 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ print_func_banner(){ local funcname="${1}"
printf "============================ Inside: %s ============================\n" "${funcname}" >&2;
}

is_default_branch(){
print_func_banner "${FUNCNAME[0]}"
if [[ "${BRANCH_NAME}" == "${DEAFULT_BRANCH}" ]]; then
echo "y"
else
echo "n"
fi
}

###
# Check whether the current commit/branch is part of a pull request.
###
Expand Down
26 changes: 0 additions & 26 deletions scripts/misc/get-pypi-pub-target

This file was deleted.

20 changes: 14 additions & 6 deletions scripts/publish/python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )


publish(){
if [[ "${GITHUB_ACTIONS:-}" == "" || "$(is_part_of_active_pr)" == "n" ]]; then
poetry publish ${PYPI_ALIAS} -vv
# allow local publishing to testpypi
if [[ "${GITHUB_ACTIONS:-}" == "" ]]; then
uv publish --index testpypi -vv
return 0
fi

if [[ "$(is_default_branch)" == "y" ]]; then
uv publish --index pypi -vv
return
else
print_info "${BRANCH_NAME} != default (${DEFAULT_BRANCH}), not publishing to main"
fi

if [[ "$(is_label_present publish-test-build)" == "y" ]]; then
poetry publish ${PYPI_ALIAS} -vv
uv publish --index testpypi -vv
else
echo "Detected part of PR but did not detect 'publish-test-build' PR label"
echo "To publish a test version of this packge, add the 'publish-test-build' label"
echo "and re-run the publish check."
print_info "Detected part of PR but did not detect 'publish-test-build' PR label"
print_info "To publish a test version of this packge, add the 'publish-test-build' label"
print_info "and re-run the publish check."
fi
}