bindings: python: simplify environ access
authorPhil Howard <phil@gadgetoid.com>
Thu, 12 Oct 2023 19:51:39 +0000 (20:51 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 13 Oct 2023 08:36:31 +0000 (10:36 +0200)
Use environ.get() in lieu of an explicit check for GPIOD_WITH_TESTS in
os.environ.

Returns None and evaluates as False if GPIOD_WITH_TESTS == "1" is
not specified.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/setup.py

index fd674aa8daca5fecee89d9125e71662032a37a4a..df10e1892dc7ad6c58c423a826c22be2b942cef8 100644 (file)
@@ -50,7 +50,7 @@ procname_ext = Extension(
 )
 
 extensions = [gpiod_ext]
-if "GPIOD_WITH_TESTS" in environ and environ["GPIOD_WITH_TESTS"] == "1":
+if environ.get("GPIOD_WITH_TESTS") == "1":
     extensions.append(gpiosim_ext)
     extensions.append(procname_ext)