Skip to content

Commit 790fe9a

Browse files
committed
0.36
1 parent 565feeb commit 790fe9a

File tree

2 files changed

+45
-16
lines changed

2 files changed

+45
-16
lines changed

binpythonfull.py

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
####################################
1111
#build configure
1212

13-
ver = "0.34-build-full"
13+
ver = "0.36-build-full"
1414

1515
libs_warning = "1"
1616
#1 is ture 0 is false.
@@ -19,8 +19,8 @@
1919
buildversion = "plus" #plus version and standard version
2020

2121
releases_ver = "offical" + buildversion + "-building"
22-
importlibs = "os" #Don't use "import xxx"
23-
cloudrunver = "1.01"
22+
importlibs = "os"
23+
cloudrunver = "1.03"
2424
#Imported library name, please use "importlibs="<library name>" instead of "import <library name>"
2525
#Please note: The "importlibs" function does not support loading functions (such as from xxxx import xxxx, if necessary, please write it in the following location. However, please note that this operation may have the risk of error reporting, please report issues or solve it yourself
2626
#xxxxxxxxxxxxxx
@@ -44,6 +44,7 @@ def releases_ver():
4444

4545
def build_importlibs():
4646
print(importlibs)
47+
import time
4748
#get system info(windows or linux ...)
4849
import platform
4950
sys = platform.system()
@@ -80,22 +81,27 @@ def optreadfile():
8081
sys.exit(0)
8182
class cloudrun:
8283
def get(pkgname):
84+
try:
85+
sources = open("cloudrun_config/sources.config", "r")
86+
sources = str(sources.read()) + pkgname + ".py"
87+
except:
88+
sources = f"https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/{pkgname}.py"
8389
try:
8490
cloudrunenv = True
85-
getcoderes = urllib.request.urlopen(f"https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/{pkgname}.py")
91+
getcoderes = urllib.request.urlopen(sources)
8692
except(Exception, BaseException) as error:
8793
print("There is no network connection or the repository does not exist for this script")
8894
print("Error details are in cloudrun_error.log in the run directory")
8995
f = open("cloudrun_error.log", "a")
90-
f.write(str(error))
96+
f.write('Get Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
9197
try:
9298
exec(str(getcoderes.read().decode('utf-8')))
9399
getcoderes.close()
94100
except(Exception, BaseException) as error:
95101
print("run failed")
96102
print("Error details are in cloudrun_error.log in the run directory")
97103
f = open("cloudrun_error.log", "a")
98-
f.write(str(error))
104+
f.write('Run Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
99105
def load(url):
100106
try:
101107
cloudrunenv = True
@@ -104,15 +110,22 @@ def load(url):
104110
print("There is no network connection or the repository does not exist for this script")
105111
print("Error details are in cloudrun_error.log in the run directory")
106112
f = open("cloudrun_error.log", "a")
107-
f.write(str(error))
113+
f.write('Get Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
108114
try:
109115
exec(getcoderes.read().decode('utf-8'))
110116
getcoderes.close()
111117
except(Exception, BaseException) as error:
112118
print("run failed")
113119
print("Error details are in cloudrun_error.log in the run directory")
114120
f = open("cloudrun_error.log", "a")
115-
f.write(str(error))
121+
f.write('Run Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
122+
def editsource(url):
123+
try:
124+
os.mkdir("cloudrun_config")
125+
except:
126+
pass
127+
sources = open("cloudrun_config/sources.config", "w")
128+
sources.write(url)
116129
try:
117130
#base import
118131
import getopt
@@ -176,7 +189,7 @@ def importpygame():
176189
print("")
177190
#main BINPython
178191
def binpython_welcome_text():
179-
print("BINPython " + ver + "-" + releases_ver + " (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
192+
print("BINPython " + ver + "-" + releases_ver + " (Python Version:" + platform.python_version() + ") By: Edward Hsing(Xing Yu Jie) https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
180193
print('Type "about", "help", "copyright", "credits" or "license" for more information.')
181194
def binpython_shell():
182195
while True:
@@ -186,7 +199,7 @@ def binpython_shell():
186199
print(globals()[pycmd])
187200
continue
188201
elif pycmd == 'about':
189-
print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
202+
print("BINPython By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
190203
elif pycmd == 'help':
191204
print("Type help() for interactive help, or help(object) for help about object.")
192205
elif pycmd == 'copyright':
@@ -257,7 +270,7 @@ def outputfullhelp():
257270
print("Additional options for the plus version")
258271
print(helpinfoplus)
259272
#set about info
260-
about = "BINPython " + ver + "-" + releases_ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release"
273+
about = "BINPython " + ver + "-" + releases_ver + " By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release"
261274
#getopt
262275
try:
263276
#set options
@@ -282,7 +295,7 @@ def outputfullhelp():
282295
exec(f.read())
283296
print("Powered by: BINPython[https://github.com/xingyujie/binpython] AGPL 3.0")
284297
except:
285-
print("BINPython " + ver + "-" + releases_ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
298+
print("BINPython " + ver + "-" + releases_ver + " By: Edward Hsing(Xing Yu Jie)[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
286299
print("Python " + platform.python_version())
287300
sys.exit()
288301
if opt_name in ('-f','--file'):
@@ -606,22 +619,37 @@ def examplerequests():
606619
CloudRun Help:
607620
get -- Enter application/script name to get run from software repository
608621
load -- Run scripts from custom URL
622+
editsource -- Set up custom sources and save via configuration files
623+
shell -- Go to BINPython Shell
609624
version -- CloudRun Version
610-
help -- run this help
625+
help -- show this help
611626
""")
612627
if cloudruncli == 'get':
613628
print("Get apps/scripts in software repository")
614629
print("Under normal circumstances, we review the code of the software repositories and generally do not have any malware. But we will not take any legal responsibility")
615630
print()
616631
pkgname = input("packagename: ")
617-
cloudrun.get(pkgname)
632+
if pkgname == '':
633+
pass
634+
else:
635+
cloudrun.get(pkgname)
618636
if cloudruncli == 'load':
619637
print("Let CloudRun run scripts through a custom server")
620638
print("The format should be like this: http://domain.com/filename.py")
621639
url = input("Python script URL: ")
622-
cloudrun.load(url)
640+
if url == '':
641+
pass
642+
else:
643+
cloudrun.load(url)
644+
if cloudruncli == 'editsource':
645+
print('caution! The set software source must be in a standard format, otherwise it may not work, like http://127.0.0.1/, if you set http://127.0.0.1, it will not work properly, even if there is one less "/"!')
646+
entersource = input("Please input sources server address: ")
647+
cloudrun.editsource(entersource)
648+
print("success!")
649+
if cloudruncli == 'shell':
650+
binpython_shell()
623651
if cloudruncli == 'version':
624-
print(f"CloudRun-{cloudrunver} BINPython version By:Edward Hsing(xingyujie) AGPL-3.0 LICENSE")
652+
print(f"CloudRun-{cloudrunver} BINPython version By:Edward Hsing(Xing Yu Jie) AGPL-3.0 LICENSE")
625653
if cloudruncli == '':
626654
pass
627655
else:

cloudrun_config/sources.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://raw.githubusercontent.com/xingyujie/cloudrun-repository/main/

0 commit comments

Comments
 (0)