From d68628b15f1dd9d3407f2c14e39134c4efe5808c Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Sun, 29 Jan 2023 13:36:31 +0100 Subject: [PATCH] Small fixes when using strip() instead of replace() --- bin/NPBackupInstaller.py | 9 +++++---- bin/compile.py | 16 ++++++++-------- setup.py | 7 ++++--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bin/NPBackupInstaller.py b/bin/NPBackupInstaller.py index f4422c5..c29c9d7 100644 --- a/bin/NPBackupInstaller.py +++ b/bin/NPBackupInstaller.py @@ -7,8 +7,8 @@ __intname__ = "npbackup.installer" __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" -__build__ = "2023011101" -__version__ = "1.1.6" +__build__ = "2023012901" +__version__ = "1.1.7" import sys @@ -22,13 +22,14 @@ import ofunctions.logger_utils sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))) from npbackup.customization import PROGRAM_NAME, PROGRAM_DIRECTORY -from npbackup.path_helper import BASEDIR, CURRENT_DIR +from npbackup.path_helper import CURRENT_DIR del sys.path[0] _DEBUG = os.environ.get("_DEBUG", False) LOG_FILE = os.path.join(CURRENT_DIR, __intname__ + ".log") +BASEDIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) INSTALL_TO = "{}{}{}".format( os.environ.get("PROGRAMFILES", None), os.sep, PROGRAM_DIRECTORY @@ -95,7 +96,7 @@ def install(config_file=None): if not config_file: # Execute config file modification if needed source = os.path.join(BASEDIR, CONF_FILE) - destination = os.path.join(INSTALL_TO, CONF_FILE.rstrip(".dist")) + destination = os.path.join(INSTALL_TO, CONF_FILE.replace(".dist", "")) config_file = destination if os.path.isfile(destination): logger.info("Keeping in place configuration file.") diff --git a/bin/compile.py b/bin/compile.py index 4377cc1..2818251 100644 --- a/bin/compile.py +++ b/bin/compile.py @@ -8,7 +8,7 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "2023012801" -__version__ = "1.4.0" +__version__ = "1.4.1" import sys @@ -119,8 +119,6 @@ def compile(arch="64"): "win-p{}{}-{}".format(sys.version_info[0], sys.version_info[1], arch), ) - program_executable_path = os.path.join(output_arch_dir, program_executable) - translations_dir = "translations" translations_dir_source = os.path.join(BASEDIR, translations_dir) translations_dir_dest = os.path.join(PACKAGE_DIR, translations_dir) @@ -130,15 +128,18 @@ def compile(arch="64"): icon_file = os.path.join(PACKAGE_DIR, 'npbackup_icon.ico') # Installer specific files, no need for a npbackup package directory here + + program_executable_path = os.path.join(output_arch_dir, program_executable) + dist_conf_file_source = get_private_conf_dist_file() - dist_conf_file_dest = os.path.basename(dist_conf_file_source) + dist_conf_file_dest = os.path.basename(dist_conf_file_source.replace('_private_', '')) excludes_dir = "excludes" excludes_dir_source = os.path.join(BASEDIR, os.pardir, excludes_dir) excludes_dir_dest = excludes_dir - r""" - C:\GIT\npbackup>C:\GIT\NPBACKUP\venv\scripts\python.exe -m nuitka --python-flag=no_docstrings --python-flag=-O --onefile --plugin-enable=tk-inter --include-data-dir="C:\GIT\npbackup\npbackup\translations"="npbackup\translations" --include-data-file="C:\GIT\npbackup\npbackup\LICENSE.md"="npbackup\LICENSE.md" --include-data-file=npbackup\RESTIC_SOURCE_FILES\restic_0.15.0_windows_amd64.exe="restic.exe" --windows-icon-from-ico=npbackup\npbackup_icon.ico --company-name="NetInvent" --product-name="NPBackup Network Backup Client" --file-version="2.1.0.0" --product-version="2.1.0.0" --copyright="NetInvent 2022-2023" --file-description="Network Backup Client P10-x64priv" --trademarks="NetInvent (C)" --output-dir="C:\GIT\npbackup\npbackup\BUILD-PRIVATE\win-p310-x64" bin\npbackup - """ + + NUITKA_OPTIONS = '--enable-plugin=data-hiding' if have_nuitka_commercial() else '' + EXE_OPTIONS = '--company-name="{}" --product-name="{}" --file-version="{}" --product-version="{}" --copyright="{}" --file-description="{}" --trademarks="{}"'.format( COMPANY_NAME, PRODUCT_NAME, @@ -148,7 +149,6 @@ def compile(arch="64"): file_description, TRADEMARKS, ) - NUITKA_OPTIONS = '--enable-plugin=data-hiding' if have_nuitka_commercial() else '' CMD = '{} -m nuitka --python-flag=no_docstrings --python-flag=-O {} {} --onefile --plugin-enable=tk-inter --include-data-dir="{}"="{}" --include-data-file="{}"="{}" --include-data-file="{}"="{}" --windows-icon-from-ico="{}" --output-dir="{}" bin/npbackup'.format( PYTHON_EXECUTABLE, diff --git a/setup.py b/setup.py index c96e3b4..c4f14e6 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,8 @@ __intname__ = "npbackup.setup" __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2022-2023 NetInvent" __license__ = "GPL-3.0-only" -__build__ = "2023012401" +__build__ = "2023012901" +__setup_ver__ = "1.1.0" PACKAGE_NAME = "npbackup" @@ -51,8 +52,8 @@ def get_metadata(package_file): for line in _read_file(package_file).splitlines(): if line.startswith("__version__") or line.startswith("__description__"): delim = "=" - _metadata[line.split(delim)[0].strip().strip("__")] = ( - line.split(delim)[1].strip().strip("'\"") + _metadata[line.split(delim)[0].strip().replace("__", "")] = ( + line.split(delim)[1].strip().replace("'\"", "") ) return _metadata