Add options to install_gadget.py
This commit is contained in:
parent
85ea3434a6
commit
a343dbf3bd
1 changed files with 36 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import collections
|
import collections
|
||||||
|
|
@ -41,6 +42,7 @@ from vimspector import install
|
||||||
|
|
||||||
GADGETS = {
|
GADGETS = {
|
||||||
'vscode-cpptools': {
|
'vscode-cpptools': {
|
||||||
|
'language': 'c',
|
||||||
'download': {
|
'download': {
|
||||||
'url': ( 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
|
'url': ( 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
|
||||||
'${version}/${file_name}' ),
|
'${version}/${file_name}' ),
|
||||||
|
|
@ -76,6 +78,7 @@ GADGETS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'vscode-python': {
|
'vscode-python': {
|
||||||
|
'language': 'python',
|
||||||
'download': {
|
'download': {
|
||||||
'url': ( 'https://github.com/Microsoft/vscode-python/releases/download/'
|
'url': ( 'https://github.com/Microsoft/vscode-python/releases/download/'
|
||||||
'${version}/${file_name}' ),
|
'${version}/${file_name}' ),
|
||||||
|
|
@ -97,6 +100,7 @@ GADGETS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'tclpro': {
|
'tclpro': {
|
||||||
|
'language': 'tcl',
|
||||||
'repo': {
|
'repo': {
|
||||||
'url': 'https://github.com/puremourning/TclProDebug',
|
'url': 'https://github.com/puremourning/TclProDebug',
|
||||||
'ref': 'master',
|
'ref': 'master',
|
||||||
|
|
@ -104,6 +108,7 @@ GADGETS = {
|
||||||
'do': lambda name, root: InstallTclProDebug( name, root )
|
'do': lambda name, root: InstallTclProDebug( name, root )
|
||||||
},
|
},
|
||||||
'vscode-mono-debug': {
|
'vscode-mono-debug': {
|
||||||
|
'language': 'csharp',
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
'download': {
|
'download': {
|
||||||
'url': 'https://marketplace.visualstudio.com/_apis/public/gallery/'
|
'url': 'https://marketplace.visualstudio.com/_apis/public/gallery/'
|
||||||
|
|
@ -119,6 +124,7 @@ GADGETS = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'vscode-bash-debug': {
|
'vscode-bash-debug': {
|
||||||
|
'language': 'bash',
|
||||||
'download': {
|
'download': {
|
||||||
'url': ( 'https://github.com/rogalmic/vscode-bash-debug/releases/'
|
'url': ( 'https://github.com/rogalmic/vscode-bash-debug/releases/'
|
||||||
'download/${version}/${file_name}' ),
|
'download/${version}/${file_name}' ),
|
||||||
|
|
@ -325,12 +331,42 @@ gadget_dir = install.GetGadgetDir( os.path.dirname( __file__ ), OS )
|
||||||
print( 'OS = ' + OS )
|
print( 'OS = ' + OS )
|
||||||
print( 'gadget_dir = ' + gadget_dir )
|
print( 'gadget_dir = ' + gadget_dir )
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument( '--all',
|
||||||
|
action = 'store_true',
|
||||||
|
help = 'Enable all completers' )
|
||||||
|
|
||||||
|
for name, gadget in GADGETS.items():
|
||||||
|
if not gadget.get( 'enabled', True ):
|
||||||
|
continue
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--enable-' + gadget[ 'language' ],
|
||||||
|
action = 'store_true',
|
||||||
|
help = 'Install the {} debug adapter for {} support'.format(
|
||||||
|
name,
|
||||||
|
gadget[ 'language' ] ) )
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--disable-' + gadget[ 'language' ],
|
||||||
|
action = 'store_true',
|
||||||
|
help = 'Don\t install the {} debug adapter for {} support '
|
||||||
|
'(when supplying --all)'.format( name, gadget[ 'language' ] ) )
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
failed = []
|
failed = []
|
||||||
all_adapters = {}
|
all_adapters = {}
|
||||||
for name, gadget in GADGETS.items():
|
for name, gadget in GADGETS.items():
|
||||||
if not gadget.get( 'enabled', True ):
|
if not gadget.get( 'enabled', True ):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if not args.all and not getattr( args, 'enable_' + gadget[ 'language' ] ):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if getattr( args, 'disable_' + gadget[ 'language' ] ):
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
v = {}
|
v = {}
|
||||||
v.update( gadget.get( 'all', {} ) )
|
v.update( gadget.get( 'all', {} ) )
|
||||||
|
|
@ -384,5 +420,3 @@ with open( install.GetGadgetConfigFile( os.path.dirname( __file__ ) ),
|
||||||
if failed:
|
if failed:
|
||||||
raise RuntimeError( 'Failed to install gadgets: {}'.format(
|
raise RuntimeError( 'Failed to install gadgets: {}'.format(
|
||||||
','.join( failed ) ) )
|
','.join( failed ) ) )
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue