Updated script to update package on PyPI

This commit is contained in:
Davte committed 2026-11-22 11:24:05 +01:00
1 parent 0a6328227f
commit 706e84814c
2 files changed
+49 -17

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.10.12" __version__ = "2.10.13"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"
+48 -16
View File
@@ -1,24 +1,56 @@
#!/bin/bash #!/bin/bash
set -e
# Get current directory # Get current directory
this_script_directory=$(cd "$(dirname "$0")" && pwd) this_script_directory=$(cd "$(dirname "$0")" && pwd)
packenv="";
# Python virtual environment directory: packenv variable in my_config.sh # Python virtual environment directory
source "$this_script_directory"/my_config.sh; packenv=""
# Ensure the success of importing procedure # shellcheck disable=SC1091
if [ -z "${packenv}" ]; source "${this_script_directory}/my_config.sh"
then
printf "Please set in ""my_config.sh"" the path to bot python virtual environment\n\nExample:\npackenv=""path/to/virtual/env""\n"; # Validate configuration
exit; if [ -z "$packenv" ]; then
printf 'Please set "packenv" in my_config.sh\n\nExample:\npackenv="path/to/virtual/env"\n'
exit 1
fi fi
# Push, build and publish package to pypi.org # Validate virtual environment
bash "$this_script_directory"/push_to_remotes.sh; if [ ! -x "${packenv}/bin/python" ]; then
rm -rf "$this_script_directory/build"; echo "Python executable not found: ${packenv}/bin/python"
rm -rf "$this_script_directory/dist"; exit 1
rm -rf "$this_script_directory/davtelepot.egg-info"; fi
"$packenv"/python setup.py sdist;
"$packenv"/pip wheel --no-index --no-deps --wheel-dir dist dist/*.tar.gz; python="${packenv}/bin/python"
"$packenv"/twine upload --skip-existing dist/*; twine="${packenv}/bin/twine"
if [ ! -x "$twine" ]; then
echo "Twine not found. Install it with: ${python} -m pip install twine"
exit 1
fi
# Push changes to remotes
bash "$this_script_directory/push_to_remotes.sh"
# Clean previous builds
rm -rf
"$this_script_directory/build"
"$this_script_directory/dist"
"$this_script_directory/davtelepot.egg-info"
cd "$this_script_directory" || exit 1
# Build source distribution
"${python}" setup.py sdist
# Build wheel using locally installed build dependencies
"${python}" -m pip wheel \
--no-index \
--no-deps \
--no-build-isolation \
--wheel-dir dist \
dist/*.tar.gz
# Publish to PyPI
"${twine}" upload --skip-existing dist/*