Skip to content

Commit

Permalink
#2467 add patch to silence egl file open warning
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Oct 27, 2023
1 parent 887514c commit 05d1494
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
28 changes: 28 additions & 0 deletions packaging/rpm/patches/pyopengl-egl-open-warning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From e727dc530f4abfe0091be068573d7dda311fc575 Mon Sep 17 00:00:00 2001
From: Antoine Martin <totaam@xpra.org>
Date: Fri, 27 Oct 2023 15:25:07 +0700
Subject: [PATCH] fix resource warning

```
/usr/lib/python3.11/site-packages/OpenGL/platform/egl.py:76: ResourceWarning: unclosed file <_io.TextIOWrapper
name='/proc/cpuinfo' mode='r' encoding='UTF-8'>
info = open('/proc/cpuinfo').read()
```
---
OpenGL/platform/egl.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/OpenGL/platform/egl.py b/OpenGL/platform/egl.py
index 55fbb0be..44b55024 100644
--- a/OpenGL/platform/egl.py
+++ b/OpenGL/platform/egl.py
@@ -73,7 +73,8 @@ def EGL(self):
# https://github.com/raspberrypi/firmware/issues/110
import os
if os.path.exists('/proc/cpuinfo'):
- info = open('/proc/cpuinfo').read()
+ with open('/proc/cpuinfo', 'r') as f:
+ info = f.read()
if 'BCM2708' in info or 'BCM2709' in info:
assert self.GLES2
try:
8 changes: 7 additions & 1 deletion packaging/rpm/python3-pyopengl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

Name: %{python3}-pyopengl
Version: 3.1.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Python 3 bindings for OpenGL
License: BSD
URL: http://pyopengl.sourceforge.net/
Source0: https://files.pythonhosted.org/packages/72/b6/970868d44b619292f1f54501923c69c9bd0ab1d2d44cf02590eac2706f4f/%{srcname}-%{version}.tar.gz
Source1: https://files.pythonhosted.org/packages/93/09/d08b3d07dbd88258276496a47273778f330f5ccf8390cb21b16b29d660de/%{srcname}-accelerate-%{version}.tar.gz
Patch0: pyopengl-egl-open-warning.patch

BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools
Expand Down Expand Up @@ -70,6 +71,8 @@ if [ "${sha256}" != "2b123621273a939f7fd2ec227541e399f9b5d4e815d69ae0bdb1b6c70a2
exit 1
fi
%setup -q -c -n %{srcname}-%{version} -T -a0 -a1
cd %{srcname}-%{version}
%patch -p1 -P 0


%build
Expand Down Expand Up @@ -112,6 +115,9 @@ rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info


%changelog
* Fri Oct 27 2023 Antoine Martin <antoine@xpra.org> - 3.1.7-2
- add patch to silence egl file open warning

* Mon Oct 02 2023 Antoine Martin <antoine@xpra.org> - 3.1.7-1
- new upstream release
- remove 'xpra' package suffix
Expand Down

0 comments on commit 05d1494

Please sign in to comment.