1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-17 12:00:56 +02:00

Refactored peek and build scripts

This commit is contained in:
Thomas Bui
2020-12-10 23:55:16 -08:00
parent b745708288
commit acdbed3075
8 changed files with 102 additions and 129 deletions

42
.github/scripts/icomoon_build.py vendored Normal file
View File

@@ -0,0 +1,42 @@
from pathlib import Path
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
def main():
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 uploaded. Ending script...")
return
# 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.upload_icomoon(args.icomoon_json_path)
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path)
runner.upload_svgs(svgs)
zip_name = "devicon-v1.0.zip"
zip_path = Path(args.download_path, zip_name)
runner.download_icomoon_fonts(zip_path)
filehandler.extract_files(str(zip_path), args.download_path)
filehandler.rename_extracted_files(args.download_path)
print("Task completed.")
except TimeoutException as e:
print(e)
print(e.stacktrace)
finally:
runner.close()
if __name__ == "__main__":
main()