minor code cleanup (#144)

This commit is contained in:
bbarnes52 2018-10-25 02:30:25 -07:00 committed by irengrig
parent 2fc3d7b847
commit 8026d6f5ce
1 changed files with 2 additions and 7 deletions

View File

@ -201,7 +201,7 @@ def cc_external_rule_impl(ctx, attrs):
script, accepts ConfigureParameters script, accepts ConfigureParameters
and some other fields provided by the rule, which have been passed to create_attrs. and some other fields provided by the rule, which have been passed to create_attrs.
""" """
lib_name = _value(attrs.lib_name, ctx.attr.name) lib_name = attrs.lib_name or ctx.attr.name
inputs = _define_inputs(attrs) inputs = _define_inputs(attrs)
outputs = _define_outputs(ctx, attrs, lib_name) outputs = _define_outputs(ctx, attrs, lib_name)
@ -238,7 +238,7 @@ def cc_external_rule_impl(ctx, attrs):
"pushd $BUILD_TMPDIR", "pushd $BUILD_TMPDIR",
attrs.create_configure_script(ConfigureParameters(ctx = ctx, attrs = attrs, inputs = inputs)), attrs.create_configure_script(ConfigureParameters(ctx = ctx, attrs = attrs, inputs = inputs)),
"\n".join(attrs.make_commands), "\n".join(attrs.make_commands),
_value(attrs.postfix_script, ""), attrs.postfix_script or "",
# replace references to the root directory when building ($BUILD_TMPDIR) # replace references to the root directory when building ($BUILD_TMPDIR)
# and the root where the dependencies were installed ($EXT_BUILD_DEPS) # and the root where the dependencies were installed ($EXT_BUILD_DEPS)
# for the results which are in $INSTALLDIR (with placeholder) # for the results which are in $INSTALLDIR (with placeholder)
@ -306,11 +306,6 @@ def _correct_path_variable(env):
env["PATH"] = "$PATH:" + value env["PATH"] = "$PATH:" + value
return env return env
def _value(value, default_value):
if (value):
return value
return default_value
def _depset(item): def _depset(item):
if item == None: if item == None:
return depset() return depset()