Skip to content

The Actual Building Process ‐ Building Temp_Cleaner GUI from source

Ziad edited this page Jul 31, 2025 · 1 revision

Must know before you continue:

  • The main source file is the file that contains the main window UI class, it is the source file that contains the code to be executed when the program is ran (via its main executable .exe file).
  • The build script currently generates a full command line that will be executed via pyinstaller to generate an executable file out of the source files it has provided.
  • Please make sure to read through this page at least once before doing anything, because if you don't, chances are high that you will miss an important step or an important note causing your build process to fail or generate a malfunctioned executable.
  • This build script does not generate a cross-platform (or multi-architecture) executable. This means that if you want to build a copy of Temp_Cleaner GUI targeting Windows 10 64-bit (for example), you must run the script on a device running Windows 10 64-bit. If you want wider compatibility with older versions of Windows, it's best to run the script on a PC running the oldest version of Windows you want the program to support.
  • DO NOT EVER MODIFY ANYTHING THAT HAS A COMMENT THAT SAYS "DO NOT MODIFY" OR "DO NOT EDIT" OR ANYTHING SIMILAR, ALSO BE SURE TO CAREFULLY READ THE COMMENTS WRITTEN ABOVE ANY VARIABLE (OR CONSTANT), AND AS ALWAYS, DO NOT MAKE MODIFICATIONS YOU AREN'T 100% CERTAIN OF.
  • cmd is the Terminal of the Windows operating system, usually called Windows Command Prompt, Command Processor, or simply Command Prompt.
  • Yes, VMs (Virtual Machines) can be used to build this program from source (I don't put any Anti-VM stuff).
  • It is ALWAYS recommended that you run the tests before attempting to build this program, so if you haven't run the necessary tests please read this page that clearly explains how to do that
  • To avoid confusions, and make the building process easier for you, Always make sure you are storing all the files of the cloned repository in the one directory, You should have done that already if you have followed this guide from the beginning (or in technical terms, DO NOT modify the directory structure of the locally cloned repository after it has been successfully cloned).
  • Please carefully and precisely follow this guide (yes, I know — I'm repeating myself to help you avoid making that mistake) and do not add or modify any steps based on personal preference (just because you think it will make it better doesn't mean it will).

Steps

2-Open the directory where you cloned the repository

If you’ve been following this guide from the beginning, the folder should be C:\tcg_src.

3-Open the file build.py on your favorite code editor

This step is important, because you still have to modify some constants for the build script to work.

When you open the build script file on your favorite code editor, you should see these comment lines:

# ==================================================
# ==================================================
# CONSTANTS
# ==================================================
#
#  
# Constants that control the building process will be here.
# 
# 
# **DO NOT MODIFY ANYTHING THAT COMES AFTER THESE 2 DIVIDERS**
# ==================================================
# ==================================================

Only constants that are in place of this comment: # Constants that control the building process will be here. are the ones you should edit.

Here are the constants you will need to modify (ONLY MODIFY THEIR VALUES, the text next to the equal = sign):

  • FULL_SRC_PATH: This is a String (str) value that represents the full path to the folder of the locally cloned repository, in this case it will be "C:\\tcg_src"

    NOTE: If you are on Windows, you need to double the \ (backslashes) so path separators won't be interpreted as escape characters.

  • OUT_DIR: This is a String (str) value that represents the full path to the folder where the output of the building process will be stored -- including the final executable file (and its related files), Based on the earlier steps, this path would typically be "C:\\tcg_src\\build\\out"...

    You can create that folder if it isn't already there:

    mkdir C:\tcg_src\build\out
  • BUILD_TMP_DIR: This is a String (str) value that represents the full path to the folder used to store temporary files during the building process, again, based on the earlier steps, this path would typically be "C:\\tcg_src\\build\\tmp"...

    You can create that folder if it isn't already there:

    mkdir C:\tcg_src\build\tmp
  • IS_FULL_BUILD: This is a Boolean (bool) value that indicates whether the resulting build is a full build.

    • A full build is essentially a build that uses a dedicated directory to store its executable and related files. This contrasts with portable builds, which are single-file executables that bundle all dependencies internally and extract them to a temporary directory at runtime, this also controls whether pyinstaller will build the executable in one file or one directory mode.
  • EXECUTABLE_ICON: This is a String (str) value that represents the full path to the icon file used for the executable once it's built, so, based on the earlier steps, this path would typically be "C:\\tcg_src\\icon0.ico"

  • NAME: This is a String (str) value that specifies the folder and executable names. it is recommended to leave it as it is.

  • RT_TMP_DIR: This is a String (str) value that represents the full path to the temporary folder used at runtime (when not in full build mode) to store files related to the executable. You won't need to modify this in most cases.

  • VERSION_FILE: This is a String (str) value that specifies the full path to the version file to be bundled into the final executable.

  • DISPLAY_MODE: This accepts another constant as its value -- either CONSOLE, or WINDOWED-- and is used to control the display mode of the final executable. in CONSOLE mode, the console window is enabled and shown at startup, in contrast to WINDOWED mode, where the console window is disabled and completely hidden.

    • Please note that official Temp_Cleaner GUI debug builds use the CONSOLE mode, while regular builds use WINDOWED mode.
  • RT_DEBUGGING_LEVEL: This can be either a String (str), or a None (None) keyword that controls the verbosity of runtime debugging for the final executable. It only accepts the following string values "all", "imports", "bootloader", "noarchive", or None.

    • Official Temp_Cleaner GUI debug builds use "imports", while regular builds use None to disable runtime debugging for the final executable.
    • Please note that runtime debugging logs are only shown when display mode is set to CONSOLE
  • MAIN_PROG_SRC_FILE: This accepts a String (str) value that represents the main source file's name (without the .py file extension). You can refer to this page if you need help finding the name of the latest main source file

  • SET_FIRSTRUN_VALUE: This accepts a Boolean (bool) value that should control whether this script will set the FirstRun key to 1 in the program's configuration file before starting the build process.

    • Configuring this value is required for the OOBE window to be displayed on the first run of the final build.
    • This is not a value you will want to modify.

4-Launch a new command prompt window, and run the build script

This step is the easiest among others, assuming you have done the necessary modifications to the constants in the build script as described above, all you have to do is:

  • Open a new command prompt window.
  • Navigate using the cd command to the folder where the build script is in --which is usually where the repository is cloned locally, so based on the earlier steps it should be C:\tcg_src--
  • Run py build.py (or py -X.x build.py if you want to use Python version X.x, for example: py -3.11 build.py if you want to use Python version 3.11)
  • Wait for the build process to complete. If it finishes successfully, the final executable — along with its related files — will be stored in the directory specified by OUT_DIR.