mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Fixed issue with seperate download path for sftp, ftp & local
Changes: - fixed issue when updating with the activated option of a seperate download path - removed leftover debug output
This commit is contained in:
parent
2eb4940574
commit
50038c4474
@ -29,8 +29,12 @@ def ftp_showPlugins(ftp):
|
|||||||
|
|
||||||
def ftp_upload_file(ftp, itemPath):
|
def ftp_upload_file(ftp, itemPath):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
|
if configValues.sftp_seperateDownloadPath is True:
|
||||||
|
uploadFolderPath = configValues.sftp_pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
uploadFolderPath = configValues.sftp_folderPath
|
||||||
try:
|
try:
|
||||||
ftp.cwd(configValues.sftp_folderPath)
|
ftp.cwd(uploadFolderPath)
|
||||||
itemPath = os.path.relpath(itemPath, 'TempSFTPFolder/')
|
itemPath = os.path.relpath(itemPath, 'TempSFTPFolder/')
|
||||||
itemPath = str(itemPath)
|
itemPath = str(itemPath)
|
||||||
currentDirectory = os.getcwd()
|
currentDirectory = os.getcwd()
|
||||||
@ -46,7 +50,6 @@ def ftp_upload_file(ftp, itemPath):
|
|||||||
|
|
||||||
def ftp_upload_server_jar(ftp, itemPath):
|
def ftp_upload_server_jar(ftp, itemPath):
|
||||||
try:
|
try:
|
||||||
print(f"itempath: {itemPath}")
|
|
||||||
ftp.cwd('.')
|
ftp.cwd('.')
|
||||||
itemPath = os.path.relpath(itemPath, 'TempSFTPFolder/')
|
itemPath = os.path.relpath(itemPath, 'TempSFTPFolder/')
|
||||||
itemPath = str(itemPath)
|
itemPath = str(itemPath)
|
||||||
|
@ -37,8 +37,12 @@ def sftp_showPlugins(sftp):
|
|||||||
|
|
||||||
def sftp_upload_file(sftp, itemPath):
|
def sftp_upload_file(sftp, itemPath):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
|
if configValues.sftp_seperateDownloadPath is True:
|
||||||
|
uploadFolderPath = configValues.sftp_pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
uploadFolderPath = configValues.sftp_folderPath
|
||||||
try:
|
try:
|
||||||
sftp.chdir(configValues.sftp_folderPath)
|
sftp.chdir(uploadFolderPath)
|
||||||
sftp.put(itemPath)
|
sftp.put(itemPath)
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
@ -86,13 +86,12 @@ def compareVersions(plugin_latest_version, pluginVersion):
|
|||||||
def eggCrackingJar(localJarFileName, searchMode):
|
def eggCrackingJar(localJarFileName, searchMode):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
if configValues.sftp_useSftp:
|
|
||||||
tempPluginFolderPath = createTempPluginFolder()
|
tempPluginFolderPath = createTempPluginFolder()
|
||||||
|
if configValues.sftp_useSftp:
|
||||||
sftp = createSFTPConnection()
|
sftp = createSFTPConnection()
|
||||||
pathToPluginJar = Path(f"{tempPluginFolderPath}/{localJarFileName}")
|
pathToPluginJar = Path(f"{tempPluginFolderPath}/{localJarFileName}")
|
||||||
sftp_downloadFile(sftp, pathToPluginJar, localJarFileName)
|
sftp_downloadFile(sftp, pathToPluginJar, localJarFileName)
|
||||||
else:
|
else:
|
||||||
tempPluginFolderPath = createTempPluginFolder()
|
|
||||||
ftp = createFTPConnection()
|
ftp = createFTPConnection()
|
||||||
pathToPluginJar = Path(f"{tempPluginFolderPath}/{localJarFileName}")
|
pathToPluginJar = Path(f"{tempPluginFolderPath}/{localJarFileName}")
|
||||||
ftp_downloadFile(ftp, pathToPluginJar, localJarFileName)
|
ftp_downloadFile(ftp, pathToPluginJar, localJarFileName)
|
||||||
@ -286,11 +285,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
for pluginArray in track(INSTALLEDPLUGINLIST, description="Updating" ,transient=True, complete_style="bright_magenta", ):
|
for pluginArray in track(INSTALLEDPLUGINLIST, description="Updating" ,transient=True, complete_style="bright_magenta", ):
|
||||||
plugin = INSTALLEDPLUGINLIST[i][0]
|
plugin = INSTALLEDPLUGINLIST[i][0]
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
if configValues.sftp_seperateDownloadPath is True:
|
|
||||||
pluginFile = f"{configValues.sftp_pathToSeperateDownloadPath}/{plugin}"
|
|
||||||
else:
|
|
||||||
pluginFile = f"{configValues.sftp_folderPath}/{plugin}"
|
pluginFile = f"{configValues.sftp_folderPath}/{plugin}"
|
||||||
|
|
||||||
if configValues.sftp_useSftp:
|
if configValues.sftp_useSftp:
|
||||||
pluginAttributes = sftp_validateFileAttributes(connection, pluginFile)
|
pluginAttributes = sftp_validateFileAttributes(connection, pluginFile)
|
||||||
if pluginAttributes == False:
|
if pluginAttributes == False:
|
||||||
@ -335,17 +330,17 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
print(f"{fileVersion}".ljust(13), end='')
|
print(f"{fileVersion}".ljust(13), end='')
|
||||||
print(f"{latestVersion}".ljust(13))
|
print(f"{latestVersion}".ljust(13))
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
if configValues.sftp_useSftp:
|
|
||||||
if configValues.sftp_seperateDownloadPath is True:
|
if configValues.sftp_seperateDownloadPath is True:
|
||||||
pluginPath = configValues.sftp_pathToSeperateDownloadPath
|
pluginPath = configValues.sftp_pathToSeperateDownloadPath
|
||||||
else:
|
else:
|
||||||
pluginPath = configValues.sftp_folderPath
|
pluginPath = configValues.sftp_folderPath
|
||||||
pluginPath = f"{pluginPath}/{plugin}"
|
pluginPath = f"{pluginPath}/{plugin}"
|
||||||
sftp = createSFTPConnection()
|
|
||||||
indexNumberUpdated += 1
|
indexNumberUpdated += 1
|
||||||
pluginsUpdated += 1
|
pluginsUpdated += 1
|
||||||
|
if configValues.sftp_useSftp:
|
||||||
|
sftp = createSFTPConnection()
|
||||||
try:
|
try:
|
||||||
getSpecificPackage(pluginId, configValues.sftp_folderPath)
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
if configValues.sftp_seperateDownloadPath is False:
|
if configValues.sftp_seperateDownloadPath is False:
|
||||||
sftp.remove(pluginPath)
|
sftp.remove(pluginPath)
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
@ -353,17 +348,11 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
pluginsUpdated -= 1
|
pluginsUpdated -= 1
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if configValues.sftp_seperateDownloadPath is True:
|
|
||||||
pluginPath = configValues.sftp_pathToSeperateDownloadPath
|
|
||||||
else:
|
|
||||||
pluginPath = configValues.sftp_folderPath
|
|
||||||
pluginPath = f"{pluginPath}/{plugin}"
|
|
||||||
ftp = createFTPConnection()
|
ftp = createFTPConnection()
|
||||||
indexNumberUpdated += 1
|
|
||||||
pluginsUpdated += 1
|
|
||||||
try:
|
try:
|
||||||
getSpecificPackage(pluginId, configValues.sftp_folderPath)
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
if configValues.sftp_seperateDownloadPath is False:
|
if configValues.sftp_seperateDownloadPath is False:
|
||||||
ftp.delete(pluginPath)
|
ftp.delete(pluginPath)
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
@ -376,12 +365,11 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
if configValues.seperateDownloadPath is True:
|
if configValues.seperateDownloadPath is True:
|
||||||
pluginPath = configValues.pathToSeperateDownloadPath
|
pluginPath = configValues.pathToSeperateDownloadPath
|
||||||
else:
|
else:
|
||||||
pluginPath = pluginFolderPath
|
pluginPath = configValues.pathToPluginFolder
|
||||||
pluginPath = Path(f"{pluginPath}/{plugin}")
|
|
||||||
indexNumberUpdated += 1
|
indexNumberUpdated += 1
|
||||||
pluginsUpdated += 1
|
pluginsUpdated += 1
|
||||||
try:
|
try:
|
||||||
getSpecificPackage(pluginId, pluginFolderPath)
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
if configValues.seperateDownloadPath is False:
|
if configValues.seperateDownloadPath is False:
|
||||||
os.remove(pluginPath)
|
os.remove(pluginPath)
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
|
Loading…
Reference in New Issue
Block a user