@@ -164,7 +164,7 @@ def _FixPath(path, separator="\\"):
164164 fixpath_prefix
165165 and path
166166 and not os .path .isabs (path )
167- and not path [0 ] = = "$"
167+ and path [0 ] ! = "$"
168168 and not _IsWindowsAbsPath (path )
169169 ):
170170 path = os .path .join (fixpath_prefix , path )
@@ -283,7 +283,7 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
283283 if not tools .get (tool_name ):
284284 tools [tool_name ] = dict ()
285285 tool = tools [tool_name ]
286- if "CompileAsWinRT" == setting :
286+ if setting == "CompileAsWinRT" :
287287 return
288288 if tool .get (setting ):
289289 if only_if_unset :
@@ -412,10 +412,7 @@ def _BuildCommandLineForRuleRaw(
412412 return input_dir_preamble + cmd
413413 else :
414414 # Convert cat --> type to mimic unix.
415- if cmd [0 ] == "cat" :
416- command = ["type" ]
417- else :
418- command = [cmd [0 ].replace ("/" , "\\ " )]
415+ command = ["type" ] if cmd [0 ] == "cat" else [cmd [0 ].replace ("/" , "\\ " )]
419416 # Add call before command to ensure that commands can be tied together one
420417 # after the other without aborting in Incredibuild, since IB makes a bat
421418 # file out of the raw command string, and some commands (like python) are
@@ -1384,10 +1381,7 @@ def _GetDefines(config):
13841381 """
13851382 defines = []
13861383 for d in config .get ("defines" , []):
1387- if type (d ) == list :
1388- fd = "=" .join ([str (dpart ) for dpart in d ])
1389- else :
1390- fd = str (d )
1384+ fd = "=" .join ([str (dpart ) for dpart in d ]) if isinstance (d , list ) else str (d )
13911385 defines .append (fd )
13921386 return defines
13931387
@@ -1598,10 +1592,7 @@ def _IdlFilesHandledNonNatively(spec, sources):
15981592 if rule ["extension" ] == "idl" and int (rule .get ("msvs_external_rule" , 0 )):
15991593 using_idl = True
16001594 break
1601- if using_idl :
1602- excluded_idl = [i for i in sources if i .endswith (".idl" )]
1603- else :
1604- excluded_idl = []
1595+ excluded_idl = [i for i in sources if i .endswith (".idl" )] if using_idl else []
16051596 return excluded_idl
16061597
16071598
@@ -3020,11 +3011,10 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30203011 _AddConditionalProperty (
30213012 properties , condition , "TargetVersion" , _ConfigTargetVersion (settings )
30223013 )
3023- if character_set :
3024- if "msvs_enable_winrt" not in spec :
3025- _AddConditionalProperty (
3026- properties , condition , "CharacterSet" , character_set
3027- )
3014+ if character_set and "msvs_enable_winrt" not in spec :
3015+ _AddConditionalProperty (
3016+ properties , condition , "CharacterSet" , character_set
3017+ )
30283018 return _GetMSBuildPropertyGroup (spec , "Configuration" , properties )
30293019
30303020
@@ -3326,15 +3316,14 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33263316 for tool_name , tool_settings in sorted (msbuild_settings .items ()):
33273317 # Skip the tool named '' which is a holder of global settings handled
33283318 # by _GetMSBuildConfigurationGlobalProperties.
3329- if tool_name :
3330- if tool_settings :
3331- tool = [tool_name ]
3332- for name , value in sorted (tool_settings .items ()):
3333- formatted_value = _GetValueFormattedForMSBuild (
3334- tool_name , name , value
3335- )
3336- tool .append ([name , formatted_value ])
3337- group .append (tool )
3319+ if tool_name and tool_settings :
3320+ tool = [tool_name ]
3321+ for name , value in sorted (tool_settings .items ()):
3322+ formatted_value = _GetValueFormattedForMSBuild (
3323+ tool_name , name , value
3324+ )
3325+ tool .append ([name , formatted_value ])
3326+ group .append (tool )
33383327 groups .append (group )
33393328 return groups
33403329
@@ -3462,10 +3451,7 @@ def _GetValueFormattedForMSBuild(tool_name, name, value):
34623451 "Link" : ["AdditionalOptions" ],
34633452 "Lib" : ["AdditionalOptions" ],
34643453 }
3465- if tool_name in exceptions and name in exceptions [tool_name ]:
3466- char = " "
3467- else :
3468- char = ";"
3454+ char = " " if name in exceptions .get (tool_name , []) else ";"
34693455 formatted_value = char .join (
34703456 [MSVSSettings .ConvertVCMacrosToMSBuild (i ) for i in value ]
34713457 )
0 commit comments