mirror of
1
0
Fork 0

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
1 changed files with 9 additions and 4 deletions

View File

@ -7,13 +7,14 @@ except ImportError:
futures = None
import re
import zipfile
import shutil
import tempfile
import requests
import zipfile
from distutils.dir_util import copy_tree
from os import path
import requests
# --- Globals ----------------------------------------------
PLUGINS = """
auto-pairs https://github.com/jiangmiao/auto-pairs
@ -67,7 +68,8 @@ dracula https://github.com/dracula/vim
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):
@ -108,6 +110,9 @@ def update(plugin):
if __name__ == "__main__":
temp_directory = tempfile.mkdtemp()
if not path.isdir(SOURCE_DIR):
copy_tree(FALLBACK_SOURCE_DIR, SOURCE_DIR)
try:
if futures:
with futures.ThreadPoolExecutor(16) as executor: