This commit is contained in:
parent
d6b7961e24
commit
d98c510eee
1 changed files with 9 additions and 8 deletions
|
@ -53,16 +53,16 @@ vim-abolish https://github.com/tpope/tpope-vim-abolish
|
|||
mru.vim https://github.com/vim-scripts/mru.vim
|
||||
rust.vim https://github.com/rust-lang/rust.vim
|
||||
vim-markdown https://github.com/plasticboy/vim-markdown
|
||||
gist-vim https://github.com/mattn/gist-vim
|
||||
vim-gist https://github.com/mattn/vim-gist
|
||||
vim-ruby https://github.com/vim-ruby/vim-ruby
|
||||
typescript-vim https://github.com/leafgarland/typescript-vim
|
||||
vim-javascript https://github.com/pangloss/vim-javascript
|
||||
vim-python-pep8-indent https://github.com/Vimjas/vim-python-pep8-indent
|
||||
""".strip()
|
||||
|
||||
GITHUB_ZIP = '%s/archive/master.zip'
|
||||
GITHUB_ZIP = "%s/archive/master.zip"
|
||||
|
||||
SOURCE_DIR = path.join(path.dirname(__file__), 'sources_non_forked')
|
||||
SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked")
|
||||
|
||||
|
||||
def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
|
||||
|
@ -70,13 +70,14 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
|
|||
|
||||
# Download and extract file in temp dir
|
||||
req = requests.get(zip_path)
|
||||
open(temp_zip_path, 'wb').write(req.content)
|
||||
open(temp_zip_path, "wb").write(req.content)
|
||||
|
||||
zip_f = zipfile.ZipFile(temp_zip_path)
|
||||
zip_f.extractall(temp_dir)
|
||||
|
||||
plugin_temp_path = path.join(
|
||||
temp_dir, path.join(temp_dir, '%s-master' % plugin_name))
|
||||
temp_dir, path.join(temp_dir, "%s-master" % plugin_name)
|
||||
)
|
||||
|
||||
# Remove the current plugin and replace it with the extracted
|
||||
plugin_dest_path = path.join(source_dir, plugin_name)
|
||||
|
@ -87,16 +88,16 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
|
|||
pass
|
||||
|
||||
shutil.move(plugin_temp_path, plugin_dest_path)
|
||||
print('Updated {0}'.format(plugin_name))
|
||||
print("Updated {0}".format(plugin_name))
|
||||
|
||||
|
||||
def update(plugin):
|
||||
name, github_url = plugin.split(' ')
|
||||
name, github_url = plugin.split(" ")
|
||||
zip_path = GITHUB_ZIP % github_url
|
||||
download_extract_replace(name, zip_path, temp_directory, SOURCE_DIR)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
temp_directory = tempfile.mkdtemp()
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue