Skip to content

Commit 7cb8ac7

Browse files
authored
Update binpython.py
Add many things
1 parent c124543 commit 7cb8ac7

File tree

1 file changed

+57
-21
lines changed

1 file changed

+57
-21
lines changed

binpython.py

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,84 @@
1-
#BINPython By:XINGYUJIE AGPL-V3.0 LECENSE Release
2-
#Please follow the LICENSE
3-
ver="0.15-beta"
1+
"""
2+
@header binpython.py
3+
@author xingyujie
4+
@abstract BINPython main file
5+
"""
6+
#BINPython By:XINGYUJIE AGPL-V3.0 LICENSE Release
7+
#Please follow the LICENSE AGPL-V3
8+
9+
####################################
10+
#configure
11+
12+
ver="0.15-stable"
13+
#Don't change
14+
15+
libs_warning="1"
16+
#1 is ture 0 is false.
17+
#Changing the value to 0 will close the prompt that the library does not exist
18+
19+
releases_ver="offical"
20+
importlibs="os" #Don't use "import xxx"
21+
#importlibs="<library>"
22+
#Imported library name, please use "importlibs="<library name>" instead of "import <library name>"
23+
24+
25+
####################################
26+
def self_import(name):
27+
__import__(name)
28+
try:
29+
self_import(importlibs)
30+
except ImportError:
31+
if libs_warning == "1":
32+
print("Warning: Custom import library %s does not exist, please check the source code library configuration and rebuild" % importlibs)
33+
print("")
34+
try:
435
#base import
5-
import getopt
6-
import sys
7-
import platform
8-
#fix some libs
9-
from sys import exit
36+
import getopt
37+
import sys
38+
import platform
39+
#fix for exit()
40+
from sys import exit
1041
#import for http_server
11-
import http.server
12-
import socketserver
42+
import http.server
43+
import socketserver
1344
#except ImportError:
14-
45+
except ImportError:
46+
print("Unable to use any library, the program does not work properly, please rebuild")
1547
#gui import
1648
try:
1749
import tkinter
1850
import turtle
1951
#warning for gui
2052
except ImportError:
21-
print("Warning: Some GUI (graphical) libraries for BINPython do not exist, such as tkinter and turtle. Because they are not built when they are built. If you need to fix this warning, please complete the support libraries imported in the source code at build time (use pip or build it yourself), if your system does not support these libraries, you can remove or change this hint in the source code and rebuild")
22-
print("")
53+
if libs_warning == "1":
54+
print("Warning: Some GUI (graphical) libraries for BINPython do not exist, such as tkinter and turtle. Because they are not built when they are built. If you need to fix this warning, please complete the support libraries imported in the source code at build time (use pip or build it yourself), if your system does not support these libraries, you can remove or change this hint in the source code and rebuild")
55+
print("")
2356

2457
#import math
2558
try:
2659
import fractions
2760
import cmath
2861
except ImportError:
29-
print("Warning: Some math or computation libraries for BINPython do not exist, such as fractions and cmath. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
30-
print("")
62+
if libs_warning == "1":
63+
print("Warning: Some math or computation libraries for BINPython do not exist, such as fractions and cmath. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
64+
print("")
3165
#rlcompleter
3266
#import for normal
3367
try:
3468
#str
3569
import rlcompleter
3670
import array
3771
except ImportError:
38-
print("Warning: Some libraries for functions, data types, etc. for BINPython do not exist, such as rlcomplter and array. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
39-
print("")
72+
if libs_warning == "1":
73+
print("Warning: Some libraries for functions, data types, etc. for BINPython do not exist, such as rlcomplter and array. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
74+
print("")
4075
try:
4176
import filecmp
4277
import tempfile
4378
except ImportError:
44-
print("Warning: Some file manipulation libraries for BINPython do not exist, such as filecmp and tempfile. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
45-
print("")
79+
if libs_warning == "1":
80+
print("Warning: Some file manipulation libraries for BINPython do not exist, such as filecmp and tempfile. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
81+
print("")
4682
#def
4783
def help():
4884
print("[*] BINPython Help")
@@ -65,7 +101,7 @@ def help():
65101
help()
66102
sys.exit()
67103
if opt_name in ('-v','--version'):
68-
print("BINPython " + ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
104+
print("BINPython " + ver + "-" + releases_ver + " By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
69105
print("Python " + platform.python_version())
70106
exit()
71107
if opt_name in ('-f','--file'):
@@ -89,7 +125,7 @@ def help():
89125
sys.exit()
90126
#main BINPython
91127

92-
print("BINPython " + ver + " (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
128+
print("BINPython " + ver + "-" + releases_ver + " (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
93129
print('Type "about", "help", "copyright", "credits" or "license" for more information.')
94130
try:
95131
while True:

0 commit comments

Comments
 (0)