mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-19 09:45:24 -04:00
🚀 Bibata builder pkg_info module.
This commit is contained in:
parent
31469678e8
commit
aeba37dadd
5 changed files with 53 additions and 34 deletions
37
build.py
37
build.py
|
@ -5,23 +5,32 @@ import sys
|
||||||
import argparse
|
import argparse
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from builder import __info__
|
from builder.pkg_info import info
|
||||||
from builder.config import ConfigProvider
|
from builder.config import ConfigProvider
|
||||||
from builder.cursor import CursorBuilder
|
from builder.cursor import CursorBuilder
|
||||||
|
|
||||||
|
|
||||||
def get_args_parser() -> ArgumentParser:
|
def get_args_parser() -> ArgumentParser:
|
||||||
"""Parse command line arguments"""
|
"""Parse command line arguments"""
|
||||||
parser = argparse.ArgumentParser(description=__info__)
|
parser = argparse.ArgumentParser(description=info["description"])
|
||||||
|
|
||||||
parser.add_argument("-x", "--x11", action="store_true", default=False,
|
parser.add_argument(
|
||||||
help=("Bundle X11 cursors from bitmaps"
|
"-x",
|
||||||
" (default: %(default)s)"))
|
"--x11",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help=("Bundle X11 cursors from bitmaps" " (default: %(default)s)"),
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument("-w", "--windows", action="store_true", default=False,
|
parser.add_argument(
|
||||||
help=("Bundle Windows cursors from bitmaps"
|
"-w",
|
||||||
" (default: %(default)s)"))
|
"--windows",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help=("Bundle Windows cursors from bitmaps" " (default: %(default)s)"),
|
||||||
|
)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -38,11 +47,11 @@ def build() -> None:
|
||||||
out_dir = "./themes"
|
out_dir = "./themes"
|
||||||
|
|
||||||
# print builder information
|
# print builder information
|
||||||
print(__info__)
|
print(info["version"])
|
||||||
|
|
||||||
bitmaps_dirs = listdir(bitmaps_dir)
|
bitmaps_dirs = listdir(bitmaps_dir)
|
||||||
configs: list[ConfigProvider] = []
|
configs: List[ConfigProvider] = []
|
||||||
builders: list[CursorBuilder] = []
|
builders: List[CursorBuilder] = []
|
||||||
|
|
||||||
for index, name in enumerate(bitmaps_dirs):
|
for index, name in enumerate(bitmaps_dirs):
|
||||||
theme_bitmaps_dir = path.join(bitmaps_dir, name)
|
theme_bitmaps_dir = path.join(bitmaps_dir, name)
|
||||||
|
@ -50,11 +59,11 @@ def build() -> None:
|
||||||
builders.append(CursorBuilder(configs[index]))
|
builders.append(CursorBuilder(configs[index]))
|
||||||
|
|
||||||
for builder in builders:
|
for builder in builders:
|
||||||
if (args.x11 == args.windows):
|
if args.x11 == args.windows:
|
||||||
builder.build_cursors()
|
builder.build_cursors()
|
||||||
elif(args.x11):
|
elif args.x11:
|
||||||
builder.build_x11_cursors()
|
builder.build_x11_cursors()
|
||||||
elif(args.windows):
|
elif args.windows:
|
||||||
builder.build_win_cursors()
|
builder.build_win_cursors()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from .log import save_logs_to_file
|
from .log import save_logs_to_file
|
||||||
save_logs_to_file()
|
|
||||||
|
|
||||||
__pkg_name__: str = "builder"
|
save_logs_to_file()
|
||||||
__version__: str = "1.0.1"
|
|
||||||
__author__: str = "Kaiz Khatri"
|
|
||||||
__info__: str = "⚡ Bibata Builder - v%s" % __version__
|
|
||||||
__email__: str = "kaizmandhu@gmail.com"
|
|
||||||
__url__: str = "https://github.com/ful1e5/Bibata_Cursor/"
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ import shutil
|
||||||
from os import path, mkdir
|
from os import path, mkdir
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from . import __path__, __author__
|
from builder import __path__
|
||||||
|
from builder.pkg_info import info
|
||||||
|
|
||||||
# Build Config
|
# Build Config
|
||||||
delay = 35
|
delay = 35
|
||||||
|
@ -18,9 +19,9 @@ with open(path.join(__path__[0], "hotspots.json")) as hotspot_file:
|
||||||
hotspots = json.loads(hotspot_file.read())
|
hotspots = json.loads(hotspot_file.read())
|
||||||
|
|
||||||
|
|
||||||
class ConfigProvider():
|
class ConfigProvider:
|
||||||
"""
|
"""
|
||||||
Configure `Bibata` building process 🔧.
|
Configure `Bibata` building process 🔧.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None:
|
def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None:
|
||||||
|
@ -33,7 +34,8 @@ class ConfigProvider():
|
||||||
# Checking Bitmaps directory
|
# Checking Bitmaps directory
|
||||||
if not path.exists(bitmaps_dir):
|
if not path.exists(bitmaps_dir):
|
||||||
print(
|
print(
|
||||||
"⚠ BITMAPS NOT FOUND.\n\n`yarn install && yarn render` to Generates Bitmaps")
|
"⚠ BITMAPS NOT FOUND.\n\n`yarn install && yarn render` to Generates Bitmaps"
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
|
@ -46,6 +48,7 @@ class ConfigProvider():
|
||||||
with open(path.join(__path__[0], "windows.inf")) as f:
|
with open(path.join(__path__[0], "windows.inf")) as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
inf_content = data.replace(
|
inf_content = data.replace(
|
||||||
"<inject_theme_name>", self.name+" Cursors").replace("<inject_author_name>", __author__)
|
"<inject_theme_name>", self.name + " Cursors"
|
||||||
|
).replace("<inject_author_name>", info["author"])
|
||||||
|
|
||||||
return inf_content
|
return inf_content
|
||||||
|
|
13
builder/pkg_info.py
Normal file
13
builder/pkg_info.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
__version__ = "1.0.1"
|
||||||
|
|
||||||
|
info = {
|
||||||
|
"pkg_name": "builder",
|
||||||
|
"version": __version__,
|
||||||
|
"author": "Kaiz Khatri",
|
||||||
|
"description": f"⚡ Bibata Builder - v{__version__}",
|
||||||
|
"email": "kaizmandhu@gmail.com",
|
||||||
|
"url": "https://github.com/ful1e5/Bibata_Cursor/",
|
||||||
|
}
|
16
setup.py
16
setup.py
|
@ -1,18 +1,18 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from builder import __pkg_name__, __version__, __author__, __info__, __email__, __url__
|
from builder.pkg_info import info
|
||||||
from setuptools import setup, find_namespace_packages
|
from setuptools import setup, find_namespace_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=__pkg_name__,
|
name=info["name"],
|
||||||
version=__version__,
|
version=info["version"],
|
||||||
description=__info__,
|
description=info["description"],
|
||||||
url=__url__,
|
url=info["url"],
|
||||||
author=__author__,
|
author=info["author"],
|
||||||
author_email=__email__,
|
author_email=info["email"],
|
||||||
install_requires=["Pillow>=7.2.0", "clickgen>=1.1.7"],
|
install_requires=["Pillow>=7.2.0", "clickgen>=1.1.7"],
|
||||||
packages=find_namespace_packages(include=['builder']),
|
packages=find_namespace_packages(include=["builder"]),
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue