Skip to content

Commit 2361d15

Browse files
committed
Apply coding style. via flake8-ycm
1 parent c16b47e commit 2361d15

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

build.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,57 +115,57 @@ def Exit( self ):
115115
'See the YCM docs for details on how to use a custom Clangd.' )
116116

117117

118-
def FindLatestMSVC(quiet):
119-
ACCEPTABLE_VERSIONS = [17, 16, 15]
118+
def FindLatestMSVC( quiet ):
119+
ACCEPTABLE_VERSIONS = [ 17, 16, 15 ]
120120

121-
VSWHERE_EXE = os.path.join(os.environ['ProgramFiles(x86)'],
121+
VSWHERE_EXE = os.path.join( os.environ[ 'ProgramFiles(x86)' ],
122122
'Microsoft Visual Studio',
123-
'Installer', 'vswhere.exe')
123+
'Installer', 'vswhere.exe' )
124124

125-
if os.path.exists(VSWHERE_EXE):
125+
if os.path.exists( VSWHERE_EXE ):
126126
if not quiet:
127-
print("Calling vswhere -latest -installationVersion")
127+
print( "Calling vswhere -latest -installationVersion" )
128128
latest_full_v = subprocess.check_output(
129-
[VSWHERE_EXE, '-latest', '-property', 'installationVersion']
129+
[ VSWHERE_EXE, '-latest', '-property', 'installationVersion' ]
130130
).strip().decode()
131131
if '.' in latest_full_v:
132132
try:
133-
latest_v = int(latest_full_v.split('.')[0])
133+
latest_v = int( latest_full_v.split( '.' )[ 0 ] )
134134
except ValueError:
135-
raise ValueError("{latest_full_v=} is not a version number.")
135+
raise ValueError( "{latest_full_v=} is not a version number." )
136136

137137
if not quiet:
138-
print(f'vswhere -latest returned version {latest_full_v=}')
138+
print( f'vswhere -latest returned version {latest_full_v=}' )
139139

140140
if latest_v not in ACCEPTABLE_VERSIONS:
141141
if latest_v > 17:
142142
if not quiet:
143-
print(f'MSVC Version {latest_full_v=} is newer than expected.')
143+
print( f'MSVC Version {latest_full_v=} is newer than expected.' )
144144
else:
145145
raise ValueError(
146146
f'vswhere returned {latest_full_v=} which is unexpected.'
147-
'Pass --msvc <version> argument.')
147+
'Pass --msvc <version> argument.' )
148148
return latest_v
149149
else:
150150
if not quiet:
151-
print(f'vswhere returned nothing usable, {latest_full_v=}')
151+
print( f'vswhere returned nothing usable, {latest_full_v=}' )
152152

153153
# Fall back to registry parsing, which works at least until MSVC 2019 (16)
154154
# but is likely failing on MSVC 2022 (17)
155155
if not quiet:
156-
print("vswhere method failed, falling back to searching the registry")
156+
print( "vswhere method failed, falling back to searching the registry" )
157157

158158
import winreg
159-
handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
159+
handle = winreg.ConnectRegistry( None, winreg.HKEY_LOCAL_MACHINE )
160160
msvc = None
161161
for i in ACCEPTABLE_VERSIONS:
162162
if not quiet:
163-
print('Trying to find '
164-
rf'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\{i}.0')
163+
print( 'Trying to find '
164+
rf'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\{i}.0' )
165165
try:
166-
winreg.OpenKey(handle, rf'SOFTWARE\Microsoft\VisualStudio\{i}.0')
166+
winreg.OpenKey( handle, rf'SOFTWARE\Microsoft\VisualStudio\{i}.0' )
167167
if not quiet:
168-
print(f"Found MSVC version {i}")
168+
print( f"Found MSVC version {i}" )
169169
msvc = i
170170
break
171171
except FileNotFoundError:
@@ -468,7 +468,7 @@ def ParseArguments():
468468
help = 'Use system libclang instead of downloading one '
469469
'from llvm.org. NOT RECOMMENDED OR SUPPORTED!' )
470470
if OnWindows():
471-
parser.add_argument( '--msvc', type = int, choices = [ 15, 16, 17 ],
471+
parser.add_argument( '--msvc', type = int, choices = [ 15, 16, 17 ],
472472
default=None,
473473
help= 'Choose the Microsoft Visual Studio version '
474474
'(default: %(default)s).' )
@@ -551,9 +551,9 @@ def ParseArguments():
551551
args.enable_debug = True
552552

553553
if OnWindows() and args.msvc is None:
554-
args.msvc = FindLatestMSVC(args.quiet)
554+
args.msvc = FindLatestMSVC( args.quiet )
555555
if args.msvc is None:
556-
raise FileNotFoundError("Could not find a valid MSVC version.")
556+
raise FileNotFoundError( "Could not find a valid MSVC version." )
557557

558558
if args.core_tests:
559559
os.environ[ 'YCM_TESTRUN' ] = '1'

0 commit comments

Comments
 (0)