@@ -1364,8 +1364,7 @@ def _GetOutputTargetExt(spec):
13641364 Returns:
13651365 A string with the extension, or None
13661366 """
1367- target_extension = spec .get ("product_extension" )
1368- if target_extension :
1367+ if target_extension := spec .get ("product_extension" ):
13691368 return "." + target_extension
13701369 return None
13711370
@@ -3166,8 +3165,7 @@ def _GetMSBuildAttributes(spec, config, build_file):
31663165 "windows_driver" : "Link" ,
31673166 "static_library" : "Lib" ,
31683167 }
3169- msbuild_tool = msbuild_tool_map .get (spec ["type" ])
3170- if msbuild_tool :
3168+ if msbuild_tool := msbuild_tool_map .get (spec ["type" ]):
31713169 msbuild_settings = config ["finalized_msbuild_settings" ]
31723170 out_file = msbuild_settings [msbuild_tool ].get ("OutputFile" )
31733171 if out_file :
@@ -3184,8 +3182,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
31843182 # there are actions.
31853183 # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'.
31863184 new_paths = []
3187- cygwin_dirs = spec .get ("msvs_cygwin_dirs" , ["." ])[0 ]
3188- if cygwin_dirs :
3185+ if cygwin_dirs := spec .get ("msvs_cygwin_dirs" , ["." ])[0 ]:
31893186 cyg_path = "$(MSBuildProjectDirectory)\\ %s\\ bin\\ " % _FixPath (cygwin_dirs )
31903187 new_paths .append (cyg_path )
31913188 # TODO(jeanluc) Change the convention to have both a cygwin_dir and a
@@ -3370,7 +3367,6 @@ def _FinalizeMSBuildSettings(spec, configuration):
33703367 prebuild = configuration .get ("msvs_prebuild" )
33713368 postbuild = configuration .get ("msvs_postbuild" )
33723369 def_file = _GetModuleDefinition (spec )
3373- precompiled_header = configuration .get ("msvs_precompiled_header" )
33743370
33753371 # Add the information to the appropriate tool
33763372 # TODO(jeanluc) We could optimize and generate these settings only if
@@ -3408,7 +3404,7 @@ def _FinalizeMSBuildSettings(spec, configuration):
34083404 msbuild_settings , "ClCompile" , "DisableSpecificWarnings" , disabled_warnings
34093405 )
34103406 # Turn on precompiled headers if appropriate.
3411- if precompiled_header :
3407+ if precompiled_header := configuration . get ( "msvs_precompiled_header" ) :
34123408 # While MSVC works with just file name eg. "v8_pch.h", ClangCL requires
34133409 # the full path eg. "tools/msvs/pch/v8_pch.h" to find the file.
34143410 # P.S. Only ClangCL defines msbuild_toolset, for MSVC it is None.
0 commit comments