1
0
Fork 0
mirror of synced 2024-05-19 20:12:49 +12:00

Fix .msi file and remove macos .app file, because is did not work

This commit is contained in:
BuildTools 2021-09-05 00:54:43 +02:00
parent 3c4a0e446f
commit f278a29c32
4 changed files with 39 additions and 112 deletions

View file

@ -102,9 +102,6 @@ jobs:
- name: cx_freeze - name: cx_freeze
run: pip3 install --upgrade cx_freeze wheel run: pip3 install --upgrade cx_freeze wheel
- name: prepare Files
run: mv rare/__main__.py rare/Rare.py
- name: Build - name: Build
run: python freeze.py bdist_msi run: python freeze.py bdist_msi
@ -119,33 +116,3 @@ jobs:
asset_name: Rare.msi asset_name: Rare.msi
tag: ${{ github.ref }} tag: ${{ github.ref }}
overwrite: true overwrite: true
mac_os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Rare Dependencies
run: pip install -r requirements.txt
- name: install pyinstaller
run: pip install pyinstaller
- name: copy files
run: mv rare/__main__.py __main__.py
- name: run pyinstaller
run: pyinstaller -F --name Rare --add-data "rare/languages/*:rare/languages" --add-data "rare/resources/colors/*:rare/resources/colors" --add-data "rare/resources/images/*:rare/resources/images/" --add-data "rare/resources/stylesheets/RareStyle/*:rare/resources/stylesheets/RareStyle/" --windowed --icon rare/resources/images/Rare.icns __main__.py
- name: upload to GitHub
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Rare.app
asset_name: Rare_MacOS.app
tag: ${{ github.ref }}
overwrite: true

View file

@ -1,82 +1,35 @@
import sys
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
from rare import __version__ from rare import __version__
# Packages to include
python_packages = [
"PyQt5",
'requests',
'PIL',
'qtawesome',
'psutil',
'pypresence',
'win32com'
]
# Modules to include
python_modules = []
base = None
name = None
build_options = {}
build_exe_options = {}
shortcutName = None
shortcutDir = None
bdist_msi_options = None
src_files = []
external_so_files = []
if sys.platform == 'win32':
base = 'Win32GUI'
name = 'Rare.exe'
shortcut_table = [ shortcut_table = [
('DesktopShortcut', # Shortcut ("DesktopShortcut", # Shortcut
'DesktopFolder', # Directory "DesktopFolder", # Directory_
'Rare', # Name "Rare", # Name
'TARGETDIR', # Component "TARGETDIR", # Component_
'[TARGETDIR]' + name, # Target "[TARGETDIR]Rare.exe", # Target
None, # Arguments None, # Arguments
'A gui for Legendary.', # Description None, # Description
None, # Hotkey None, # Hotkey
None, # Icon None, # Icon
None, # IconIndex None, # IconIndex
None, # ShowCmd None, # ShowCmd
'TARGETDIR' # Working Directory 'TARGETDIR' # WkDir
)] )
msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {'data': msi_data, "all_users": False}
build_options["bdist_msi"] = bdist_msi_options
else:
name = 'Rare'
src_files += [
'LICENSE',
'README.md',
'rare/resources/images/Rare.ico',
] ]
# Dependencies are automatically detected, but it might need fine tuning. msi_data = {"Shortcut": shortcut_table}
build_exe_options["packages"] = python_packages bdist_msi_options = {'data': msi_data}
build_exe_options["include_files"] = src_files + external_so_files base = "Win32GUI"
build_exe_options["includes"] = python_modules
build_exe_options["excludes"] = ["setuptools", "tkinter", "pkg_resources"]
# Set options setup(
build_options["build_exe"] = build_exe_options name="Rare",
setup(name='Rare',
version=__version__, version=__version__,
description='A gui for Legendary.', description="A GUI for Legendary",
options=build_options, options={
executables=[ "bdist_msi": bdist_msi_options,
Executable('rare/Rare.py', },
target_name=name, executables=[Executable("rare/__main__.py",
icon='rare/resources/images/Rare.ico', base=base, icon="rare/resources/images/Rare.ico",
base=base, target_name="Rare")]
shortcut_name=shortcutName,
shortcut_dir=shortcutDir,
),
],
) )

View file

@ -8,6 +8,7 @@ from rare.utils import singleton, utils
def main(): def main():
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("-V", "--version", action="store_true", help="Shows version and exits") parser.add_argument("-V", "--version", action="store_true", help="Shows version and exits")
parser.add_argument("-S", "--silent", action="store_true", parser.add_argument("-S", "--silent", action="store_true",
@ -53,12 +54,14 @@ def main():
args.silent = True args.silent = True
# fix error in cx_freeze # fix error in cx_freeze
import multiprocessing
multiprocessing.freeze_support()
from rare.app import start from rare.app import start
start(args) start(args)
if __name__ == '__main__': if __name__ == '__main__':
import multiprocessing
multiprocessing.freeze_support()
main() main()

View file

@ -347,8 +347,12 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -
# Add shortcut # Add shortcut
shell = Dispatch('WScript.Shell') shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(pathLink) shortcut = shell.CreateShortCut(pathLink)
shortcut.Targetpath = sys.executable if sys.executable.endswith("Rare.exe"):
shortcut.Arguments = f'{target} launch {app_name}' executable = sys.executable
else:
executable = f"{sys.executable} {os.path.abspath(sys.argv[0])}"
shortcut.Targetpath = executable
shortcut.Arguments = f'launch {app_name}'
shortcut.WorkingDirectory = os.getcwd() shortcut.WorkingDirectory = os.getcwd()
# Icon # Icon