From d581e37b95f7ee3f4460c1a8c831a8316ffdfc93 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Tue, 16 Dec 2025 10:07:36 +0800 Subject: [PATCH] Update constants usage Signed-off-by: Loren Eteval --- Deploy.py | 53 ++++++++++++++------------------ Furious/Frozenlib/Constants.py | 3 ++ Furious/Widget/GuiTUNSettings.py | 8 ++--- setup.py | 9 +++--- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/Deploy.py b/Deploy.py index bde2102..39b5c75 100644 --- a/Deploy.py +++ b/Deploy.py @@ -46,6 +46,7 @@ logger = logging.getLogger('Deploy') EXIT_SUCCESS = 0 EXIT_FAILURE = 1 +USER_HOME = pathlib.Path.home() DEPLOY_DIR_NAME = f'{APPLICATION_NAME}-Deploy' HYSTERIA_DATA_DIR = DATA_DIR / 'hysteria' @@ -60,10 +61,10 @@ NUITKA_BINARY_VERSION_OPTION = ( PLATFORM_MACHINE_LOWER = PLATFORM_MACHINE.lower() if PLATFORM == 'Windows': - NUITKA_BINARY_VERSION_OPTION += f'--file-description=\"A GUI proxy client based on PySide6. Support Xray-core & hysteria\" ' + NUITKA_BINARY_VERSION_OPTION += f'--file-description=\"{APPLICATION_DESCRIPTION}\" ' if PLATFORM == 'Windows' or PLATFORM == 'Darwin': - NUITKA_BINARY_VERSION_OPTION += f'--copyright=\"Copyright (C) 2024–present Loren Eteval & contributors \" ' + NUITKA_BINARY_VERSION_OPTION += f'--copyright=\"Copyright (C) 2024–present {APPLICATION_AUTHOR_NAME} & contributors <{APPLICATION_AUTHOR_EMAIL}>\" ' if PLATFORM == 'Windows': NUITKA_BUILD = ( @@ -430,7 +431,7 @@ def cleanup(): try: # Remove home rpmbuild folder - shutil.rmtree(pathlib.Path.home() / 'rpmbuild') + shutil.rmtree(USER_HOME / 'rpmbuild') except Exception as ex: # Any non-exit exceptions @@ -664,10 +665,9 @@ def main(): try: result = runExternalCommand( - f'chmod +x {LINUX_APPIMAGE_FILENAME}', + ['chmod', '+x', LINUX_APPIMAGE_FILENAME], stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, check=True, ) except subprocess.CalledProcessError as err: @@ -743,8 +743,7 @@ def main(): ) runExternalCommand( - f'chmod +x {launcherScript}', - shell=True, + ['chmod', '+x', launcherScript], check=True, ) except Exception: @@ -791,7 +790,7 @@ def main(): f'Architecture: {arch}\n' f'Depends: libc6, libstdc++6, libgl1, libxcb-cursor0, libxcb-xinerama0\n' f'Maintainer: {APPLICATION_AUTHOR_NAME} <{APPLICATION_AUTHOR_EMAIL}>\n' - f'Description: A GUI proxy client based on PySide6. Support Xray-core & hysteria\n' + f'Description: {APPLICATION_DESCRIPTION}\n' f'Homepage: {APPLICATION_ABOUT_PAGE}\n' ) except Exception: @@ -812,21 +811,19 @@ def main(): check=True, ) runExternalCommand( - f'chmod 755 ' - + (LINUX_DEBIAN_DIR / 'usr' / 'bin' / APPLICATION_NAME).as_posix(), - shell=True, + ['chmod', '755', LINUX_DEBIAN_DIR / 'usr' / 'bin' / APPLICATION_NAME], check=True, ) runExternalCommand( - f'chmod 755 ' - + ( + [ + 'chmod', + '755', LINUX_DEBIAN_DIR / 'usr' / 'share' / APPLICATION_NAME - / f'{APPLICATION_NAME}.bin' - ).as_posix(), - shell=True, + / f'{APPLICATION_NAME}.bin', + ], check=True, ) except Exception: @@ -1009,7 +1006,7 @@ def main(): for name in ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']: os.makedirs( - pathlib.Path.home() / 'rpmbuild' / name, + USER_HOME / 'rpmbuild' / name, exist_ok=True, ) except Exception: @@ -1036,13 +1033,13 @@ def main(): shutil.move( LINUX_RPM_DIR / f'{ARTIFACT_NAME}.tar.gz', - pathlib.Path.home() / 'rpmbuild' / 'SOURCES', + USER_HOME / 'rpmbuild' / 'SOURCES', ) # Create rpm manifest file try: with open( - pathlib.Path.home() / 'rpmbuild' / 'SPECS' / f'{APPLICATION_NAME}.spec', + USER_HOME / 'rpmbuild' / 'SPECS' / f'{APPLICATION_NAME}.spec', 'w', encoding='utf-8', ) as file: @@ -1050,7 +1047,7 @@ def main(): f'Name: {APPLICATION_NAME}\n' f'Version: {APPLICATION_VERSION}\n' f'Release: 1%{{?dist}}\n' - f'Summary: A GUI proxy client based on PySide6. Support Xray-core & hysteria\n' + f'Summary: {APPLICATION_DESCRIPTION}\n' f'\n' f'License: GPLv3\n' f'URL: {APPLICATION_ABOUT_PAGE}\n' @@ -1059,7 +1056,7 @@ def main(): f'BuildArch: {PLATFORM_MACHINE_LOWER}\n' f'\n' f'%description\n' - f'A GUI proxy client based on PySide6. Support Xray-core & hysteria\n' + f'{APPLICATION_DESCRIPTION}\n' f'\n' f'%prep\n' f'%autosetup\n' @@ -1073,17 +1070,17 @@ def main(): f'\n' f'# Binary symlink\n' f'mkdir -p %{{buildroot}}/usr/bin\n' - f'ln -s /opt/{APPLICATION_NAME}/Furious.bin %{{buildroot}}/usr/bin/{APPLICATION_NAME}\n' + f'ln -s /opt/{APPLICATION_NAME}/{APPLICATION_NAME}.bin %{{buildroot}}/usr/bin/{APPLICATION_NAME}\n' f'\n' f'# Desktop entry\n' f'mkdir -p %{{buildroot}}/usr/share/applications\n' f'cat > %{{buildroot}}/usr/share/applications/{APPLICATION_NAME}.desktop <

' - '' - '' + f'

' + f'' + f'' + _('Go to help page') - + '

' + + f'

' ) @staticmethod diff --git a/setup.py b/setup.py index 1d4fa00..61658f5 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ # along with this program. If not, see . from Furious.Version import __version__ +from Furious.Frozenlib.Constants import * from setuptools import setup, find_packages @@ -29,12 +30,12 @@ setup( name='Furious-GUI', version=__version__, license='GPL v3.0', - description='A GUI proxy client based on PySide6. Support Xray-core & hysteria', + description=APPLICATION_DESCRIPTION, long_description=long_description, long_description_content_type='text/markdown', - author='Loren Eteval', - author_email='loren.eteval@proton.me', - url='https://github.com/LorenEteval/Furious', + author=APPLICATION_AUTHOR_NAME, + author_email=APPLICATION_AUTHOR_EMAIL, + url=APPLICATION_ABOUT_PAGE, packages=find_packages(), package_data={'Furious': ['Data/**']}, include_package_data=True,