diff --git a/packages/pakk.conf b/packages/pakk.conf index d667610..92b94cf 100644 --- a/packages/pakk.conf +++ b/packages/pakk.conf @@ -1 +1 @@ -[['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']], ['upd', 'packages.update', ['upd']]] \ No newline at end of file +[['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']], ['upd', 'packages.update', ['upd']], ['pip', 'packages.pip', ['pip']]] \ No newline at end of file diff --git a/packages/update.py b/packages/update.py index d6113f4..e4ff3c9 100644 --- a/packages/update.py +++ b/packages/update.py @@ -1,6 +1,6 @@ #["upd", "packages.update", ["upd"]] # Made By Blurple -import os, sys, requests +import os, sys, requests, threading fileList = [ "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/builtin.py", @@ -11,13 +11,23 @@ fileList = [ "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/upd.py" ] +def download_and_save(url): + r = requests.get(url) + if 'Requests:' in r.text: + print(r.text) + print(r.headers['Content-Type']) + fileInstallingCreator = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.basename(url)) + with open(fileInstallingCreator, "w") as newFile: + newFile.write(r.text) + def upd(command): input(f"Settings: {fileList}, {os.path.dirname(os.path.realpath(__file__))}\nPress enter to continue") + + threads = [] for url in fileList: - r = requests.get(url) - if 'Requests:' in r.text: - print(r.text) - print(r.headers['Content-Type']) - fileInstallingCreator = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.basename(url)) - with open(fileInstallingCreator, "w") as newFile: - newFile.write(r.text) + thread = threading.Thread(target=download_and_save, args=(url,)) + threads.append(thread) + thread.start() + + for thread in threads: + thread.join()