|
1 | 1 | #BINPython By:XINGYUJIE AGPL-V3.0 LECENSE Release |
2 | 2 | #Please follow the LICENSE |
| 3 | + |
| 4 | +#base import |
3 | 5 | import getopt |
4 | 6 | import sys |
5 | 7 | import platform |
| 8 | +#gui import |
| 9 | +try: |
| 10 | + import tkinter |
| 11 | + import turtle |
| 12 | +#warning for gui |
| 13 | +except: |
| 14 | + 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") |
| 15 | + print("") |
| 16 | + |
| 17 | +#import math |
| 18 | +try: |
| 19 | + import fractions |
| 20 | + import cmath |
| 21 | +except: |
| 22 | + 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") |
| 23 | + print("") |
| 24 | +#rlcompleter |
| 25 | +#import for normal |
| 26 | +try: |
| 27 | + #str |
| 28 | + import rlcompleter |
| 29 | + import array |
| 30 | +except: |
| 31 | + 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") |
| 32 | + print("") |
| 33 | +try: |
| 34 | + import filecmp |
| 35 | + import tempfile |
| 36 | +except: |
| 37 | + 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") |
| 38 | + print("") |
| 39 | +#getopt |
6 | 40 | opts,args = getopt.getopt(sys.argv[1:],'-h-f:-v',['help','file=','version']) |
7 | 41 | for opt_name,opt_value in opts: |
8 | 42 | if opt_name in ('-h','--help'): |
|
14 | 48 | """) |
15 | 49 | sys.exit() |
16 | 50 | if opt_name in ('-v','--version'): |
17 | | - print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release") |
| 51 | + print("BINPython By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release") |
18 | 52 | print("Python " + platform.python_version()) |
19 | 53 | exit() |
20 | 54 | if opt_name in ('-f','--file'): |
21 | 55 | file = opt_value |
22 | | - #print("[*] Filename is ",file) |
23 | 56 | f = open(file,encoding = "utf-8") |
24 | 57 | exec(f.read()) |
25 | | - #codeline=f.read() |
26 | | - #codeline |
27 | 58 | input("Please enter to continue") |
28 | 59 | sys.exit() |
| 60 | +#main BINPython |
29 | 61 |
|
30 | | -print("BINPython 0.12 (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie[Running on " + platform.platform() + " " + platform.version() + "]") |
| 62 | +print("BINPython 0.14 (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]") |
31 | 63 | print('Type "about", "help", "copyright", "credits" or "license" for more information.') |
32 | | - |
33 | | -while True: |
34 | | - x=input('>>> ') |
35 | | - if x in globals().keys(): |
36 | | - print(globals()[x]) |
37 | | - continue |
38 | | - elif x == 'about': |
39 | | - print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release") |
40 | | - elif x == 'help': |
41 | | - print("Type help() for interactive help, or help(object) for help about object.") |
42 | | - elif x == 'copyright': |
43 | | - print(""" |
44 | | -Copyright (c) 2001-2022 Python Software Foundation and BINPython xingyujie(https://github.com/xingyujie). |
| 64 | +try: |
| 65 | + while True: |
| 66 | + pycmd=input('>>> ') |
| 67 | + if pycmd in globals().keys(): |
| 68 | + print(globals()[pycmd]) |
| 69 | + continue |
| 70 | + elif pycmd == 'about': |
| 71 | + print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release") |
| 72 | + elif pycmd == 'help': |
| 73 | + print("Type help() for interactive help, or help(object) for help about object.") |
| 74 | + elif pycmd == 'copyright': |
| 75 | + print(""" |
| 76 | +Copyright (c) 2001-2022 Python Software Foundation and BINPython xingyujie(https://github.com/xingyujie/binpython). |
45 | 77 | All Rights Reserved. |
46 | 78 |
|
47 | 79 | Copyright (c) 2000 BeOpen.com. |
|
53 | 85 | Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. |
54 | 86 | All Rights Reserved. |
55 | 87 | """) |
56 | | - elif x == 'credits': |
57 | | - print(""" |
| 88 | + elif pycmd == 'credits': |
| 89 | + print(""" |
58 | 90 | Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands |
59 | 91 | for supporting Python development. See www.python.org for more information. |
60 | 92 | """) |
61 | | - elif x == 'license': |
62 | | - print("Type license() to see the full license text") |
63 | | - try: |
64 | | - exec(x) |
65 | | - except Exception as err: |
66 | | - print(err) |
| 93 | + elif pycmd == 'license': |
| 94 | + print("Type license() to see the full license text") |
| 95 | + try: |
| 96 | + exec(pycmd) |
| 97 | + except Exception as err: |
| 98 | + print(err) |
| 99 | +except KeyboardInterrupt: |
| 100 | + print("EXIT!") |
| 101 | + sys.exit() |
| 102 | + |
0 commit comments