Skip to content

Commit dacd1bd

Browse files
committed
Merge branch 'feature/building_updating'
2 parents a3148b9 + b5c0401 commit dacd1bd

File tree

13 files changed

+271
-5
lines changed

13 files changed

+271
-5
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
9+
jobs:
10+
pyinstaller-build-windows:
11+
name: Build Windows x64 executable
12+
runs-on: windows-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.x
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ">=3.7 <3.13"
19+
cache: 'pip'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
- name: Build with pyinstaller
25+
run: |
26+
pyinstaller -F -n XboxBackupManager-win64 -i icon.ico main.py --add-data "database/xbox360.json;database" --add-data "database/MobCatsOGXboxTitleIDs.db;database" --noconsole
27+
- name: Upload artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: XboxBackupManager-win64
31+
path: dist/XboxBackupManager-win64.exe
32+
33+
permissions:
34+
contents: write

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
build_and_release:
10+
name: Build packages and release
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: windows-latest
16+
TARGET: windows
17+
CMD_BUILD_MAIN: pyinstaller -F -n XboxBackupManager-win64 -i icon.ico main.py --add-data "database/xbox360.json;database" --add-data "database/MobCatsOGXboxTitleIDs.db;database" --noconsole
18+
CMD_BUILD_UPDATER: pyinstaller -F -n updater -i icon.ico updater.py --noconsole
19+
OUT_FILE_NAME_MAIN: XboxBackupManager-win64.exe
20+
OUT_FILE_NAME_UPDATER: updater.exe
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python 3.x
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ">=3.7 <3.13"
27+
cache: 'pip'
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
- name: Build main executable with pyinstaller for ${{matrix.TARGET}}
33+
run: ${{matrix.CMD_BUILD_MAIN}}
34+
- name: Build updater executable with pyinstaller for ${{matrix.TARGET}}
35+
run: ${{matrix.CMD_BUILD_UPDATER}}
36+
- name: Create Release
37+
uses: softprops/action-gh-release@v2
38+
with:
39+
draft: true
40+
generate_release_notes: true
41+
prerelease: false
42+
files: |
43+
dist/${{matrix.OUT_FILE_NAME_MAIN}}
44+
dist/${{matrix.OUT_FILE_NAME_UPDATER}}
45+
46+
permissions:
47+
contents: write

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: windows-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.x
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ">=3.7 <3.13"
19+
cache: 'pip'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
- name: Run black
25+
run: black . --check

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
cache/
22
__pycache__/
3-
XboxBackupManager.ini
3+
XboxBackupManager.ini
4+
build/
5+
dist/
6+
*.spec

constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
import os
2+
import sys
3+
14
APP_NAME = "Xbox and Xbox 360 Backup Manager"
25
VERSION = "0.0.0"
6+
REPO = "SavageCore/XboxBackupManager"
7+
APP_PATH = os.path.dirname(os.path.abspath(sys.executable))

database/xbox360_title_database.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import json
2-
import os
32
from typing import Dict
43

54
from PyQt6.QtCore import QObject, pyqtSignal
65

6+
from utils.resource_path import ResourcePath
7+
78

89
class TitleDatabaseLoader(QObject):
910
"""Handles loading and managing the Xbox title database"""
@@ -15,8 +16,9 @@ def __init__(self):
1516
super().__init__()
1617
self.title_database: Dict[str, str] = {}
1718

18-
def load_database(self, file_path: str = "database" + os.sep + "xbox360.json"):
19+
def load_database(self):
1920
"""Load the Xbox title database from file"""
21+
file_path = ResourcePath.get_resource_path("database/xbox360.json")
2022
try:
2123
with open(file_path, "r", encoding="utf-8") as f:
2224
database_list = json.load(f)

database/xbox_title_database.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from PyQt6.QtCore import QObject, pyqtSignal
1414

15+
from utils.resource_path import ResourcePath
16+
1517

1618
class XboxTitleDatabaseLoader(QObject):
1719
"""Loads and manages Xbox title database from SQLite"""
@@ -21,7 +23,9 @@ class XboxTitleDatabaseLoader(QObject):
2123

2224
def __init__(self):
2325
super().__init__()
24-
self.database_path = "database" + os.sep + "MobCatsOGXboxTitleIDs.db"
26+
self.database_path = ResourcePath.get_resource_path(
27+
"database/MobCatsOGXboxTitleIDs.db"
28+
)
2529
self.title_database: Dict[str, Dict[str, str]] = {}
2630
self.md5_cache: Dict[str, str] = {} # Cache MD5s to avoid recalculating
2731

main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
from constants import APP_NAME, VERSION
77
from ui.main_window import XboxBackupManager # type: ignore
8+
from utils.github import auto_update # type: ignore
89

910

1011
def main():
1112
"""Main application entry point"""
13+
# Initialize the application
1214
app = QApplication(sys.argv)
1315
app.setApplicationName(APP_NAME)
1416
app.setApplicationVersion(VERSION)
@@ -19,6 +21,9 @@ def main():
1921
except Exception:
2022
pass
2123

24+
# Check for updates
25+
auto_update()
26+
2227
window = XboxBackupManager()
2328
window.show()
2429

requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
black==25.1.0
22
darkdetect==0.8.0
3+
psutil==7.0.0
4+
pyinstaller==6.15.0
35
PyQt6==6.9.1
46
qdarkstyle==3.2.3
57
QtAwesome==1.4.0
6-
requests==2.32.5
8+
requests==2.32.5
9+
semver==3.0.4

0 commit comments

Comments
 (0)