mirror of
https://github.com/googlefonts/noto-emoji.git
synced 2025-07-08 13:36:40 +00:00
keep downloaded files out of build dir
This commit is contained in:
parent
6f777a08dd
commit
bd076bbc74
1 changed files with 7 additions and 13 deletions
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import pickle
|
import pickle
|
||||||
from os import path, makedirs, walk, listdir
|
from os import path, makedirs, walk, listdir, makedirs
|
||||||
import io
|
import io
|
||||||
import fire
|
import fire
|
||||||
import sys
|
import sys
|
||||||
|
@ -34,8 +34,8 @@ SCOPES = ["https://www.googleapis.com/auth/drive"]
|
||||||
def main(folder_name="", reporting=False):
|
def main(folder_name="", reporting=False):
|
||||||
|
|
||||||
# Remove combined_png dir if it exists
|
# Remove combined_png dir if it exists
|
||||||
if path.exists("./build/combined_png"):
|
if path.exists("./combined_png"):
|
||||||
shutil.rmtree("./build/combined_png")
|
shutil.rmtree("./combined_png")
|
||||||
|
|
||||||
# Create a token.pickle file to store the users session
|
# Create a token.pickle file to store the users session
|
||||||
service = get_service()
|
service = get_service()
|
||||||
|
@ -47,7 +47,8 @@ def main(folder_name="", reporting=False):
|
||||||
folder_id = get_folder_id(service, folder_name)
|
folder_id = get_folder_id(service, folder_name)
|
||||||
|
|
||||||
# Create output_dir
|
# Create output_dir
|
||||||
output_dir = ensure_directory_exists("temp_download_folder")
|
makedirs("./temp_download_folder", exist_ok=True)
|
||||||
|
output_dir = "./temp_download_folder"
|
||||||
|
|
||||||
# Get the file IDs to download
|
# Get the file IDs to download
|
||||||
file_list = get_file_list(service, folder_id)
|
file_list = get_file_list(service, folder_id)
|
||||||
|
@ -111,13 +112,6 @@ def get_folder_id(service, folder_name):
|
||||||
return folder_id
|
return folder_id
|
||||||
|
|
||||||
|
|
||||||
def ensure_directory_exists(dir_name):
|
|
||||||
if not path.exists(dir_name):
|
|
||||||
makedirs(dir_name)
|
|
||||||
|
|
||||||
return dir_name
|
|
||||||
|
|
||||||
|
|
||||||
def get_file_list(service, folder_id):
|
def get_file_list(service, folder_id):
|
||||||
"""Get all files in the Google drive folder.
|
"""Get all files in the Google drive folder.
|
||||||
So they can be downloaded"""
|
So they can be downloaded"""
|
||||||
|
@ -187,12 +181,12 @@ def report_on_download(output_dir):
|
||||||
|
|
||||||
def merge_png_dirs(output_dir):
|
def merge_png_dirs(output_dir):
|
||||||
"""Combine local and downloaded PNGs."""
|
"""Combine local and downloaded PNGs."""
|
||||||
copy_tree("./png/128", "./build/combined_png")
|
copy_tree("./png/128", "./combined_png")
|
||||||
src_files = listdir(output_dir)
|
src_files = listdir(output_dir)
|
||||||
for file_name in src_files:
|
for file_name in src_files:
|
||||||
full_file_name = path.join(output_dir, file_name)
|
full_file_name = path.join(output_dir, file_name)
|
||||||
if path.isfile(full_file_name):
|
if path.isfile(full_file_name):
|
||||||
shutil.copy(full_file_name, "./build/combined_png")
|
shutil.copy(full_file_name, "./combined_png")
|
||||||
shutil.rmtree(output_dir)
|
shutil.rmtree(output_dir)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue