Fix flake8 errors and lgtm errors in install_gadget.py
This commit is contained in:
parent
10baf4dd20
commit
ca4cb8a5a4
1 changed files with 10 additions and 7 deletions
|
|
@ -119,7 +119,8 @@ GADGETS = {
|
||||||
'all': {
|
'all': {
|
||||||
'file_name': 'vscode-mono-debug.vsix',
|
'file_name': 'vscode-mono-debug.vsix',
|
||||||
'version': '0.15.8',
|
'version': '0.15.8',
|
||||||
'checksum': '723eb2b621b99d65a24f215cb64b45f5fe694105613a900a03c859a62a810470',
|
'checksum':
|
||||||
|
'723eb2b621b99d65a24f215cb64b45f5fe694105613a900a03c859a62a810470',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'vscode-bash-debug': {
|
'vscode-bash-debug': {
|
||||||
|
|
@ -136,6 +137,7 @@ GADGETS = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def CurrentWorkingDir( d ):
|
def CurrentWorkingDir( d ):
|
||||||
cur_d = os.getcwd()
|
cur_d = os.getcwd()
|
||||||
|
|
@ -200,7 +202,7 @@ def InstallTclProDebug( name, root ):
|
||||||
|
|
||||||
|
|
||||||
with CurrentWorkingDir( os.path.join( root, 'lib', 'tclparser' ) ):
|
with CurrentWorkingDir( os.path.join( root, 'lib', 'tclparser' ) ):
|
||||||
subprocess.check_call( configure )
|
subprocess.check_call( configure )
|
||||||
subprocess.check_call( [ 'make' ] )
|
subprocess.check_call( [ 'make' ] )
|
||||||
|
|
||||||
MakeSymlink( gadget_dir, name, root )
|
MakeSymlink( gadget_dir, name, root )
|
||||||
|
|
@ -274,15 +276,15 @@ def RemoveIfExists( destination ):
|
||||||
# other than crappy code. Let's do it's job for it.
|
# other than crappy code. Let's do it's job for it.
|
||||||
class ModePreservingZipFile( zipfile.ZipFile ):
|
class ModePreservingZipFile( zipfile.ZipFile ):
|
||||||
def extract( self, member, path = None, pwd = None ):
|
def extract( self, member, path = None, pwd = None ):
|
||||||
if not isinstance(member, zipfile.ZipInfo):
|
if not isinstance( member, zipfile.ZipInfo ):
|
||||||
member = self.getinfo(member)
|
member = self.getinfo( member )
|
||||||
|
|
||||||
if path is None:
|
if path is None:
|
||||||
path = os.getcwd()
|
path = os.getcwd()
|
||||||
|
|
||||||
ret_val = self._extract_member(member, path, pwd)
|
ret_val = self._extract_member( member, path, pwd )
|
||||||
attr = member.external_attr >> 16
|
attr = member.external_attr >> 16
|
||||||
os.chmod(ret_val, attr)
|
os.chmod( ret_val, attr )
|
||||||
return ret_val
|
return ret_val
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -324,6 +326,7 @@ def CloneRepoTo( url, ref, destination ):
|
||||||
subprocess.check_call( [ 'git', 'clone', url, destination ] )
|
subprocess.check_call( [ 'git', 'clone', url, destination ] )
|
||||||
subprocess.check_call( [ 'git', '-C', destination, 'checkout', ref ] )
|
subprocess.check_call( [ 'git', '-C', destination, 'checkout', ref ] )
|
||||||
|
|
||||||
|
|
||||||
OS = install.GetOS()
|
OS = install.GetOS()
|
||||||
gadget_dir = install.GetGadgetDir( os.path.dirname( __file__ ), OS )
|
gadget_dir = install.GetGadgetDir( os.path.dirname( __file__ ), OS )
|
||||||
|
|
||||||
|
|
@ -388,7 +391,7 @@ for name, gadget in GADGETS.items():
|
||||||
root = os.path.join( destination, 'root' )
|
root = os.path.join( destination, 'root' )
|
||||||
ExtractZipTo( file_path,
|
ExtractZipTo( file_path,
|
||||||
root,
|
root,
|
||||||
format = gadget[ 'download' ].get( 'format', 'zip' ) )
|
format = gadget[ 'download' ].get( 'format', 'zip' ) )
|
||||||
elif 'repo' in gadget:
|
elif 'repo' in gadget:
|
||||||
url = string.Template( gadget[ 'repo' ][ 'url' ] ).substitute( v )
|
url = string.Template( gadget[ 'repo' ][ 'url' ] ).substitute( v )
|
||||||
ref = string.Template( gadget[ 'repo' ][ 'ref' ] ).substitute( v )
|
ref = string.Template( gadget[ 'repo' ][ 'ref' ] ).substitute( v )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue