fixed upd/update

This commit is contained in:
OusmBlueNinja 2023-08-26 22:51:11 -05:00
parent b19dd70023
commit 6c1676da18
2 changed files with 21 additions and 20 deletions

View File

@ -1 +1 @@
[['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']]] [['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']], ['upd', 'packages.update', ['upd']]]

View File

@ -1,22 +1,23 @@
# -*- coding: utf-8 -*- #["upd", "packages.update", ["upd"]]
#["pip", "packages.pip", ["pip"]]
# Made By Blurple # Made By Blurple
import os, sys import os, sys, requests
fileList = [
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/builtin.py",
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/echo.py",
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/nano.py",
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/netget.py",
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/pip.py",
"https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/upd.py"
]
def pip(command: list): def upd(command):
input(f"Settings: {fileList}, {os.path.dirname(os.path.realpath(__file__))}\nPress enter to continue")
print(command, len(command)) for url in fileList:
if len(command) != 1: r = requests.get(url)
print("comand requires [ package_name ] [ args (optional) ] ") if 'Requests:' in r.text:
return print(r.text)
print(r.headers['Content-Type'])
package = command[0] fileInstallingCreator = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.basename(url))
try: with open(fileInstallingCreator, "w") as newFile:
from pip._internal import main as pipmain newFile.write(r.text)
pipmain(['install', {package}])
except ImportError:
os.system(f"pip install {package}")
except:
print("cannot download")