-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #386 from devicons/develop
Release master with fixed build process
- Loading branch information
Showing
10 changed files
with
158 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from pathlib import Path | ||
from argparse import ArgumentParser | ||
from build_assets.PathResolverAction import PathResolverAction | ||
|
||
def 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) | ||
|
||
|
||
return parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.