Commit 8ab828fe authored by di68kap's avatar di68kap

- update_vscode_extension()-function added

parent bdfae1b0
......@@ -243,6 +243,36 @@ async def send_request(request, host, port):
return data.decode()
def update_vscode_extension():
import shutil
extensions = ['mlwquelle']
homedir = os.path.expanduser('~')
extensions_path = os.path.join(homedir, '.vscode', 'extensions')
extensions_src = os.path.join(homedir, 'MLW', 'MLW-Software', 'VSCode')
def ignore(directory, filelist):
filelist = [filename for filename in filelist if filename.lower() not in ('.git', )]
return directory, filelist
for extension in extensions:
if not os.path.exists(os.path.join(extensions_src, extension)):
print('Kann Erweiterung "%s" nicht aktualisieren, da keine Quelle dafür gefunden'
% extension)
dest_path = os.path.join(extensions_path, extension)
veraltet_path = os.path.join(extensions_path, extension + '_VERALTET')
if os.path.exists(dest_path):
os.rename(dest_path, veraltet_path)
shutil.copytree(os.path.join(extensions_src, extension), dest_path, ignore=ignore)
except shutil.Error as error:
print('Error %s while trying to install extension "%s".'% (error, extension))
if os.path.exists(veraltet_path):
print('Rolling back previous version of extension "%s".' % extension)
os.rename(veraltet_path, dest_path)
def start_server_daemon(host, port):
import subprocess, time
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment