/
leksindn
/
passwork-python
Обзор
Документация
Войти
/
leksindn
/
passwork-python
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
deploy/pip-build
68 строк
1 KB
passwork
Версия 0.2.0
09 апр 2026, 15:58
09 апр 2026, 15:58
d6a3634
Код
Авторство
О чём код?
#!/usr/bin/env bash set -euo pipefail usage() { cat <<'EOF' Usage: ./pip-build clean # remove build artifacts ./pip-build build # install tools, build sdist/wheel, twine check REPO=testpypi ./pip-build upload # upload to TestPyPI (default REPO=pypi) ./pip-build upload # upload to PyPI REPO=pypi ./pip-build all # clean + build + upload (REPO controls destination) Notes: - Set REPO=testpypi to publish to TestPyPI, otherwise defaults to PyPI. - Ensure you have valid PyPI/TestPyPI credentials configured (API token) for twine. EOF } clean() { rm -rf dist build ./*.egg-info || true } ensure_tools() { python -m pip install --upgrade build twine >/dev/null } build_pkg() { ensure_tools python -m build twine check dist/* } upload_pkg() { ensure_tools local repo="${REPO:-pypi}" if [[ "${repo}" == "testpypi" ]]; then twine upload --repository testpypi dist/* else twine upload dist/* fi } cmd="${1:-build}" case "${cmd}" in clean) clean ;; build) clean build_pkg ;; upload) upload_pkg ;; all) clean build_pkg upload_pkg ;; -h|--help|help) usage ;; *) echo "Unknown command: ${cmd}" >&2 usage exit 1 ;; esac