Message ID | 20231012195139.81613-1-phil@gadgetoid.com |
---|---|
State | New |
Headers | show |
Series | [libgpiod] bindings: python: simplify environ access | expand |
On Thu, Oct 12, 2023 at 9:51 PM Phil Howard <phil@gadgetoid.com> wrote: > > 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> > --- > bindings/python/setup.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bindings/python/setup.py b/bindings/python/setup.py > index fd674aa..df10e18 100644 > --- a/bindings/python/setup.py > +++ b/bindings/python/setup.py > @@ -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) > > -- > 2.34.1 > Applied, thanks! Bart
diff --git a/bindings/python/setup.py b/bindings/python/setup.py index fd674aa..df10e18 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -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)
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> --- bindings/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)