Skip to content

Commit

Permalink
yet another update
Browse files Browse the repository at this point in the history
  • Loading branch information
neek8044 committed Mar 11, 2023
1 parent e2fd78d commit 732fe7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ The project is Work-In-Progress and I am planning to add more compilation option
### Options
- `--onefile`, `--single`, `-o` - Compiles the output to a single file instead of a directory
- `--cwd-runtime`, `--runtime`, `-r` - Sets working dir to the local dir (where the file is ran from) upon execution. If your script reads local files, this is recommended.
- `--windows`, `--wine`, `-w` - Uses the Wine compatibility layer to compile a Microsoft Windows version of the program. (Wine needs to be installed separately. Both python and nuitka have to be installed inside of Wine afterwards.)
- `--debug`, `-d` - Shows nuitka output to the terminal instead of hiding it. (used to track errors, obviously)
- `--windows`, `--wine`, `-w` - Uses the Wine compatibility layer to compile a Microsoft Windows version of the program. (Wine needs to be installed separately. Both python, nuitka, and nuitka dependencies for Windows have to be installed inside of Wine afterwards.)
- `--debug`, `-d` - Shows command to be executed and nuitka output to the terminal instead of hiding it. (used to track errors, obviously)

### Usage
(example shows compilation process of a standalone onefile with fixed runtime directory)
Expand Down
17 changes: 12 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os

try:
from colorama import Fore
from colorama import Fore, Style
except ImportError:
print("--> Module 'colorama' not found. Run 'pip3 install colorama' to continue.")
sys.exit()
Expand All @@ -34,16 +34,23 @@

# Starting info
print(
"Report issues on Github: https://github.com/neek8044/NuitkaBuilder\n" + Fore.YELLOW + "NOTE: Linux requires 'patchelf' to be installed. Install it with your package manager if it does not work.\n" + "NOTE: You may want to install 'ordered-set' with 'pip3 install ordered-set' for best compilation performance.\n" + Fore.BLUE + "Building standalone directory for main.py" + Fore.RESET
"\nReport issues on Github: https://github.com/neek8044/NuitkaBuilder\n",
Fore.YELLOW + "\nNOTE: Linux requires 'patchelf' to be installed. Install it with your package manager if it does not work.\nYou may want to install 'ordered-set' with 'pip3 install ordered-set' for best compilation performance.",
Style.BRIGHT + "\nWARNING:" + Style.NORMAL, "Wine mode is UNSTABLE! If it throws an error it would be because of the instability of the mode. Do not try to fix your Wine installation if that happens.",
Fore.BLUE + "\n--> Building standalone for main.py" + Fore.RESET
)


# Executing nuitka for compilation
start = time.time()
full_command = str("wine " if wine else "") + f"python{'' if wine else '3'} -m nuitka --standalone {extras} --follow-imports --output-dir=\"{cwd}/output/\" main.py"

print(Fore.MAGENTA + "Executing: " + full_command + Fore.RESET) if debug else ...

nuitka = subprocess.Popen(
str("wine" if wine else "") + f"python3 -m nuitka --standalone {extras} --follow-imports --output-dir=\"{cwd}/output/\" main.py",
full_command,
cwd=cwd, shell=True,
stdout=subprocess.DEVNULL if debug == False else subprocess.STDOUT,
stdout=subprocess.DEVNULL if debug == False else None,
stderr=subprocess.STDOUT
)

Expand All @@ -53,7 +60,7 @@

while nuitka.poll() is None:
for i in anim_chars:
print("--> Please wait... " + i, end="\r")
print("--> Please wait, compiling... " + i, " "*10 if wine else "", end="\r")
time.sleep(0.1)


Expand Down

0 comments on commit 732fe7b

Please sign in to comment.