Skip to content

Commit 000a6a1

Browse files
committed
feat: Add build script to create zip archives of the application, update gitignore, and document the new build process.
1 parent 369fa81 commit 000a6a1

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ config.ini
1010
build/
1111
dist/
1212
*.spec
13+
*.zip

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ RainingKeysPython/
6464

6565
## Usage
6666

67-
1. Run the application:
67+
1. Run the build script:
6868
```bash
69-
python main.py
69+
python build.py
7070
```
71-
2. **Two windows will appear**:
72-
- The transparent **Overlay** (shows the bars).
73-
- The **RainingKeys Config** window (controls settings).
71+
2. The script will generate:
72+
- Folder: `dist/RainingKeysPython/`
73+
- Zip: `RainingKeysPython.zip` (or `RainingKeysPython-debug.zip` if in debug mode)
74+
75+
### Debug vs Release Build
76+
You can toggle the console window visibility via `config.ini`:** window (controls settings).
7477
3. Use the Config window to move the overlay or change speed/direction live.
7578
4. Press the configured keys (Default: `a`, `s`, `l`, `;`) to see the visualization.
7679
5. **To Exit**: Close the Config window or press `Ctrl+C` in the terminal.

build.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,30 @@ def copy_config_to_dist():
8787
if not copied:
8888
print("Warning: No config file found to copy.")
8989

90+
def create_zip(debug_mode):
91+
"""Packages the dist folder into a zip file."""
92+
source_dir = os.path.join(OUTPUT_DIR, EXECUTABLE_NAME)
93+
94+
zip_name = EXECUTABLE_NAME
95+
if debug_mode:
96+
zip_name += "-debug"
97+
98+
# shutil.make_archive expects the base_name without extension
99+
# It creates base_name.zip
100+
101+
print(f"\nPackaging into {zip_name}.zip...")
102+
103+
# format='zip': create a zip file
104+
# root_dir=OUTPUT_DIR: the root directory to archive
105+
# base_dir=EXECUTABLE_NAME: the directory inside root_dir to start archiving from
106+
# This prevents the zip from containing 'dist/...' structure, but rather just the executable folder
107+
108+
# We want the zip to contain the top-level folder 'RainingKeysPython'
109+
# So we archive 'dist' but only the 'RainingKeysPython' subdirectory
110+
111+
shutil.make_archive(zip_name, 'zip', root_dir=OUTPUT_DIR, base_dir=EXECUTABLE_NAME)
112+
print(f"Zip created: {zip_name}.zip")
113+
90114
def main():
91115
# 1. Clean previous builds
92116
clean_directories()
@@ -107,8 +131,12 @@ def main():
107131
# 4. Copy config
108132
copy_config_to_dist()
109133

110-
print("\nBuild complete!")
111-
print(f"Output: {os.path.join(OUTPUT_DIR, EXECUTABLE_NAME)}")
134+
# 5. Zip
135+
create_zip(debug_mode)
136+
137+
print("\nBuild and packaging complete!")
138+
print(f"Output folder: {os.path.join(OUTPUT_DIR, EXECUTABLE_NAME)}")
139+
print(f"Zip file: {EXECUTABLE_NAME + ('-debug' if debug_mode else '')}.zip")
112140

113141
if __name__ == "__main__":
114142
main()

0 commit comments

Comments
 (0)