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