"./mach env" cause unclear message

Use the "get" instead to avoid the error.
This commit is contained in:
wayling 2018-07-28 21:59:06 +08:00
parent e2fca1b228
commit 2ad37bda2c

View file

@ -38,12 +38,12 @@ class MachCommands(CommandBase):
category='bootstrap') category='bootstrap')
def env(self): def env(self):
env = self.build_env() env = self.build_env()
print("export RUSTFLAGS=%s" % env["RUSTFLAGS"]) print("export RUSTFLAGS=%s" % env.get("RUSTFLAGS", ""))
print("export PATH=%s" % env["PATH"]) print("export PATH=%s" % env.get("PATH", ""))
if sys.platform == "darwin": if sys.platform == "darwin":
print("export DYLD_LIBRARY_PATH=%s" % env["DYLD_LIBRARY_PATH"]) print("export DYLD_LIBRARY_PATH=%s" % env.get("DYLD_LIBRARY_PATH", ""))
else: else:
print("export LD_LIBRARY_PATH=%s" % env["LD_LIBRARY_PATH"]) print("export LD_LIBRARY_PATH=%s" % env.get("LD_LIBRARY_PATH", ""))
@Command('bootstrap', @Command('bootstrap',
description='Install required packages for building.', description='Install required packages for building.',