shethjenil
commited on
Upload 2 files
Browse files- .gitattributes +1 -0
- CLOUDSOFTWARE.exe +3 -0
- CLOUDSOFTWARE.py +88 -0
.gitattributes
CHANGED
@@ -47,3 +47,4 @@ YTSEARCH.exe filter=lfs diff=lfs merge=lfs -text
|
|
47 |
ProgInject.exe filter=lfs diff=lfs merge=lfs -text
|
48 |
HandWriteMachine.exe filter=lfs diff=lfs merge=lfs -text
|
49 |
BROWSER.exe filter=lfs diff=lfs merge=lfs -text
|
|
|
|
47 |
ProgInject.exe filter=lfs diff=lfs merge=lfs -text
|
48 |
HandWriteMachine.exe filter=lfs diff=lfs merge=lfs -text
|
49 |
BROWSER.exe filter=lfs diff=lfs merge=lfs -text
|
50 |
+
CLOUDSOFTWARE.exe filter=lfs diff=lfs merge=lfs -text
|
CLOUDSOFTWARE.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ceac53fcb8c1e596795e6ead7529392a25e17d3bdba7ffb7ae06cebab2eaf505
|
3 |
+
size 19346188
|
CLOUDSOFTWARE.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from subprocess import Popen,PIPE ,DEVNULL
|
2 |
+
from sys import exit as sys_exit
|
3 |
+
from os import remove
|
4 |
+
from shutil import rmtree , move
|
5 |
+
from tkinter.messagebox import showwarning , askokcancel
|
6 |
+
from tkinter.simpledialog import askstring
|
7 |
+
from tkinter.filedialog import askopenfilename , asksaveasfilename
|
8 |
+
from PyInstaller.utils.hooks import collect_submodules
|
9 |
+
if Popen("pyinstaller",stderr=PIPE).communicate()[0]:
|
10 |
+
if not Popen("python -m pip",stderr=PIPE).communicate()[0]:
|
11 |
+
Popen("python -m pip install pyinstaller",stderr=DEVNULL,stdout=DEVNULL).communicate()
|
12 |
+
else:
|
13 |
+
showwarning("Python is required to run this program")
|
14 |
+
sys_exit()
|
15 |
+
def add_modules()->list:
|
16 |
+
while True:
|
17 |
+
items = []
|
18 |
+
item = askstring("module","Enter the modules")
|
19 |
+
if item:
|
20 |
+
items.append(item)
|
21 |
+
else:
|
22 |
+
return items
|
23 |
+
def add_submodules()->list:
|
24 |
+
while True:
|
25 |
+
items = []
|
26 |
+
item = askstring("submodule","Enter the submodules")
|
27 |
+
if item:
|
28 |
+
items.append(item)
|
29 |
+
else:
|
30 |
+
return items
|
31 |
+
def makesof(name:str,linkofcode:str,modules:list,submodules:list,gui:bool=False,importsubmodules:bool=True,saveas:str=None):
|
32 |
+
if importsubmodules:
|
33 |
+
#import module's all sub modules
|
34 |
+
allsubmodules = []
|
35 |
+
for i in modules:
|
36 |
+
allsubmodules.extend(collect_submodules(i))
|
37 |
+
submodules = list(set(allsubmodules + submodules))
|
38 |
+
|
39 |
+
command = ["pyinstaller","--noconfirm","--clean","--onefile","--icon",askopenfilename(filetypes=[("Image","*.jpg *.jpeg *.png")],title="ICON"),"--name",name]
|
40 |
+
if gui:
|
41 |
+
command.append("--windowed")
|
42 |
+
for mudule in modules:
|
43 |
+
command.extend(["--hidden-import",mudule])
|
44 |
+
for module in submodules:
|
45 |
+
command.extend(["--collect-submodules",module])
|
46 |
+
command.append(f"{name}.py")
|
47 |
+
open(f"{name}.py","w").write(f"""
|
48 |
+
from sys import _MEIPASS as cdir , exit as sys_exit
|
49 |
+
from tkinter.messagebox import showerror
|
50 |
+
from os import chdir
|
51 |
+
from requests import get
|
52 |
+
chdir(cdir)
|
53 |
+
pytext = str()
|
54 |
+
try:
|
55 |
+
pytext = get("{linkofcode}",timeout=5).text
|
56 |
+
except Exception:
|
57 |
+
showerror("Connection Error","Could not connect to the internet")
|
58 |
+
sys_exit()
|
59 |
+
try:
|
60 |
+
exec(pytext)
|
61 |
+
except Exception as e:
|
62 |
+
showerror("Error",e)
|
63 |
+
""")
|
64 |
+
Popen(command,shell=True,stdout=DEVNULL,stderr=DEVNULL).communicate()
|
65 |
+
move(f"dist/{name}.exe",saveas)
|
66 |
+
remove(f"{name}.py")
|
67 |
+
rmtree("build")
|
68 |
+
remove(f"{name}.spec")
|
69 |
+
rmtree("dist")
|
70 |
+
makesof(name = askstring("Name","Enter the name of the software"),
|
71 |
+
linkofcode = askstring("Link","Enter the link of the code"),
|
72 |
+
modules = add_modules(),
|
73 |
+
submodules = add_submodules(),
|
74 |
+
gui=askokcancel("GUI mode","Do you want to run this program in GUI mode?"),
|
75 |
+
importsubmodules=askokcancel("Import submodules","Do you want to import all submodules of the modules?"),
|
76 |
+
saveas=asksaveasfilename(filetypes=[("Executable","*.exe")],title="Executable",initialfile="software.exe")
|
77 |
+
)
|
78 |
+
# from argparse import ArgumentParser
|
79 |
+
# arg = ArgumentParser(description="Make a software using python")
|
80 |
+
# arg.add_argument("-n","--name",type=str,help="Name of the software")
|
81 |
+
# arg.add_argument("-l","--link",type=str,help="Link of the code")
|
82 |
+
# arg.add_argument("-m","--modules",type=str,nargs="+",help="Modules to import")
|
83 |
+
# arg.add_argument("-s","--submodules",type=str,nargs="+",help="Submodules to import")
|
84 |
+
# arg.add_argument("-g","--gui",action="store_true",help="Run the software in GUI mode")
|
85 |
+
# arg.add_argument("-i","--importsubmodules",action="store_true",help="Import all submodules of the modules")
|
86 |
+
# arg.add_argument("-o","--output",type=str,help="Output file name")
|
87 |
+
# args = arg.parse_args()
|
88 |
+
# makesof(args.name,args.link,args.modules,args.submodules,args.gui,args.importsubmodules,args.output)
|