Merge "cargo2rulesmk.py: Remove Python match usage" into main
This commit is contained in:
@@ -513,19 +513,18 @@ class Crate(object):
|
|||||||
|
|
||||||
def dump_trusty_module(self):
|
def dump_trusty_module(self):
|
||||||
"""Dump one or more module definitions, depending on crate_types."""
|
"""Dump one or more module definitions, depending on crate_types."""
|
||||||
match self.crate_types:
|
if len(self.crate_types) > 1:
|
||||||
case [_single]:
|
if "test" in self.crate_types:
|
||||||
pass
|
|
||||||
case multiple if "test" in multiple:
|
|
||||||
self.write("\nERROR: multiple crate types cannot include test type")
|
self.write("\nERROR: multiple crate types cannot include test type")
|
||||||
return
|
return
|
||||||
case multiple if "lib" in multiple:
|
|
||||||
|
if "lib" in self.crate_types:
|
||||||
print(f"### WARNING: crate {self.crate_name} has multiple "
|
print(f"### WARNING: crate {self.crate_name} has multiple "
|
||||||
f"crate types ({str(multiple)}). Treating as 'lib'")
|
f"crate types ({str(self.crate_types)}). Treating as 'lib'")
|
||||||
self.crate_types = ["lib"]
|
self.crate_types = ["lib"]
|
||||||
case unsupported:
|
else:
|
||||||
self.write("\nERROR: don't know how to handle crate types of "
|
self.write("\nERROR: don't know how to handle crate types of "
|
||||||
f"crate {self.crate_name}: {str(unsupported)}")
|
f"crate {self.crate_name}: {str(self.crate_types)}")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.dump_single_type_trusty_module()
|
self.dump_single_type_trusty_module()
|
||||||
@@ -672,16 +671,15 @@ class Crate(object):
|
|||||||
if hasattr(self.runner.args, "module_add_implicit_deps_reason"):
|
if hasattr(self.runner.args, "module_add_implicit_deps_reason"):
|
||||||
self.write(self.runner.args.module_add_implicit_deps_reason)
|
self.write(self.runner.args.module_add_implicit_deps_reason)
|
||||||
|
|
||||||
match self.runner.args.module_add_implicit_deps:
|
if self.runner.args.module_add_implicit_deps in [True, "yes"]:
|
||||||
case True | "yes":
|
self.write("MODULE_ADD_IMPLICIT_DEPS := true")
|
||||||
self.write("MODULE_ADD_IMPLICIT_DEPS := true")
|
elif self.runner.args.module_add_implicit_deps in [False, "no"]:
|
||||||
case False | "no":
|
self.write("MODULE_ADD_IMPLICIT_DEPS := false")
|
||||||
self.write("MODULE_ADD_IMPLICIT_DEPS := false")
|
else:
|
||||||
case other:
|
sys.exit(
|
||||||
sys.exit(
|
"ERROR: invalid value for module_add_implicit_deps: " +
|
||||||
"ERROR: invalid value for module_add_implicit_deps: " +
|
str(self.runner.args.module_add_implicit_deps)
|
||||||
str(other)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Runner(object):
|
class Runner(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user