[U] Update deploy-pypi to support pyproject.toml
This commit is contained in:
+43
-11
@@ -3,18 +3,50 @@
|
|||||||
# Stop on error
|
# Stop on error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Check if setup.py is present
|
# 1. Legacy Setup.py method
|
||||||
[[ ! -f "setup.py" ]] && echo "Setup.py not found, please make sure you're in the correct path" && exit -1
|
deploy_setup_py() {
|
||||||
|
|
||||||
# Remove old build
|
# Check if setup.py is present
|
||||||
rm -rf dist
|
[[ ! -f "setup.py" ]] && echo "Setup.py not found, please make sure you're in the correct path" && exit 4
|
||||||
rm -rf build
|
|
||||||
|
|
||||||
# Build
|
# Remove old build
|
||||||
python setup.py sdist bdist_wheel
|
rm -rf dist
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
# Check built files
|
# Build
|
||||||
twine check dist/*
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
# Upload
|
# Check built files
|
||||||
twine upload dist/*
|
twine check dist/*
|
||||||
|
|
||||||
|
# Upload
|
||||||
|
twine upload dist/*
|
||||||
|
}
|
||||||
|
|
||||||
|
# 2. New pyproject.toml method
|
||||||
|
deploy_pyproject() {
|
||||||
|
|
||||||
|
# Check if pyproject.toml is present
|
||||||
|
[[ ! -f "pyproject.toml" ]] && echo "pyproject.toml not found, please make sure you're in the correct path" && exit 4
|
||||||
|
|
||||||
|
# Remove old build
|
||||||
|
rm -rf dist
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
|
# Build
|
||||||
|
pip install pip-tools build twine
|
||||||
|
python -m build
|
||||||
|
|
||||||
|
# Check built files
|
||||||
|
twine check dist/*
|
||||||
|
|
||||||
|
# Upload
|
||||||
|
twine upload dist/*
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check which file is present
|
||||||
|
if [[ -f "setup.py" ]]; then
|
||||||
|
deploy_setup_py
|
||||||
|
elif [[ -f "pyproject.toml" ]]; then
|
||||||
|
deploy_pyproject
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user