From 99c7ec3e1a1a7b7455f4ac9b7aff3983361a9ae0 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 19 Jul 2019 12:25:43 +0000 Subject: [PATCH] avoid file descriptor leak warning git-svn-id: https://xpra.org/svn/Xpra/trunk@23205 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/setup.py b/src/setup.py index bedc3e578c..eab9bdf352 100755 --- a/src/setup.py +++ b/src/setup.py @@ -2368,7 +2368,8 @@ def get_nvcc_version(command): #we have to figure out if "device_caps" exists in the headers: ENABLE_DEVICE_CAPS = False if os.path.exists("/usr/include/linux/videodev2.h"): - hdata = open("/usr/include/linux/videodev2.h").read() + with open("/usr/include/linux/videodev2.h") as f: + hdata = f.read() ENABLE_DEVICE_CAPS = hdata.find("device_caps")>=0 kwargs = {"ENABLE_DEVICE_CAPS" : ENABLE_DEVICE_CAPS} make_constants("xpra", "codecs", "v4l2", "constants", **kwargs)