1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00

Use windows .msi installer for desktop shortcut

This commit is contained in:
ChemicalXandco 2021-04-13 22:54:46 +01:00
parent ce185d9079
commit 6acf8f0f0b
3 changed files with 66 additions and 58 deletions

View file

@ -55,25 +55,16 @@ jobs:
python-version: '3.8'
- name: Install python deps
run: |
pip3 install pyinstaller setuptools wheel
pip3 install cx_Freeze setuptools wheel
pip3 install -r requirements.txt
- name: Prepare
run: cp rare/__main__.py ./
- name: Build
run: pyinstaller
--icon=rare/styles/Logo.ico
--onefile
--name Rare
--add-data="Rare/languages/*;Rare/languages"
--add-data="Rare/Styles/*;Rare/Styles"
--windowed
__main__.py
run: python3 setup.py bdist_msi
- name: Upload files to GitHub
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Rare.exe
asset_name: Rare.exe
file: dist/Rare*.msi
asset_name: Rare.msi
tag: ${{ github.ref }}
overwrite: true

View file

@ -164,15 +164,3 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop"):
"StartupWMClass=rare-game\n"
)
os.chmod(os.path.expanduser(f"~/Desktop/{igame.title}.desktop"), 0o755)
# Windows
elif os.name == "nt":
if type_of_link == "desktop":
path = os.path.expanduser(f"~/Desktop/")
elif type_of_link == "start_menu":
logger.info("Startmenu link is not supported on windows")
return
else:
return
with open(path+igame.title+".bat", "w") as desktop_file:
desktop_file.write(f"rare launch {app_name}")

View file

@ -1,39 +1,68 @@
import setuptools
import sys
from rare import __version__ as version
from cx_Freeze import setup, Executable
with open("README.md", "r") as fh:
long_description = fh.read()
import rare
setuptools.setup(
name="Rare",
version=version,
author="Dummerle",
license="GPL-3",
description="A gui for Legendary",
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
url="https://github.com/Dummerle/Rare",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
"Operating System :: OS Independent"
base = None
name = None
shortcutName = None
shortcutDir = None
bdist_msi_options = None
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}
else:
name = 'Rare'
opts = {
'packages': [
'requests',
'PIL',
'qtawesome',
'notifypy',
'psutil',
'pypresence',
],
python_requires=">=3.8",
entry_points=dict(console_scripts=["rare=rare.__main__:main"]),
install_requires=[
"requests<3.0",
"pillow",
"setuptools",
"wheel",
"PyQt5",
"QtAwesome",
"notify-py",
"psutil",
"pypresence"
'zip_include_packages': [
'PyQt5.QtCore',
'PyQt5.QtGui',
'PyQt5.QtWidgets',
],
'include_files': [
'LICENSE',
'README.MD',
'rare/styles/Logo.ico',
],
}
setup(name = 'Rare',
version = rare.__version__,
description = 'A gui for Legendary.',
options = {'build_exe': opts, "bdist_msi": bdist_msi_options},
executables = [
Executable('rare/__main__.py',
targetName=name,
icon='rare/styles/Logo.ico',
base=base,
shortcutName=shortcutName,
shortcutDir=shortcutDir,
),
],
)