1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-16 19:44:05 +02:00

Revert "Fix a couple issues found in the build script"

This commit is contained in:
Thomas Bui
2020-12-11 16:57:57 -08:00
committed by GitHub
parent 0ca4e3b63b
commit 460cdf5bd8
10 changed files with 191 additions and 162 deletions

View File

@@ -1,31 +1,61 @@
from pathlib import Path
from argparse import ArgumentParser
from selenium.common.exceptions import TimeoutException
# pycharm complains that build_assets is an unresolved ref
# don't worry about it, the script still runs
from build_assets.SeleniumRunner import SeleniumRunner
from build_assets import filehandler, util
from build_assets import filehandler
from build_assets.PathResolverAction import PathResolverAction
def main():
args = util.get_commandline_args()
parser = ArgumentParser(description="Upload svgs to Icomoon to create icon files.")
parser.add_argument("--headless",
help="Whether to run the browser in headless/no UI mode",
action="store_true")
parser.add_argument("geckodriver_path",
help="The path to the firefox executable file",
action=PathResolverAction)
parser.add_argument("icomoon_json_path",
help="The path to the icomoon.json aka the selection.json created by Icomoon",
action=PathResolverAction)
parser.add_argument("devicon_json_path",
help="The path to the devicon.json",
action=PathResolverAction)
parser.add_argument("icons_folder_path",
help="The path to the icons folder",
action=PathResolverAction)
parser.add_argument("download_path",
help="The path where you'd like to download the Icomoon files to",
action=PathResolverAction)
args = parser.parse_args()
new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path)
if len(new_icons) == 0:
print("No files need to be uploaded. Ending script...")
print("No files need to be peek. Ending script...")
return
# print list of new icons
print("List of new icons:", *new_icons, sep = "\n")
runner = None
# print list of new icons, separated by comma
print("List of new icons:")
print(*new_icons, sep = "\n")
try:
runner = SeleniumRunner(args.download_path, args.geckodriver_path, args.headless)
runner = SeleniumRunner(args.download_path,
args.geckodriver_path, args.headless)
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path)
runner.upload_svgs(svgs)
runner.close()
print("Task completed.")
except TimeoutException as e:
print(e)
print(e.stacktrace)
finally:
runner.close()