Skip to content

Commit 405fa26

Browse files
authored
Merge pull request #985 from mathoudebine/dev/add-linux-binaries-for-release
2 parents ea76caf + 1fc58c9 commit 405fa26

File tree

10 files changed

+128
-54
lines changed

10 files changed

+128
-54
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Generate Linux Packages
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
generate-windows-installer:
12+
name: Generate Linux Packages
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Git Checkout ${{github.event.release.tag_name}}
17+
uses: actions/checkout@v6
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: '3.14'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install -r requirements.txt
28+
29+
- name: Run PyInstaller to create binaries
30+
run: |
31+
pyinstaller --noconfirm turing-system-monitor.spec
32+
echo "${{github.event.release.tag_name}}" > ./dist/turing-system-monitor/version.txt
33+
ln -s configure ./dist/turing-system-monitor/turing-smart-screen
34+
35+
- name: Create archive from generated binaries
36+
run: |
37+
rm -rf "./dist/turing-system-monitor/res/themes/--Theme examples"
38+
tar -czvf "turing-system-monitor-${{github.event.release.tag_name}}-linux.tar.gz" -C "./dist/turing-system-monitor/" .
39+
40+
- name: '📦 Archive Linux binaries'
41+
uses: actions/upload-artifact@v7
42+
with:
43+
name: turing-system-monitor-${{github.event.release.tag_name}}-linux
44+
path: turing-system-monitor-${{github.event.release.tag_name}}-linux.tar.gz
45+
if-no-files-found: error
46+
47+
- name: '📩 Publish Linux binaries to Release'
48+
run: |
49+
gh release upload ${{github.event.release.tag_name}} turing-system-monitor-${{github.event.release.tag_name}}-linux.tar.gz
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/generate-windows-packages-debug.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,30 @@ jobs:
4444
- name: Create portable zip archive from generated binaries
4545
run: |
4646
Remove-Item -r ".\dist\turing-system-monitor\res\themes\--Theme examples\"
47-
7z a -tzip turing-system-monitor-${{github.event.release.tag_name}}-portable-debug.zip ".\dist\turing-system-monitor"
47+
7z a -tzip turing-system-monitor-${{github.event.release.tag_name}}-debug-portable-windows.zip ".\dist\turing-system-monitor"
4848
4949
- name: '📦 Archive Windows installer'
5050
uses: actions/upload-artifact@v7
5151
with:
52-
name: turing-system-monitor-${{github.event.release.tag_name}}-debug
53-
path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug.exe
52+
name: turing-system-monitor-${{github.event.release.tag_name}}-debug-windows
53+
path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug-windows.exe
5454
if-no-files-found: error
5555

5656
- name: '📦 Archive Windows portable archive'
5757
uses: actions/upload-artifact@v7
5858
with:
59-
name: turing-system-monitor-${{github.event.release.tag_name}}-portable-debug
60-
path: turing-system-monitor-${{github.event.release.tag_name}}-portable-debug.zip
59+
name: turing-system-monitor-${{github.event.release.tag_name}}-debug-portable-windows
60+
path: turing-system-monitor-${{github.event.release.tag_name}}-debug-portable-windows.zip
6161
if-no-files-found: error
6262

6363
- name: '📩 Publish Windows installer to Release'
6464
run: |
65-
gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug.exe
65+
gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug-windows.exe
6666
env:
6767
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6868

6969
- name: '📩 Publish Windows portable zip to Release'
7070
run: |
71-
gh release upload ${{github.event.release.tag_name}} turing-system-monitor-${{github.event.release.tag_name}}-portable-debug.zip
71+
gh release upload ${{github.event.release.tag_name}} turing-system-monitor-${{github.event.release.tag_name}}-debug-portable-windows.zip
7272
env:
7373
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/generate-windows-packages.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,30 @@ jobs:
4444
- name: Create portable zip archive from generated binaries
4545
run: |
4646
Remove-Item -r ".\dist\turing-system-monitor\res\themes\--Theme examples\"
47-
7z a -tzip turing-system-monitor-${{github.event.release.tag_name}}-portable.zip ".\dist\turing-system-monitor"
47+
7z a -tzip turing-system-monitor-${{github.event.release.tag_name}}-portable-windows.zip ".\dist\turing-system-monitor"
4848
4949
- name: '📦 Archive Windows installer'
5050
uses: actions/upload-artifact@v7
5151
with:
52-
name: turing-system-monitor-${{github.event.release.tag_name}}
53-
path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}.exe
52+
name: turing-system-monitor-${{github.event.release.tag_name}}-windows
53+
path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-windows.exe
5454
if-no-files-found: error
5555

5656
- name: '📦 Archive Windows portable archive'
5757
uses: actions/upload-artifact@v7
5858
with:
59-
name: turing-system-monitor-${{github.event.release.tag_name}}-portable
60-
path: turing-system-monitor-${{github.event.release.tag_name}}-portable.zip
59+
name: turing-system-monitor-${{github.event.release.tag_name}}-portable-windows
60+
path: turing-system-monitor-${{github.event.release.tag_name}}-portable-windows.zip
6161
if-no-files-found: error
6262

6363
- name: '📩 Publish Windows installer to Release'
6464
run: |
65-
gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}.exe
65+
gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-windows.exe
6666
env:
6767
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6868

6969
- name: '📩 Publish Windows portable zip to Release'
7070
run: |
71-
gh release upload ${{github.event.release.tag_name}} turing-system-monitor-${{github.event.release.tag_name}}-portable.zip
71+
gh release upload ${{github.event.release.tag_name}} turing-system-monitor-${{github.event.release.tag_name}}-portable-windows.zip
7272
env:
7373
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ dmypy.json
140140
screencap.png
141141
tmp
142142

143+
version.txt
143144
external/LibreHardwareMonitor/LibreHardwareMonitorLib.sys

configure.py

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@
163163

164164
MAIN_DIRECTORY = Path(__file__).resolve().parent
165165
THEMES_DIR = MAIN_DIRECTORY / "res/themes"
166+
VERSION_FILE = MAIN_DIRECTORY / "version.txt"
166167

167168
circular_mask = Image.open(MAIN_DIRECTORY / "res/backgrounds/circular-mask.png")
169+
DISABLED_COLOR = "#C0C0C0"
168170

169171

170172
def get_theme_data(name: str):
@@ -323,6 +325,17 @@ def __init__(self):
323325
"Fans missing from the list? Install lm-sensors package\n"
324326
"and run 'sudo sensors-detect' command, then reboot.")
325327

328+
try:
329+
version = open(VERSION_FILE).readline()
330+
except:
331+
try:
332+
version = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8')
333+
except:
334+
version = "0.0.0"
335+
336+
version_label = ttk.Label(self.window, text=version, foreground=DISABLED_COLOR)
337+
version_label.place(x=5, y=550)
338+
326339
self.weather_ping_btn = ttk.Button(self.window, text="Weather & ping",
327340
command=lambda: self.on_weatherping_click())
328341
self.weather_ping_btn.place(x=80, y=520, height=50, width=130)
@@ -510,13 +523,6 @@ def on_weatherping_click(self):
510523
self.more_config_window.show()
511524

512525
def on_open_theme_folder_click(self):
513-
# path = f'"{MAIN_DIRECTORY}res/themes"'
514-
# if platform.system() == "Windows":
515-
# os.startfile(path)
516-
# elif platform.system() == "Darwin":
517-
# subprocess.Popen(["open", path])
518-
# else:
519-
# subprocess.Popen(["xdg-open", path])
520526
path = MAIN_DIRECTORY / "res/themes"
521527

522528
if platform.system() == "Windows":
@@ -527,24 +533,35 @@ def on_open_theme_folder_click(self):
527533
subprocess.Popen(["xdg-open", str(path)])
528534

529535
def on_theme_editor_click(self):
530-
theme_editor = next(MAIN_DIRECTORY.glob("theme-editor.*"))
531-
532-
if platform.system() == "Windows":
533-
subprocess.Popen([str(theme_editor), self.theme_cb.get()], shell=True)
534-
else:
535-
subprocess.Popen([str(theme_editor), self.theme_cb.get()])
536+
try:
537+
# Load Python file with local python interpreter (useful for venvs)
538+
theme_editor = next(MAIN_DIRECTORY.glob("theme-editor.py"))
539+
subprocess.Popen([sys.executable, str(theme_editor), self.theme_cb.get()])
540+
except:
541+
# Load binary (for releases) or Python file with system interpreter
542+
theme_editor = next(MAIN_DIRECTORY.glob("theme-editor*"))
543+
if platform.system() == "Windows":
544+
subprocess.Popen([str(theme_editor), self.theme_cb.get()], shell=True)
545+
else:
546+
subprocess.Popen([str(theme_editor), self.theme_cb.get()])
536547

537548
def on_save_click(self):
538549
self.save_config_values()
539550

540551
def on_saverun_click(self):
541552
self.save_config_values()
542-
main_file = next(MAIN_DIRECTORY.glob("main.*"))
543553

544-
if platform.system() == "Windows":
545-
subprocess.Popen([str(main_file)], shell=True)
546-
else:
547-
subprocess.Popen([str(main_file)])
554+
try:
555+
# Load Python file with local python interpreter (useful for venvs)
556+
main_file = next(MAIN_DIRECTORY.glob("main.py"))
557+
subprocess.Popen([sys.executable, str(main_file)])
558+
except:
559+
# Load binary (for releases) or Python file with system interpreter
560+
main_file = next(MAIN_DIRECTORY.glob("main*"))
561+
if platform.system() == "Windows":
562+
subprocess.Popen([str(main_file)], shell=True)
563+
else:
564+
subprocess.Popen([str(main_file)])
548565

549566
self.window.destroy()
550567

@@ -556,10 +573,10 @@ def on_model_change(self, e=None):
556573
self.show_hide_brightness_warning()
557574
model = self.model_cb.get()
558575
if model == SIMULATED_MODEL:
559-
self.com_cb.configure(state="disabled", foreground="#C0C0C0")
560-
self.orient_cb.configure(state="disabled", foreground="#C0C0C0")
576+
self.com_cb.configure(state="disabled", foreground=DISABLED_COLOR)
577+
self.orient_cb.configure(state="disabled", foreground=DISABLED_COLOR)
561578
self.brightness_slider.configure(state="disabled")
562-
self.brightness_val_label.configure(foreground="#C0C0C0")
579+
self.brightness_val_label.configure(foreground=DISABLED_COLOR)
563580
else:
564581
self.com_cb.configure(state="readonly", foreground="#000")
565582
self.orient_cb.configure(state="readonly", foreground="#000")
@@ -591,8 +608,8 @@ def on_size_change(self, e=None):
591608
def on_hwlib_change(self, e=None):
592609
hwlib = [k for k, v in hw_lib_map.items() if v == self.hwlib_cb.get()][0]
593610
if hwlib == "STUB" or hwlib == "STATIC":
594-
self.eth_cb.configure(state="disabled", foreground="#C0C0C0")
595-
self.wl_cb.configure(state="disabled", foreground="#C0C0C0")
611+
self.eth_cb.configure(state="disabled", foreground=DISABLED_COLOR)
612+
self.wl_cb.configure(state="disabled", foreground=DISABLED_COLOR)
596613
else:
597614
self.eth_cb.configure(state="readonly", foreground="#000")
598615
self.wl_cb.configure(state="readonly", foreground="#000")

library/pythoncheck.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@
2424

2525
# Oldest / newest version supported
2626
MIN_PYTHON = (3, 9)
27-
MAX_PYTHON = (3, 14)
2827
# For Windows: max Python 3.13 until PythonNet support for 3.14
2928
MAX_PYTHON_WINDOWS = (3, 13)
29+
MAX_PYTHON_OTHERS = (3, 14)
30+
MAX_PYTHON = MAX_PYTHON_WINDOWS if sys.platform == "win32" else MAX_PYTHON_OTHERS
3031

3132

3233
def check_python_version():
3334
current_version = sys.version_info[:2]
34-
platform = sys.platform
3535

36-
if current_version < MIN_PYTHON or (platform == "win32" and current_version > MAX_PYTHON_WINDOWS) or (
37-
platform != "win32" and current_version > MAX_PYTHON):
36+
if current_version < MIN_PYTHON or current_version > MAX_PYTHON:
3837
print(f"[ERROR] Python {current_version[0]}.{current_version[1]} is not supported by this program. "
39-
f"Python {MIN_PYTHON[0]}.{MIN_PYTHON[1]}-{MAX_PYTHON[0]}.{MAX_PYTHON[1]} required on platform {platform}.")
38+
f"Python {MIN_PYTHON[0]}.{MIN_PYTHON[1]}-{MAX_PYTHON[0]}.{MAX_PYTHON[1]} required on platform {sys.platform}.")
4039
try:
4140
sys.exit(0)
4241
except:

main.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,18 @@ def on_signal_caught(signum, frame=None):
116116
def on_configure_tray(tray_icon, item):
117117
logger.info("Configure from tray icon")
118118

119-
configure_file = next(MAIN_DIRECTORY.glob("configure.*"))
119+
try:
120+
# Load Python file with local python interpreter (useful for venvs)
121+
configure_file = next(MAIN_DIRECTORY.glob("configure.py"))
122+
subprocess.Popen([sys.executable, str(configure_file)])
123+
except:
124+
# Load binary (for releases) or Python file with system interpreter
125+
configure_file = next(MAIN_DIRECTORY.glob("configure*"))
126+
if platform.system() == "Windows":
127+
subprocess.Popen([str(configure_file)], shell=True)
128+
else:
129+
subprocess.Popen([str(configure_file)])
120130

121-
if platform.system() == "Windows":
122-
subprocess.Popen([str(configure_file)], shell=True)
123-
else:
124-
subprocess.Popen([str(configure_file)])
125131
clean_stop(tray_icon)
126132

127133
def on_exit_tray(tray_icon, item):

tools/windows-installer/turing-system-monitor.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AppSupportURL={#MyAppURL}/wiki
2222
AppUpdatesURL={#MyAppURL}/releases
2323
DefaultDirName={autopf}\{#MyAppName}
2424
DefaultGroupName={#MyAppName}
25-
OutputBaseFilename=turing-system-monitor-{#MyAppVersion}
25+
OutputBaseFilename=turing-system-monitor-{#MyAppVersion}-windows
2626
AllowNoIcons=yes
2727
PrivilegesRequired=lowest
2828
Compression=lzma

turing-system-monitor-debug.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ configure_a = Analysis(
77
pathex=[],
88
binaries=[],
99
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
10-
hiddenimports=[],
10+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
1111
hookspath=[],
1212
hooksconfig={},
1313
runtime_hooks=[],
@@ -45,7 +45,7 @@ main_a = Analysis(
4545
pathex=[],
4646
binaries=[],
4747
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
48-
hiddenimports=[],
48+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
4949
hookspath=[],
5050
hooksconfig={},
5151
runtime_hooks=[],
@@ -83,7 +83,7 @@ editor_a = Analysis(
8383
pathex=[],
8484
binaries=[],
8585
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
86-
hiddenimports=[],
86+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
8787
hookspath=[],
8888
hooksconfig={},
8989
runtime_hooks=[],

turing-system-monitor.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ configure_a = Analysis(
77
pathex=[],
88
binaries=[],
99
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
10-
hiddenimports=[],
10+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
1111
hookspath=[],
1212
hooksconfig={},
1313
runtime_hooks=[],
@@ -45,7 +45,7 @@ main_a = Analysis(
4545
pathex=[],
4646
binaries=[],
4747
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
48-
hiddenimports=[],
48+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
4949
hookspath=[],
5050
hooksconfig={},
5151
runtime_hooks=[],
@@ -83,7 +83,7 @@ editor_a = Analysis(
8383
pathex=[],
8484
binaries=[],
8585
datas=[('res', 'res'), ('config.yaml', '.'), ('external', 'external')],
86-
hiddenimports=[],
86+
hiddenimports=['PIL', 'PIL._imagingtk', 'PIL._tkinter_finder'],
8787
hookspath=[],
8888
hooksconfig={},
8989
runtime_hooks=[],

0 commit comments

Comments
 (0)