Skip to content

Commit

Permalink
Move VERSION into external file 'version' #37
Browse files Browse the repository at this point in the history
  • Loading branch information
simryang committed May 9, 2024
1 parent c45bc60 commit 87381fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
REM Read version from file
set /p _version=<version
REM Trim any whitespace
for /f "tokens=*" %%a in ("%_version%") do set _version=%%a
REM Define target binary name
set target_bin_name=wizconfig_s2e_tool_%_version%
echo %target_bin_name%

REM Run PyInstaller with the specified parameters
pyinstaller.exe -w -F -n %target_bin_name% --add-data=".\\gui\\*;.\\gui" .\main_gui.py
6 changes: 6 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$_version = Get-Content .\version -Raw
$_version = $_version.Trim()
$target_bin_name = "wizconfig_s2e_tool_$_version"
Write-Output "$target_bin_name"

pyinstaller.exe -w -F -n $target_bin_name --add-data=".\\gui\\*":".\\gui" .\main_gui.py
8 changes: 6 additions & 2 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,25 @@
import webbrowser
import logging
import datetime
from pathlib import Path

# Additional package
from PyQt5 import QtCore, QtGui, uic
from PyQt5.QtWidgets import QApplication, QMainWindow, QLineEdit, QMessageBox, QTableWidgetItem, QFileDialog, QMenu, QAction, QProgressBar, QInputDialog
import ifaddr

VERSION = 'V1.5.5.1' # github 이슈 #36 수정


def resource_path(relative_path):
# Get absolute path to resource, works for dev and for PyInstaller
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)


# VERSION = 'V1.5.5.1' # github 이슈 #36 수정
VERSION = f'V{Path(resource_path("version")).read_text().strip()}'
print(f"VERSION={VERSION}")


# Load ui files
uic_logger = logging.getLogger('PyQt5.uic')
uic_logger.setLevel(logging.WARNING)
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5.5.1

0 comments on commit 87381fd

Please sign in to comment.