exebuilder 0.3.2__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exebuilder-0.3.2 → exebuilder-0.4.0}/PKG-INFO +3 -3
- {exebuilder-0.3.2 → exebuilder-0.4.0}/ReadMe.md +2 -2
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder/__init__.py +54 -39
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder/__main__.py +4 -1
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/PKG-INFO +3 -3
- {exebuilder-0.3.2 → exebuilder-0.4.0}/pyproject.toml +1 -1
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/SOURCES.txt +0 -0
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/dependency_links.txt +0 -0
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/entry_points.txt +0 -0
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/requires.txt +0 -0
- {exebuilder-0.3.2 → exebuilder-0.4.0}/exebuilder.egg-info/top_level.txt +0 -0
- {exebuilder-0.3.2 → exebuilder-0.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: exebuilder
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A simple EXE builder for Python files.
|
|
5
5
|
Author: Victor Zou
|
|
6
6
|
Project-URL: Homepage, https://github.com/qzou1222-alt/exebuilder
|
|
@@ -54,13 +54,13 @@ Runs the Python file as a temporary EXE.
|
|
|
54
54
|
## CLI
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
exebuilder my_file.py
|
|
57
|
+
exebuilder my_file.py --logo my_pic.gif
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
or
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
python exebuilder.py my_file.py
|
|
63
|
+
python exebuilder.py my_file.py --logo my_pic.gif
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
creates:
|
|
@@ -43,13 +43,13 @@ Runs the Python file as a temporary EXE.
|
|
|
43
43
|
## CLI
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
exebuilder my_file.py
|
|
46
|
+
exebuilder my_file.py --logo my_pic.gif
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
or
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
python exebuilder.py my_file.py
|
|
52
|
+
python exebuilder.py my_file.py --logo my_pic.gif
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
creates:
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Build EXE files from Python files. (v0.
|
|
2
|
+
Build EXE files from Python files. (v0.4.0)
|
|
3
3
|
|
|
4
4
|
Contents Updated!
|
|
5
5
|
=================
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
build() add a parameter "logo". Enter any picture.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Usage
|
|
10
|
+
-----
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
CLI:
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
exebuilder your_file.py --logo your_pic.png
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Building Success
|
|
17
|
+
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Python:
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
<<< exebuilder.build("your_file.py",logo="your_pic.png")
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- All methods support .PY file now;
|
|
24
|
-
|
|
25
|
-
- Unified warning messages.
|
|
23
|
+
Building Success
|
|
26
24
|
|
|
27
25
|
Exebuilder
|
|
28
26
|
==========
|
|
@@ -36,7 +34,7 @@ Build a Python file into an EXE using PyInstaller.
|
|
|
36
34
|
API
|
|
37
35
|
---
|
|
38
36
|
|
|
39
|
-
- build(file, prt=True)
|
|
37
|
+
- build(file, logo=None, prt=True)
|
|
40
38
|
Build an EXE from a Python file.
|
|
41
39
|
|
|
42
40
|
- runasexe(file, warnprt=True, buildprt=False)
|
|
@@ -52,7 +50,9 @@ Utilities
|
|
|
52
50
|
Built-in warning messages.
|
|
53
51
|
"""
|
|
54
52
|
from pathlib import Path as _P
|
|
55
|
-
|
|
53
|
+
from PIL.Image import Image as _Image
|
|
54
|
+
PILImage=_Image
|
|
55
|
+
__version__ = "0.4.0"
|
|
56
56
|
def is_pyfile(file:str|_P) -> bool:
|
|
57
57
|
'''Return whether a file is a Python file.'''
|
|
58
58
|
if isinstance(file,_P):
|
|
@@ -119,33 +119,48 @@ def runasexe(pyfile: str | _P, warnprt:bool=True, buildprt:bool=False):
|
|
|
119
119
|
print(f"Running failed: {Warnings[4]}")
|
|
120
120
|
return False
|
|
121
121
|
return True
|
|
122
|
-
def build(pyfile:str|_P, prt:bool=True) -> bool:
|
|
122
|
+
def build(pyfile:str|_P, logo:str|_P|PILImage|None=None,prt:bool=True) -> bool:
|
|
123
123
|
'''Build an EXE from a python file. Prt controls whether messages are printed in the terminal.'''
|
|
124
124
|
import subprocess
|
|
125
125
|
import sys
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
pyfile
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
126
|
+
import tempfile
|
|
127
|
+
from PIL import Image
|
|
128
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
129
|
+
temp=_P(temp)
|
|
130
|
+
def logo_prep():
|
|
131
|
+
nonlocal logo
|
|
132
|
+
if logo is None:
|
|
133
|
+
return
|
|
134
|
+
elif isinstance(logo,(str,_P)):
|
|
135
|
+
logo=Image.open(logo)
|
|
136
|
+
logo.seek(0)
|
|
137
|
+
logo.save(temp/"logo.ico")
|
|
138
|
+
logo_prep()
|
|
139
|
+
if isinstance(pyfile, _P):
|
|
140
|
+
pyfile=str(pyfile)
|
|
141
|
+
if not _P(pyfile).exists():
|
|
142
|
+
if prt:
|
|
143
|
+
print(f"Building failed: {Warnings[5]}")
|
|
144
|
+
return False
|
|
145
|
+
if not is_pyfile(pyfile):
|
|
146
|
+
if prt:
|
|
147
|
+
print(f"Building failed: {Warnings[1]}")
|
|
148
|
+
return False
|
|
149
|
+
try:
|
|
150
|
+
subprocess.run([
|
|
151
|
+
sys.executable, "-m", "PyInstaller",
|
|
152
|
+
"--onefile",
|
|
153
|
+
*(("--icon",
|
|
154
|
+
str(temp/"logo.ico")) if logo else ()),
|
|
155
|
+
pyfile,
|
|
156
|
+
],check=True,
|
|
157
|
+
stdout=subprocess.DEVNULL if not prt else None,
|
|
158
|
+
stderr=subprocess.DEVNULL if not prt else None)
|
|
159
|
+
except subprocess.CalledProcessError:
|
|
160
|
+
if prt:
|
|
161
|
+
print(f"Building failed: {Warnings[2]}")
|
|
162
|
+
return False
|
|
145
163
|
if prt:
|
|
146
|
-
print(
|
|
147
|
-
return False
|
|
148
|
-
if prt:
|
|
149
|
-
print("Building success")
|
|
164
|
+
print("Building success")
|
|
150
165
|
return True
|
|
151
166
|
Warnings._private=True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: exebuilder
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A simple EXE builder for Python files.
|
|
5
5
|
Author: Victor Zou
|
|
6
6
|
Project-URL: Homepage, https://github.com/qzou1222-alt/exebuilder
|
|
@@ -54,13 +54,13 @@ Runs the Python file as a temporary EXE.
|
|
|
54
54
|
## CLI
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
exebuilder my_file.py
|
|
57
|
+
exebuilder my_file.py --logo my_pic.gif
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
or
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
python exebuilder.py my_file.py
|
|
63
|
+
python exebuilder.py my_file.py --logo my_pic.gif
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
creates:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|