Skip to content

Commit 155edbf

Browse files
committed
0.43
1 parent 79f59db commit 155edbf

File tree

8 files changed

+45
-21
lines changed

8 files changed

+45
-21
lines changed

binpythonfull.py

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

13-
ver = "0.41-build-full"
13+
ver = "0.43-build-full"
1414

1515
libs_warning = "1"
1616
#1 is ture 0 is false.
@@ -19,8 +19,8 @@
1919

2020
releases_ver = "offical"
2121
importlibs = "os"
22-
cloudrunver = "1.03"
23-
cmdver = "0.04"
22+
cloudrunver = "1.04"
23+
cmdver = "0.06"
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
@@ -97,6 +97,7 @@ def optreadfile():
9797
import requests
9898
import urllib
9999
import wget
100+
import shutil
100101

101102
#fix for exit()
102103
from sys import exit
@@ -197,7 +198,9 @@ def binpython_shell():
197198
optreadfile()
198199
except:
199200
pass
200-
201+
def execpyfile(filename):
202+
f = open(filename)
203+
exec(f.read())
201204
def cloudruncli():
202205

203206
print("Welcome to CloudRun CLI. Let your script run in the cloud with BINPython")
@@ -304,6 +307,11 @@ def listfiles():
304307
dirs = os.listdir("./")
305308
for file in dirs:
306309
print (file)
310+
def listfilesfunc(path):
311+
import os
312+
dirs = os.listdir(path)
313+
for file in dirs:
314+
print (file)
307315
def download(url,path):
308316
if not os.path.exists(path):
309317
os.mkdir(path)
@@ -413,7 +421,10 @@ def do_seteditor(self, arg):
413421
def do_edit(self, arg):
414422
'Before using this command, you must use "seteditor <editorname>" to set the editor (see the usage of this parameter for details), otherwise it cannot be called up. edit usage: edit <filename>'
415423
defaulteditor = open(runpath + f"/binpython_files/userdata/home/{cmd_username}/defaulteditor.config", "r")
416-
os.system(defaulteditor.read() + ' ' + arg)
424+
try:
425+
os.system(defaulteditor.read() + ' ' + arg)
426+
except KeyboardInterrupt:
427+
pass
417428
def do_exit(self, arg):
418429
'exit shell'
419430
sys.exit()
@@ -480,7 +491,8 @@ def do_install(self, arg):
480491
except(Exception, BaseException) as error:
481492
print('The package does not exist or system error, please see the log "install_error.log" for details')
482493
f = open("install_error.log", "a")
483-
f.write('Install Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
494+
f.write('Install Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + f" {appsource}{arg}.bpkg " + str(error) +'\n')
495+
exit()
484496
try:
485497
print("[*] Unzip the package")
486498
unzip(runpath + f"/binpython_files/apps/{cmd_username}/installtemp/{arg}.bpkg", runpath + f"/binpython_files/apps/{cmd_username}/{arg}")
@@ -534,8 +546,13 @@ def do_installfile(self, arg):
534546
f.write('Run package configuration file Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
535547
print("[OK]Finished!")
536548
def do_switchappdir(self, arg):
537-
'Switch to App dir. Usage: switchappdir <appname>'
538-
os.chdir(runpath + f"/binpython_files/apps/{cmd_username}/{arg}")
549+
'Switch to App directory. Usage: switchappdir <appname>'
550+
try:
551+
os.chdir(runpath + f"/binpython_files/apps/{cmd_username}/{arg}")
552+
except(Exception, BaseException) as error:
553+
print('Can not switch app directory, please see the log "binpython_pkg_error.log" for details')
554+
f = open("binpython_pkg_error.log", "a")
555+
f.write('Switch package directory Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
539556
def do_runapp(self, arg):
540557
'To run a BINPython bpkg program, first pass install <app name> or installfile <app package path> Usage: runapp <appname>. '
541558
try:
@@ -545,6 +562,26 @@ def do_runapp(self, arg):
545562
print('App not exits or failed, please see the log "binpython_pkg_error.log" for details')
546563
f = open("binpython_pkg_error.log", "a")
547564
f.write('Run package Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
565+
def do_removeapp(self, arg):
566+
'To delete a BINPython application, usage: removeapp <appname>'
567+
try:
568+
shutil.rmtree(runpath + f"/binpython_files/apps/{cmd_username}/{arg}")
569+
except(Exception, BaseException) as error:
570+
print('App not exits or failed, please see the log "binpython_pkg_error.log" for details')
571+
f = open("binpython_pkg_error.log", "a")
572+
f.write('Remove package Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
573+
def do_listapps(self, arg):
574+
'List installed BINPython applications'
575+
try:
576+
listfilesfunc(runpath + f"/binpython_files/apps/{cmd_username}")
577+
except(Exception, BaseException) as error:
578+
print('Can not list apps, please see the log "binpython_pkg_error.log" for details')
579+
f = open("binpython_pkg_error.log", "a")
580+
f.write('List package Error: ' + time.strftime('%m-%d-%Y %H:%M:%S',time.localtime(time.time())) + ' ' + str(error) + '\n')
581+
def do_editsouce(self, arg):
582+
'To change the software source, usage: editsouce <souceurl>. Please pay attention to the software source specification, otherwise you will get an error. <souceurl> like this: http://xxx.com/'
583+
f = open(runpath + f"/binpython_files/apps/source.config", "w")
584+
f.write(arg)
548585
if __name__ == '__main__':
549586
cmdshell().cmdloop()
550587
#cmd end

dist/binpython.exe

-14.3 MB
Binary file not shown.

dist/binpython_files/apps/source.config

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/binpython_files/apps/xingyujie/pywebhi/main.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

dist/binpython_files/userdata/defaultloginuser

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/binpython_files/userdata/home/xingyujie/binpython_pkg_error.log

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/binpython_files/userdata/home/xingyujie/defaulteditor.config

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/binpython_files/userdata/home/xingyujie/install_warning.log

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)