1
0
Fork 0

single-file supports version cli flag now

This commit is contained in:
Nick Sweeting 2020-08-18 15:00:12 -04:00
parent 8b427c9d79
commit 71788cfd26

View file

@ -508,16 +508,9 @@ def bin_version(binary: Optional[str]) -> Optional[str]:
return None return None
try: try:
if binary.split('/')[-1] in ('single-file',): version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
# these dependencies dont support the --version flag, but are valid still # take first 3 columns of first line of version info
if run([abspath, "--help"], stdout=PIPE).returncode == 0: return ' '.join(version_str.split('\n')[0].strip().split()[:3])
return '0.0.0'
else:
return None
else:
version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
# take first 3 columns of first line of version info
return ' '.join(version_str.split('\n')[0].strip().split()[:3])
except OSError: except OSError:
pass pass
# stderr(f'[X] Unable to find working version of dependency: {binary}', color='red') # stderr(f'[X] Unable to find working version of dependency: {binary}', color='red')