MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / set_build_var

Function set_build_var

configure.py:368–399  ·  view source on GitHub ↗

Set if query_item will be enabled for the build. Ask user if query_item will be enabled. Default is used if no input is given. Set subprocess environment variable and write to .bazelrc if enabled. Args: environ_cp: copy of the os.environ. var_name: string for name of environment vari

(environ_cp,
                  var_name,
                  query_item,
                  option_name,
                  enabled_by_default,
                  bazel_config_name=None)

Source from the content-addressed store, hash-verified

366
367
368def set_build_var(environ_cp,
369 var_name,
370 query_item,
371 option_name,
372 enabled_by_default,
373 bazel_config_name=None):
374 """Set if query_item will be enabled for the build.
375
376 Ask user if query_item will be enabled. Default is used if no input is given.
377 Set subprocess environment variable and write to .bazelrc if enabled.
378
379 Args:
380 environ_cp: copy of the os.environ.
381 var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
382 query_item: string for feature related to the variable, e.g. "CUDA for
383 Nvidia GPUs".
384 option_name: string for option to define in .bazelrc.
385 enabled_by_default: boolean for default behavior.
386 bazel_config_name: Name for Bazel --config argument to enable build feature.
387 """
388
389 var = str(int(get_var(environ_cp, var_name, query_item, enabled_by_default)))
390 environ_cp[var_name] = var
391 if var == '1':
392 write_to_bazelrc('build:%s --define %s=true' %
393 (bazel_config_name, option_name))
394 write_to_bazelrc('build --config=%s' % bazel_config_name)
395 elif bazel_config_name is not None:
396 # TODO(mikecase): Migrate all users of configure.py to use --config Bazel
397 # options and not to set build configs through environment variables.
398 write_to_bazelrc('build:%s --define %s=true' %
399 (bazel_config_name, option_name))
400
401
402def set_action_env_var(environ_cp,

Callers 1

mainFunction · 0.85

Calls 2

write_to_bazelrcFunction · 0.85
get_varFunction · 0.70

Tested by

no test coverage detected