1
0
Fork 0
mirror of synced 2024-06-18 18:44:45 +12:00

Update some things to launch rare with pythonw.exe on windows

This commit is contained in:
Dummerle 2021-06-12 00:04:09 +02:00
parent 1226344747
commit 745e0cc516
4 changed files with 16 additions and 113 deletions

View file

@ -46,30 +46,6 @@ jobs:
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update AUR package
cx-freeze-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9.5'
- name: Install python deps
run: |
pip3 install cx_Freeze setuptools wheel
pip3 install -r requirements.txt
- name: Build
run: python3 freeze.py bdist_msi
- name: Copy File
run: cp dist/*.msi Rare.msi
- name: Upload files to GitHub
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Rare.msi
asset_name: Rare.msi
tag: ${{ github.ref }}
overwrite: true
deb-package:
runs-on: ubuntu-latest
steps:

View file

@ -12,20 +12,17 @@ creating an issue on github or on Discord: https://discord.gg/YvmABK9YSk
### Installation via pip (recommend)
Execute `pip install Rare` for all users Or `pip install Rare --user` for only one user. Then execute `rare` in your
terminal or cmd
Execute `pip install Rare` for all users Or `pip install Rare --user` for only one user.
Linux: execute `rare` in your terminal.
Windows: execute `pythonw -m rare` in cmd
It is possible to create a desktop link, or a start menu link. Execute the command above with `--desktop-shortcut` or `--startmenu-shortcut` option
**Note**: On Linux must be `/home/user/.local/bin` in PATH and on Windows must be `PythonInstallationDirectory\Scripts`
in PATH.
### Windows Simple
Download Rare.exe from the [releases page](https://github.com/Dummerle/Rare/releases) and execute it.
**Note:**
Using the exe file could cause errors with Windows Defender or other Anti Virus. Sometimes it is not possible to
download games and sometimes the app crashes. In this case please use pip
### Linux
#### Arch based

View file

@ -1,74 +0,0 @@
import sys
from cx_Freeze import setup, Executable
from rare import __version__
# Packages to include
python_packages = []
# 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 = [
('DesktopShortcut', # Shortcut
'DesktopFolder', # Directory
'Rare', # Name
'TARGETDIR', # Component
'[TARGETDIR]' + name, # Target
None, # Arguments
'A gui for Legendary.', # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # Working Directory
)]
msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {'data': msi_data, "all_users": True}
build_options["bdist_msi"] = bdist_msi_options
else:
name = 'Rare'
src_files += [
'LICENSE',
'README.md',
'rare/styles/Logo.ico',
]
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options["packages"] = python_packages
build_exe_options["include_files"] = src_files + external_so_files
build_exe_options["includes"] = python_modules
build_exe_options["excludes"] = ["setuptools", "tkinter", "pkg_resources"]
# Set options
build_options["build_exe"] = build_exe_options
setup(name='Rare',
version=__version__,
description='A gui for Legendary.',
options=build_options,
executables=[
Executable('rare/__main__.py',
targetName=name,
icon='rare/styles/Logo.ico',
base=base,
shortcutName=shortcutName,
shortcutDir=shortcutDir,
),
],
)

View file

@ -205,7 +205,7 @@ def get_possible_langs():
def get_latest_version():
try:
resp = requests.get("https://api.github.com/repos/Dummerle/Rare/releases/latest")
tag = json.loads(resp.content.decode("utf-8"))["tag_name"]
tag = resp.json()["tag_name"]
return tag
except requests.exceptions.ConnectionError:
return "0.0.0"
@ -254,11 +254,15 @@ def create_rare_desktop_link(type_of_link):
# Path to location of link file
pathLink = os.path.join(target_folder, linkName)
exexutable = sys.executable
if "python.exe" in exexutable:
exexutable = exexutable.replace("python.exe", "pythonw.exe")
# Add shortcut
shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(pathLink)
shortcut.Targetpath = os.path.abspath(sys.argv[0])
shortcut.Arguments = ""
shortcut.Targetpath = exexutable
shortcut.Arguments = os.path.abspath(sys.argv[0])
shortcut.WorkingDirectory = os.getcwd()
# Icon
@ -325,8 +329,8 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop"):
# Add shortcut
shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(pathLink)
shortcut.Targetpath = target
shortcut.Arguments = f'launch {app_name}'
shortcut.Targetpath = sys.executable
shortcut.Arguments = f'{target} launch {app_name}'
shortcut.WorkingDirectory = os.getcwd()
# Icon