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 -*-
#["pip", "packages.pip", ["pip"]]
#["upd", "packages.update", ["upd"]]
# 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):
print(command, len(command))
if len(command) != 1:
print("comand requires [ package_name ] [ args (optional) ] ")
return
package = command[0]
try:
from pip._internal import main as pipmain
pipmain(['install', {package}])
except ImportError:
os.system(f"pip install {package}")
except:
print("cannot download")
def upd(command):
input(f"Settings: {fileList}, {os.path.dirname(os.path.realpath(__file__))}\nPress enter to continue")
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)