1
0
Fork 0
mirror of synced 2024-12-25 08:13:20 -05:00

Create sources_non_forked_cache folder if it does not exist yet

This commit is contained in:
Wu Tingfeng 2022-11-20 22:23:05 +08:00
parent 27ee81398f
commit ffa28d1589
No known key found for this signature in database

View file

@ -7,13 +7,14 @@ except ImportError:
futures = None futures = None
import re import re
import zipfile
import shutil import shutil
import tempfile import tempfile
import requests import zipfile
from distutils.dir_util import copy_tree
from os import path from os import path
import requests
# --- Globals ---------------------------------------------- # --- Globals ----------------------------------------------
PLUGINS = """ PLUGINS = """
auto-pairs https://github.com/jiangmiao/auto-pairs auto-pairs https://github.com/jiangmiao/auto-pairs
@ -67,7 +68,8 @@ dracula https://github.com/dracula/vim
GITHUB_ZIP = "%s/archive/master.zip" GITHUB_ZIP = "%s/archive/master.zip"
SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked") FALLBACK_SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked")
SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked_cache")
def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
@ -108,6 +110,9 @@ def update(plugin):
if __name__ == "__main__": if __name__ == "__main__":
temp_directory = tempfile.mkdtemp() temp_directory = tempfile.mkdtemp()
if not path.isdir(SOURCE_DIR):
copy_tree(FALLBACK_SOURCE_DIR, SOURCE_DIR)
try: try:
if futures: if futures:
with futures.ThreadPoolExecutor(16) as executor: with futures.ThreadPoolExecutor(16) as executor: