1
0
mirror of https://github.com/bpozdena/OneDriveGUI.git synced 2025-04-19 04:22:15 +03:00

Move version info into the main file to fix missing files from AUR

This commit is contained in:
Boris Pozdena 2024-09-26 15:24:43 +02:00
parent ac91588a9a
commit ff7edf1514
4 changed files with 46 additions and 33 deletions

View File

@ -37,5 +37,5 @@ If applicable, add relevant output from log file `/tmp/onedrive-gui/onedrive-gui
- Version of OneDrive client: [e.g. 2.5.0]
**OneDriveGUI info**
How did you install OneDriveGUI?: [e.g. AppImage]
How did you install OneDriveGUI?: [e.g. AppImage, AUR(package name), etc.]
What is the name of the AppImage file (if applicable)? : [e.g. OneDriveGUI-1.1.0-x86_64.AppImage ]

View File

@ -1,37 +1,52 @@
#!/bin/bash
# Step 1: Extract version from src/version.py
VERSION=$(python3 -c "from src.version import __version__; print(__version__)")
if [ -z "$VERSION" ]; then
echo "Failed to extract version from src/version.py"
exit 1
fi
echo "Extracted version: $VERSION"
# Step 1: Function to extract version from OneDriveGUI.py without importing
get_version() {
FILE_PATH="src/OneDriveGUI.py"
VERSION=$(grep -Po '^__version__\s*=\s*"\K[^\"]+' "$FILE_PATH")
if [ -z "$VERSION" ]; then
echo "Failed to extract version from $FILE_PATH"
exit 1
fi
echo "Extracted version: $VERSION"
}
# Step 2: Update the indented version line in AppImageBuilder.yml
YAML_FILE="AppImageBuilder.yml"
if [ -f "$YAML_FILE" ]; then
echo "Updating version in $YAML_FILE..."
# Use sed to match the indented version line (e.g., " version: 1.1.0") and update it
sed -i "s/^\(\s\+version:\s\).*/\1$VERSION/" "$YAML_FILE"
echo "Version updated to $VERSION in the indented version line of $YAML_FILE"
else
echo "$YAML_FILE not found."
exit 1
fi
update_yaml() {
YAML_FILE="AppImageBuilder.yml"
if [ -f "$YAML_FILE" ]; then
echo "Updating version in $YAML_FILE..."
# Use sed to match the indented version line and update it
sed -i "s/^\(\s\+version:\s\).*/\1$VERSION/" "$YAML_FILE"
echo "Version updated to $VERSION in the indented version line of $YAML_FILE"
else
echo "$YAML_FILE not found."
exit 1
fi
}
# Step 3: Build the AppImage using appimage-builder
if ! command -v appimage-builder &> /dev/null; then
echo "appimage-builder could not be found. Please install it first."
exit 1
fi
build_appimage() {
if ! command -v appimage-builder &> /dev/null; then
echo "appimage-builder could not be found. Please install it first."
exit 1
fi
echo "Building AppImage..."
appimage-builder --recipe "$YAML_FILE"
echo "Building AppImage..."
appimage-builder --recipe "$YAML_FILE"
if [ $? -eq 0 ]; then
echo "AppImage build succeeded!"
else
echo "AppImage build failed."
exit 1
fi
if [ $? -eq 0 ]; then
echo "AppImage build succeeded!"
else
echo "AppImage build failed."
exit 1
fi
}
# Main script execution
get_version
update_yaml
build_appimage

View File

@ -11,7 +11,6 @@ import copy
import logging.handlers as handlers
from configparser import ConfigParser
from version import __version__
from PySide6.QtCore import QThread, QTimer, QUrl, Signal, QFileInfo, Qt
from PySide6.QtGui import QIcon, QPixmap, QDesktopServices
from PySide6.QtWidgets import (
@ -64,7 +63,7 @@ from ui.ui_external_login import Ui_ExternalLoginWindow
# except ImportError:
# logging.warning("Failed to import ui_login. This is expected if you are running AppImage version.")
__version__ = "1.1.1"
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
PROFILES_FILE = os.path.expanduser("~/.config/onedrive-gui/profiles")
GUI_SETTINGS_FILE = os.path.expanduser("~/.config/onedrive-gui/gui_settings")

View File

@ -1 +0,0 @@
__version__ = "1.1.1"