📚 Bibata builder docs added

This commit is contained in:
ful1e5 2020-10-15 08:25:11 +05:30
parent 7e452a4512
commit 31469678e8
6 changed files with 12 additions and 39 deletions

View file

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Skip **already rendered** Bitmaps in `bibata-core` - Skip **already rendered** Bitmaps in `bibata-core`
- Cursors `builder` docs
### Changed ### Changed

View file

@ -27,6 +27,7 @@ def get_args_parser() -> ArgumentParser:
def build() -> None: def build() -> None:
""" Build Bibata cursor """
parser = get_args_parser() parser = get_args_parser()
try: try:
args = parser.parse_args() args = parser.parse_args()

View file

@ -32,9 +32,6 @@ class Bundler():
""" """
def __init__(self, config: ConfigProvider) -> None: def __init__(self, config: ConfigProvider) -> None:
"""
docsstring
"""
self.__name = config.name self.__name = config.name
self.__tmpdir = config.tmpdir self.__tmpdir = config.tmpdir
self.__x11_dest = path.join(config.out_dir, self.__name) self.__x11_dest = path.join(config.out_dir, self.__name)
@ -42,17 +39,13 @@ class Bundler():
self.__content = config.get_windows_script() self.__content = config.get_windows_script()
def __save_win_install_script(self) -> None: def __save_win_install_script(self) -> None:
""" """ Save `install.inf` file in windows cursor theme. """
docstring
"""
file_path = path.join(self.__win_dest, "install.inf") file_path = path.join(self.__win_dest, "install.inf")
with open(file_path, "w") as file: with open(file_path, "w") as file:
file.write(self.__content) file.write(self.__content)
def __clean_win_bundle(self) -> None: def __clean_win_bundle(self) -> None:
""" """ Remvoe unnecessary cursor from directory generated by `clickgen` """
docstring
"""
# Remove & Rename cursors # Remove & Rename cursors
# If Key found => Rename else Remove # If Key found => Rename else Remove
for cursor in listdir(self.__win_dest): for cursor in listdir(self.__win_dest):
@ -67,24 +60,18 @@ class Bundler():
self.__save_win_install_script() self.__save_win_install_script()
def win_bundle(self) -> None: def win_bundle(self) -> None:
""" """ Make cursor theme installable on `Windows OS`. """
docstring
"""
src = path.join(self.__tmpdir, self.__name, "win") src = path.join(self.__tmpdir, self.__name, "win")
shutil.copytree(src, self.__win_dest) shutil.copytree(src, self.__win_dest)
self.__clean_win_bundle() self.__clean_win_bundle()
def x11_bundle(self) -> None: def x11_bundle(self) -> None:
""" """ Make cursor theme installable on `x11`. """
docstring
"""
src = path.join(self.__tmpdir, self.__name, "x11") src = path.join(self.__tmpdir, self.__name, "x11")
shutil.copytree(src, self.__x11_dest, symlinks=True) shutil.copytree(src, self.__x11_dest, symlinks=True)
def bundle(self) -> None: def bundle(self) -> None:
""" """ Make cursor theme installable on `x11` & `Windows OS`. """
docstring
"""
x11_src = path.join(self.__tmpdir, self.__name, "x11") x11_src = path.join(self.__tmpdir, self.__name, "x11")
shutil.copytree(x11_src, self.__x11_dest, symlinks=True) shutil.copytree(x11_src, self.__x11_dest, symlinks=True)

View file

@ -24,9 +24,6 @@ class ConfigProvider():
""" """
def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None: def __init__(self, name: str, bitmaps_dir: str, out_dir: str) -> None:
"""
docsstring
"""
# cleanup old packages # cleanup old packages
if path.exists(out_dir): if path.exists(out_dir):
shutil.rmtree(out_dir) shutil.rmtree(out_dir)
@ -45,9 +42,7 @@ class ConfigProvider():
self.out_dir: str = path.abspath(out_dir) self.out_dir: str = path.abspath(out_dir)
def get_windows_script(self) -> str: def get_windows_script(self) -> str:
""" """ Get `install.inf` content for this cursor theme. """
docsstring
"""
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(

View file

@ -12,18 +12,13 @@ class CursorBuilder():
""" """
def __init__(self, config: ConfigProvider) -> None: def __init__(self, config: ConfigProvider) -> None:
"""
docstring
"""
self.__name = config.name self.__name = config.name
self.__bitmaps_dir = config.bitmaps_dir self.__bitmaps_dir = config.bitmaps_dir
self.__bundler = Bundler(config) self.__bundler = Bundler(config)
self.__tmpdir = config.tmpdir self.__tmpdir = config.tmpdir
def build_x11_cursors(self) -> None: def build_x11_cursors(self) -> None:
""" """ Build `x11` platform cursors. """
docstring
"""
print('🌈 Building %s Theme ...' % self.__name) print('🌈 Building %s Theme ...' % self.__name)
build_x11_cursor_theme( build_x11_cursor_theme(
name=self.__name, name=self.__name,
@ -38,9 +33,7 @@ class CursorBuilder():
self.__bundler.x11_bundle() self.__bundler.x11_bundle()
def build_win_cursors(self) -> None: def build_win_cursors(self) -> None:
""" """ Build `Windows` platform cursors. """
docstring
"""
print('🌈 Building %s Theme ...' % self.__name) print('🌈 Building %s Theme ...' % self.__name)
build_win_cursor_theme( build_win_cursor_theme(
name=self.__name, name=self.__name,
@ -55,9 +48,7 @@ class CursorBuilder():
self.__bundler.win_bundle() self.__bundler.win_bundle()
def build_cursors(self) -> None: def build_cursors(self) -> None:
""" """ Build `x11` & `Windows` platform cursors. """
docstring
"""
print('🌈 Building %s Theme ...' % self.__name) print('🌈 Building %s Theme ...' % self.__name)
build_cursor_theme( build_cursor_theme(
name=self.__name, name=self.__name,

View file

@ -6,8 +6,6 @@ import os
def save_logs_to_file() -> None: def save_logs_to_file() -> None:
""" """ Save `clickgen` logs to `build.log` in current working directory. """
Save `clickgen` logs to `build.log` in current working directory
"""
logging.basicConfig(filename='%s/build.log' % os.getcwd(), filemode='w', logging.basicConfig(filename='%s/build.log' % os.getcwd(), filemode='w',
format='%(name)s - %(levelname)s - %(message)s', level=logging.DEBUG) format='%(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)