[libgpiod][PATCH 1/1] bindings: python: don't use exec to get __version__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Import __version__ from gpiod.version instead of using exec
since the latter is potentially unsafe and unnecessary.

Signed-off-by: Phil Howard <phil@xxxxxxxxxxxxx>
---
 bindings/python/setup.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 66b7908..278baee 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -5,6 +5,7 @@ from os import environ, path
 from setuptools import setup, Extension, find_packages
 from setuptools.command.build_ext import build_ext as orig_build_ext
 from shutil import rmtree
+from gpiod.version import __version__
 
 
 class build_ext(orig_build_ext):
@@ -54,9 +55,6 @@ if "GPIOD_WITH_TESTS" in environ and environ["GPIOD_WITH_TESTS"] == "1":
     extensions.append(gpiosim_ext)
     extensions.append(procname_ext)
 
-with open("gpiod/version.py", "r") as fd:
-    exec(fd.read())
-
 setup(
     name="libgpiod",
     packages=find_packages(exclude=["tests", "tests.*"]),
-- 
2.34.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux