scripts: west_commands: fix ZEPHYR_BASE env check

detect_version() used os.environ["ZEPHYR_BASE"],
which raises a KeyError when the variable is
absent, preventing the fallback path from running.
Switch to os.environ.get("ZEPHYR_BASE") and use
Path(__file__).resolve() for the fallback so the
path is absolute/canonical.

Signed-off-by: Paul Oberosler <paul.oberosler@raspberrypi.com>
1 file changed