mirror of
https://github.com/konpa/devicon.git
synced 2025-08-15 02:56:12 +02:00
Revert "Revert "Fix a couple issues found in the build script""
This commit is contained in:
48
.github/scripts/icomoon_peek.py
vendored
48
.github/scripts/icomoon_peek.py
vendored
@@ -1,61 +1,31 @@
|
||||
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
|
||||
from build_assets.PathResolverAction import PathResolverAction
|
||||
from build_assets import filehandler, util
|
||||
|
||||
|
||||
def main():
|
||||
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()
|
||||
|
||||
args = util.get_commandline_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 peek. Ending script...")
|
||||
print("No files need to be uploaded. Ending script...")
|
||||
return
|
||||
|
||||
# print list of new icons, separated by comma
|
||||
print("List of new icons:")
|
||||
print(*new_icons, sep = "\n")
|
||||
# print list of new icons
|
||||
print("List of new icons:", *new_icons, sep = "\n")
|
||||
|
||||
runner = None
|
||||
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()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user