feat: Update version retrieval to prioritize _version.py

This commit is contained in:
Lloyd
2026-01-07 13:48:00 +00:00
parent 1d45ebf8f3
commit 91dccb72d5

View File

@@ -72,7 +72,10 @@ is_running() {
# Function to get current version
get_version() {
if [ -f "$INSTALL_DIR/pyproject.toml" ]; then
# Try to read from _version.py first (generated by setuptools_scm)
if [ -f "$INSTALL_DIR/repeater/_version.py" ]; then
grep "^__version__ = version = " "$INSTALL_DIR/repeater/_version.py" | cut -d"'" -f2 2>/dev/null || echo "unknown"
elif [ -f "$INSTALL_DIR/pyproject.toml" ]; then
grep "^version" "$INSTALL_DIR/pyproject.toml" | cut -d'"' -f2 2>/dev/null || echo "unknown"
else
echo "not installed"
@@ -226,7 +229,8 @@ install_repeater() {
# Generate version file using setuptools_scm before copying
if [ -d .git ]; then
git fetch --tags 2>/dev/null || true
python3 -m setuptools_scm 2>/dev/null || true
# Write the version file that will be copied
python3 -c "from setuptools_scm import get_version; get_version(write_to='repeater/_version.py', local_scheme='no-local-version')" 2>/dev/null || true
fi
echo "30"; echo "# Installing files..."
@@ -392,7 +396,8 @@ upgrade_repeater() {
# Generate version file using setuptools_scm before copying
if [ -d .git ]; then
git fetch --tags 2>/dev/null || true
python3 -m setuptools_scm 2>/dev/null || true
# Write the version file that will be copied
python3 -c "from setuptools_scm import get_version; get_version(write_to='repeater/_version.py', local_scheme='no-local-version')" 2>/dev/null || true
fi
echo " ✓ Version file generated"