From 85032a0e9e000b99a8f584fbe0b15ad4ce881a8d Mon Sep 17 00:00:00 2001 From: KaizIqbal <24286590+KaizIqbal@users.noreply.github.com> Date: Wed, 29 Jul 2020 10:34:12 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20main=20method=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.py | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/build.py b/build.py index 49a1761..3a5e61d 100644 --- a/build.py +++ b/build.py @@ -1,37 +1,20 @@ import json -import shutil -import tempfile - -from os import path, listdir from clickgen import build_cursor_theme -# Config -name = "MacOS Big Sur" -sizes = [24, 28, 32, 40, 48, 56, 65, 72, 80, 88, 96] -temp_folder = tempfile.mkdtemp() -package_dir = "./packages" -x11_out_dir = path.join(package_dir, "macOSBigSur") -win_out_dir = path.join(package_dir, "macOSBigSur_Windows") +from config import name, sizes, delay, bitmaps_dir, temp_folder +from helper import cleanup, init_build -# Building Cursor Theme -with open('./hotspots.json', 'r') as hotspot_file: - config = json.loads(hotspot_file.read()) - build_cursor_theme(name, image_dir="./bitmaps", - cursor_sizes=sizes, out_path=temp_folder, archive=False, delay=30) -# Rename directory -shutil.move(path.join(temp_folder, name, "x11"), x11_out_dir) -shutil.move(path.join(temp_folder, name, "win"), win_out_dir) +def build() -> None: + init_build() + # Building Cursor Theme + with open('./hotspots.json', 'r') as hotspot_file: + hotspots = json.loads(hotspot_file.read()) + build_cursor_theme(name, image_dir=bitmaps_dir, + cursor_sizes=sizes, out_path=temp_folder, hotspots=hotspots, archive=False, delay=delay) + # helper method + cleanup() -# Packaging -# - .tar archive for X11 -# - .zip archive for Windows -shutil.make_archive(x11_out_dir, "tar", x11_out_dir) -shutil.make_archive(win_out_dir, "zip", win_out_dir) -# Clenaup -shutil.rmtree(temp_folder) -for f in listdir(package_dir): - f_path = path.join(package_dir, f) - if path.isdir(f_path): - shutil.rmtree(f_path) +if __name__ == "__main__": + build()