Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.7 KB

README.md

File metadata and controls

40 lines (33 loc) · 1.7 KB

Python Build Scripts

This repository contains automation scripts for compiling Python scripts into standalone executable applications using PyInstaller.

Features

  • Cross-platform support: Includes both .sh (Bash) and .ps1 (PowerShell) scripts.
  • Architecture Detection (Linux): The Linux script automatically appends the processor architecture (e.g., _x86_64 or _aarch64) to the output filename for better identification.
  • Auto GUI Detection: Automatically scans the source code for GUI libraries (like tkinter, PyQt, customtkinter, etc.) and sets the --noconsole flag accordingly.
  • Interactive Selection: Provides a menu to choose which .py file you want to compile.
  • Clean Workspace: Automatically moves the build results to the root folder and cleans up temporary build/, dist/, and .spec files.
  • Pre-configured imports: Includes support for common libraries like openpyxl.

Requirements

  • Python 3.x
  • pyinstaller installed (pip install pyinstaller)
  • (Optional) whiptail for the Linux version menu.

Usage

Windows (PowerShell)

Run the build.ps1 script:

./build.ps1

Linux / macOS (Bash)

Run the build.sh script:

chmod +x build.sh
./build.sh

How it works

  1. The script identifies the project folder name.
  2. Linux only: Detects system architecture using uname -m and incorporates it into the app name.
  3. It searches for all .py files in the current directory.
  4. The user selects a file via a CLI menu.
  5. The script checks if the selected file requires a console or a GUI window.
  6. PyInstaller is executed with optimized flags.
  7. The final executable is moved to the root directory for easy access.