Fix installation issues on windows - find npm.cmd
This commit is contained in:
parent
173f2d6f37
commit
4424969028
2 changed files with 66 additions and 21 deletions
|
|
@ -57,32 +57,32 @@ def Print( *args, **kwargs ):
|
|||
print( *args, **kwargs )
|
||||
|
||||
|
||||
def CheckCall( *args, **kwargs ):
|
||||
if options.quiet:
|
||||
try:
|
||||
subprocess.check_output( *args, stderr=subprocess.STDOUT, **kwargs )
|
||||
except subprocess.CalledProcessError as e:
|
||||
print( e.output.decode( 'utf-8' ) )
|
||||
raise
|
||||
else:
|
||||
subprocess.check_call( *args, **kwargs )
|
||||
class MissingExecutable( Exception ):
|
||||
pass
|
||||
|
||||
|
||||
def PathToAnyWorkingPython3():
|
||||
# We can't rely on sys.executable because it's usually 'vim' (fixme, not with
|
||||
# neovim?)
|
||||
def GetPATHAsList():
|
||||
paths = os.environ[ 'PATH' ].split( os.pathsep )
|
||||
|
||||
if install.GetOS() == 'windows':
|
||||
paths.insert( 0, os.getcwd() )
|
||||
candidates = [ os.path.join( sys.exec_prefix, 'python.exe' ),
|
||||
'python.exe' ]
|
||||
else:
|
||||
candidates = [ os.path.join( sys.exec_prefix, 'bin', 'python3' ),
|
||||
'python3',
|
||||
'python' ]
|
||||
return paths
|
||||
|
||||
|
||||
def FindExecutable( executable: str, paths=None ):
|
||||
if not paths:
|
||||
paths = GetPATHAsList()
|
||||
|
||||
if install.GetOS() == 'windows':
|
||||
extensions = [ '.exe', '.bat', '.cmd' ]
|
||||
else:
|
||||
extensions = [ '' ]
|
||||
|
||||
for extension in extensions:
|
||||
if executable.endswith( extension ):
|
||||
candidate = executable
|
||||
else:
|
||||
candidate = executable + extension
|
||||
|
||||
for candidate in candidates:
|
||||
for path in paths:
|
||||
filename = os.path.abspath( os.path.join( path, candidate ) )
|
||||
if not os.path.isfile( filename ):
|
||||
|
|
@ -92,6 +92,42 @@ def PathToAnyWorkingPython3():
|
|||
|
||||
return filename
|
||||
|
||||
raise MissingExecutable( f"Unable to find executable { executable } in path" )
|
||||
|
||||
|
||||
|
||||
def CheckCall( cmd, *args, **kwargs ):
|
||||
cmd[ 0 ] = FindExecutable( cmd[ 0 ] )
|
||||
|
||||
if options.quiet:
|
||||
try:
|
||||
subprocess.check_output( cmd, *args, stderr=subprocess.STDOUT, **kwargs )
|
||||
except subprocess.CalledProcessError as e:
|
||||
print( e.output.decode( 'utf-8' ) )
|
||||
raise
|
||||
else:
|
||||
subprocess.check_call( cmd, *args, **kwargs )
|
||||
|
||||
|
||||
def PathToAnyWorkingPython3():
|
||||
# We can't rely on sys.executable because it's usually 'vim' (fixme, not with
|
||||
# neovim?)
|
||||
paths = GetPATHAsList()
|
||||
|
||||
if install.GetOS() == 'windows':
|
||||
candidates = [ os.path.join( sys.exec_prefix, 'python.exe' ),
|
||||
'python.exe' ]
|
||||
else:
|
||||
candidates = [ os.path.join( sys.exec_prefix, 'bin', 'python3' ),
|
||||
'python3',
|
||||
'python' ]
|
||||
|
||||
for candidate in candidates:
|
||||
try:
|
||||
return FindExecutable( candidate, paths=paths )
|
||||
except MissingExecutable:
|
||||
pass
|
||||
|
||||
raise RuntimeError( "Unable to find a working python3" )
|
||||
|
||||
|
||||
|
|
@ -348,7 +384,7 @@ def InstallDebugpy( name, root, gadget ):
|
|||
|
||||
|
||||
def InstallTclProDebug( name, root, gadget ):
|
||||
configure = [ './configure' ]
|
||||
configure = [ 'sh', './configure' ]
|
||||
|
||||
if install.GetOS() == 'macos':
|
||||
# Apple removed the headers from system frameworks because they are
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue