mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 06:51:36 +01:00
feat: support linux & basic wine functions
This commit is contained in:
@@ -4,6 +4,7 @@ import yaml
|
|||||||
import software
|
import software
|
||||||
import ftplib
|
import ftplib
|
||||||
import tqdm
|
import tqdm
|
||||||
|
import ssl
|
||||||
|
|
||||||
class SESSION_REUSE_FTP_TLS(ftplib.FTP_TLS):
|
class SESSION_REUSE_FTP_TLS(ftplib.FTP_TLS):
|
||||||
"""Explicit FTPS, with shared TLS session"""
|
"""Explicit FTPS, with shared TLS session"""
|
||||||
@@ -138,6 +139,7 @@ class FTP(DataBackend):
|
|||||||
ftp = ftplib.FTP()
|
ftp = ftplib.FTP()
|
||||||
else:
|
else:
|
||||||
ftp = SESSION_REUSE_FTP_TLS()
|
ftp = SESSION_REUSE_FTP_TLS()
|
||||||
|
ftp.ssl_version = ssl.PROTOCOL_TLSv1_2
|
||||||
|
|
||||||
ftp.connect(server, port=port or 0)
|
ftp.connect(server, port=port or 0)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import win32com.client
|
|
||||||
|
# windows imports #
|
||||||
|
if os.name == "nt":
|
||||||
|
import win32com.client
|
||||||
|
else:
|
||||||
|
os.environ.update({"WINEARCH": "win64"})
|
||||||
|
|
||||||
def _template_registry_file(template_file, game_path=None):
|
def _template_registry_file(template_file, game_path=None):
|
||||||
'''Template the registry file before installation'''
|
'''Template the registry file before installation'''
|
||||||
@@ -16,11 +22,17 @@ def install_registry_file(registry_file, game_path=None):
|
|||||||
# test path:
|
# test path:
|
||||||
# ./example_software_root/FreeDink/registry_files/game_path_example_1.reg
|
# ./example_software_root/FreeDink/registry_files/game_path_example_1.reg
|
||||||
|
|
||||||
# windows sucky sucky #
|
if sys.platform.startswith("linux"):
|
||||||
if not os.path.isabs(registry_file):
|
p = subprocess.Popen(["wine64", "start", "regedit", registry_file],
|
||||||
registry_file = os.path.join(os.getcwd(), registry_file)
|
subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||||
p = subprocess.Popen(["python", "regedit.py", registry_file],
|
print("Running regedit for wine..")
|
||||||
subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
else:
|
||||||
|
# windows sucky sucky #
|
||||||
|
if not os.path.isabs(registry_file):
|
||||||
|
registry_file = os.path.join(os.getcwd(), registry_file)
|
||||||
|
|
||||||
|
p = subprocess.Popen(["python", "regedit.py", registry_file],
|
||||||
|
subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||||
|
|
||||||
print(p.communicate())
|
print(p.communicate())
|
||||||
|
|
||||||
@@ -29,13 +41,21 @@ def install_extra_files(extra_files_list, path):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def resolve_lnk(lnk_file_path):
|
def resolve_lnk(lnk_file_path):
|
||||||
shell = win32com.client.Dispatch("WScript.Shell")
|
|
||||||
shortcut = shell.CreateShortcut(lnk_file_path)
|
if os.name == "nt":
|
||||||
return shortcut.TargetPath
|
shell = win32com.client.Dispatch("WScript.Shell")
|
||||||
|
shortcut = shell.CreateShortcut(lnk_file_path)
|
||||||
|
return shortcut.TargetPath
|
||||||
|
else:
|
||||||
|
return lnk_file_path # not required on linux
|
||||||
|
|
||||||
def run_exe(path, synchronous=False):
|
def run_exe(path, synchronous=False):
|
||||||
'''Launches a given software'''
|
'''Launches a given software'''
|
||||||
|
|
||||||
|
if os.name != "nt":
|
||||||
|
subprocess.Popen(["wine64", path], cwd=os.path.dirname(path))
|
||||||
|
return
|
||||||
|
|
||||||
if synchronous:
|
if synchronous:
|
||||||
raise NotImplementedError("SYNC not yet implemented")
|
raise NotImplementedError("SYNC not yet implemented")
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ customtkinter
|
|||||||
tqdm
|
tqdm
|
||||||
Jinja2
|
Jinja2
|
||||||
pyyaml
|
pyyaml
|
||||||
pywin32
|
pywin32==<version>; platform_system=="Windows"
|
||||||
|
|||||||
Reference in New Issue
Block a user