Skip to content

Commit

Permalink
Move version info into the main file to fix missing files from AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
bpozdena committed Sep 26, 2024
1 parent ac91588 commit ff7edf1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
73 changes: 44 additions & 29 deletions build_appimage.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions src/OneDriveGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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 (
Expand Down Expand Up @@ -64,7 +63,7 @@
# 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")
Expand Down
1 change: 0 additions & 1 deletion src/version.py

This file was deleted.

0 comments on commit ff7edf1

Please sign in to comment.