Fix bugs & add more stuff to PATH

This commit is contained in:
AccentuSoft
2024-07-04 11:41:06 +03:00
parent 889c09ad14
commit 8e8838e6e9
5 changed files with 34 additions and 17 deletions

View File

@@ -73,14 +73,13 @@ class ModulesManager:
def configureVenvLinux(self):
binDir = self.modulesBaseDirectoryPath / 'bin'
packagesPath = str(list((self.modulesBaseDirectoryPath / 'lib').glob('python*'))[0] / 'site-packages')
# prepend bin to PATH
os.environ["PATH"] = f'{binDir}{os.pathsep}{os.environ.get("PATH", "")}'
os.environ["PATH"] = f'{packagesPath}{os.pathsep}{binDir}{os.pathsep}{os.environ.get("PATH", "")}'
os.environ["VIRTUAL_ENV"] = str(self.modulesBaseDirectoryPath)
os.environ["PLAYWRIGHT_BROWSERS_PATH"] = str(self.browsersBaseDirectoryPath)
packagesPath = str(list((self.modulesBaseDirectoryPath / 'lib').glob('python*'))[0] / 'site-packages')
sys.path.append(packagesPath)
site.addsitedir(packagesPath)
@@ -88,17 +87,16 @@ class ModulesManager:
def configureVenvWindows(self):
binDir = self.modulesBaseDirectoryPath / 'Scripts'
packagesPath = self.modulesBaseDirectoryPath / 'Lib' / 'site-packages'
# prepend Scripts to PATH
os.environ["PATH"] = f'{binDir}{os.pathsep}{os.environ.get("PATH", "")}'
os.environ["PATH"] = f'{packagesPath}{os.pathsep}{binDir}{os.pathsep}{os.environ.get("PATH", "")}'
os.environ["VIRTUAL_ENV"] = str(self.modulesBaseDirectoryPath)
os.environ["PLAYWRIGHT_BROWSERS_PATH"] = str(self.browsersBaseDirectoryPath)
# add the virtual environments libraries to the host python import mechanism
packagesPath = str(self.modulesBaseDirectoryPath / 'Lib' / 'site-packages')
sys.path.append(packagesPath)
site.addsitedir(packagesPath)
sys.path.append(str(packagesPath))
site.addsitedir(str(packagesPath))
sys.prefix = str(self.modulesBaseDirectoryPath)

View File

@@ -23,7 +23,7 @@ class SettingsObject(dict):
def __init__(self):
super().__init__()
self.globalSettings = QSettings()
self.globalSettings.setValue("Program/Version", "v1.6.1")
self.globalSettings.setValue("Program/Version", "v1.6.2")
self.globalSettings.setValue("Program/TOR Profile Location",
self.globalSettings.value("Program/TOR Profile Location", ""))
self.globalSettings.setValue("Program/BaseDir",

View File

@@ -7,6 +7,7 @@ import os
import platform
import subprocess
import tempfile
import stat
from pathlib import Path
import requests
@@ -22,8 +23,8 @@ from PySide6 import QtCore, QtWidgets, QtGui
"""
python -m nuitka --follow-imports --onefile --noinclude-pytest-mode=nofollow --noinclude-setuptools-mode=nofollow ^
--noinclude-custom-mode=setuptools:error --noinclude-IPython-mode=nofollow --enable-plugin=pyside6 ^
--assume-yes-for-downloads --remove-output --disable-console --warn-unusual-code --show-modules ^
--windows-company-name="AccentuSoft" --windows-product-name="LinkScope Installer" --windows-product-version=1.6.1.0 ^
--assume-yes-for-downloads --remove-output --windows-console-mode=disable --warn-unusual-code --show-modules ^
--windows-company-name="AccentuSoft" --windows-product-name="LinkScope Installer" --windows-product-version=1.6.2.0 ^
--include-data-files="Icon.ico=Icon.ico" --windows-icon-from-ico=".\Icon.ico" ^
--windows-file-description="LinkScope Installer" ^
Installer.py
@@ -33,7 +34,7 @@ Installer.py
"""
python -m nuitka --follow-imports --onefile --noinclude-pytest-mode=nofollow --noinclude-setuptools-mode=nofollow \
--noinclude-custom-mode=setuptools:error --noinclude-IPython-mode=nofollow --enable-plugin=pyside6 \
--assume-yes-for-downloads --remove-output --disable-console --warn-unusual-code --show-modules \
--assume-yes-for-downloads --remove-output --warn-unusual-code --show-modules \
--include-data-files="Icon.ico=Icon.ico" --linux-icon="Icon.ico" \
Installer.py
"""
@@ -715,10 +716,24 @@ For more information on this, and how to apply and follow the GNU AGPL, see
"""
def recursiveMakeWriteableHelper(targetPath: Path):
for root, dirs, files in os.walk(targetPath):
for dir_name in dirs:
dir_path = os.path.join(root, dir_name)
os.chmod(dir_path, stat.S_IWRITE)
if not os.access(dir_path, os.W_OK):
os.chmod(dir_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC)
for file_name in files:
file_path = os.path.join(root, file_name)
os.chmod(file_path, stat.S_IWRITE)
if not os.access(file_path, os.W_OK):
os.chmod(file_path, stat.S_IWRITE | stat.S_IREAD)
def deleteVenvStuff() -> None:
baseAppStoragePath = Path(
QtCore.QStandardPaths.standardLocations(
QtCore.QStandardPaths.StandardLocation.AppDataLocation)[0])
recursiveMakeWriteableHelper(baseAppStoragePath)
shutil.rmtree(baseAppStoragePath)
@@ -805,8 +820,10 @@ def removeFileHelper(pathToRemove: Path):
if not pathToRemove.exists():
return
if pathToRemove.is_dir():
recursiveMakeWriteableHelper(pathToRemove)
shutil.rmtree(pathToRemove)
else:
os.chmod(pathToRemove, stat.S_IWRITE)
pathToRemove.unlink(missing_ok=True)
@@ -1154,9 +1171,9 @@ class LinkScopeInstallLatestPage(QtWidgets.QWizardPage):
class LinkScopeUninstallPage(QtWidgets.QWizardPage):
def doStuff(self):
deleteVenvStuff()
self.progressBar.setValue(3)
try:
deleteVenvStuff()
self.progressBar.setValue(3)
self.wizard().uninstall()
except Exception as e:
self.wizard().page(6).doneLabel.setText('Error occurred during uninstallation: ' +
@@ -1315,5 +1332,7 @@ class InstallThread(QtCore.QThread):
if __name__ == '__main__':
application = QtWidgets.QApplication(sys.argv)
application.setOrganizationName("AccentuSoft")
application.setApplicationName("LinkScope Client")
installWizard = InstallWizard()
sys.exit(application.exec())

View File

@@ -42,7 +42,7 @@ Note that the SFDP graph layout does not function on Windows, as an essential gr
Since Version 1.0.0, installers are provided for Windows 11 and Linux (Ubuntu) platforms.
Download the latest installer for your platform from the Releases page, and run it to install the software:
https://github.com/AccentuSoft/LinkScope_Client/releases/tag/v1.6.0
https://github.com/AccentuSoft/LinkScope_Client/releases/tag/v1.6.2
Note: On Ubuntu, you may need to mark the downloaded installer as executable before you can run it. To do this, right-click the installer, and from the drop-down menu, select 'properties'. On the dialog window that pops up, navigate to the 'Permissions' tab, and make sure that 'Allow executing file as program' is checked. You should at this point be able to run the installer by double-clicking it. If double-clicking the installer does not start it, you can also launch the installer through a terminal.

View File

@@ -31,7 +31,7 @@ python -m nuitka --follow-imports --standalone --noinclude-pytest-mode=nofollow
--include-data-dir="Core\Entities=Core\Entities" ^
--warn-unusual-code --show-modules --include-data-files="Icon.ico=Icon.ico" ^
--windows-icon-from-ico=".\Icon.ico" --include-data-dir="magic=magic" --windows-company-name=AccentuSoft ^
--windows-product-name="LinkScope Client" --windows-product-version="1.6.1.0" ^
--windows-product-name="LinkScope Client" --windows-product-version="1.6.2.0" ^
--windows-file-description="LinkScope Client Software" ^
--include-package-data=playwright ^
--include-package-data=folium --include-package-data=branca ^
@@ -46,7 +46,7 @@ python -m nuitka --onefile --noinclude-pytest-mode=nofollow ^
--noinclude-unittest-mode=nofollow --assume-yes-for-downloads --remove-output ^
--nofollow-import-to=tkinter ^
--warn-unusual-code ^
--windows-company-name=AccentuSoft --windows-product-version="1.6.1.0" ^
--windows-company-name=AccentuSoft --windows-product-version="1.6.2.0" ^
--windows-product-name="LinkScope Client Updater" --windows-file-description="LinkScope Client Updater" ^
".\UpdaterUtil.py"