🚀 Bibata builder pkg_info module.

This commit is contained in:
ful1e5 2020-10-15 08:50:27 +05:30
parent 31469678e8
commit aeba37dadd
5 changed files with 53 additions and 34 deletions

View file

@ -5,23 +5,32 @@ import sys
import argparse
from argparse import ArgumentParser
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.cursor import CursorBuilder
def get_args_parser() -> ArgumentParser:
"""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,
help=("Bundle X11 cursors from bitmaps"
" (default: %(default)s)"))
parser.add_argument(
"-x",
"--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,
help=("Bundle Windows cursors from bitmaps"
" (default: %(default)s)"))
parser.add_argument(
"-w",
"--windows",
action="store_true",
default=False,
help=("Bundle Windows cursors from bitmaps" " (default: %(default)s)"),
)
return parser
@ -38,11 +47,11 @@ def build() -> None:
out_dir = "./themes"
# print builder information
print(__info__)
print(info["version"])
bitmaps_dirs = listdir(bitmaps_dir)
configs: list[ConfigProvider] = []
builders: list[CursorBuilder] = []
configs: List[ConfigProvider] = []
builders: List[CursorBuilder] = []
for index, name in enumerate(bitmaps_dirs):
theme_bitmaps_dir = path.join(bitmaps_dir, name)
@ -50,11 +59,11 @@ def build() -> None:
builders.append(CursorBuilder(configs[index]))
for builder in builders:
if (args.x11 == args.windows):
if args.x11 == args.windows:
builder.build_cursors()
elif(args.x11):
elif args.x11:
builder.build_x11_cursors()
elif(args.windows):
elif args.windows:
builder.build_win_cursors()

View file

@ -2,11 +2,5 @@
# -*- coding: utf-8 -*-
from .log import save_logs_to_file
save_logs_to_file()
__pkg_name__: str = "builder"
__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/"
save_logs_to_file()

View file

@ -7,7 +7,8 @@ import shutil
from os import path, mkdir
import tempfile
from . import __path__, __author__
from builder import __path__
from builder.pkg_info import info
# Build Config
delay = 35
@ -18,7 +19,7 @@ with open(path.join(__path__[0], "hotspots.json")) as hotspot_file:
hotspots = json.loads(hotspot_file.read())
class ConfigProvider():
class ConfigProvider:
"""
Configure `Bibata` building process 🔧.
"""
@ -33,7 +34,8 @@ class ConfigProvider():
# Checking Bitmaps directory
if not path.exists(bitmaps_dir):
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)
self.name: str = name
@ -46,6 +48,7 @@ class ConfigProvider():
with open(path.join(__path__[0], "windows.inf")) as f:
data = f.read()
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

13
builder/pkg_info.py Normal file
View 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/",
}

View file

@ -1,18 +1,18 @@
#!/usr/bin/env python
# -*- 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
setup(
name=__pkg_name__,
version=__version__,
description=__info__,
url=__url__,
author=__author__,
author_email=__email__,
name=info["name"],
version=info["version"],
description=info["description"],
url=info["url"],
author=info["author"],
author_email=info["email"],
install_requires=["Pillow>=7.2.0", "clickgen>=1.1.7"],
packages=find_namespace_packages(include=['builder']),
packages=find_namespace_packages(include=["builder"]),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",