* [PATCH 0/1] cooker: fix watching directories with Python 3.6+
@ 2017-10-19 3:32 Paul Eggleton
2017-10-19 3:32 ` [PATCH 1/1] " Paul Eggleton
0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2017-10-19 3:32 UTC (permalink / raw)
To: bitbake-devel
The following changes since commit be393f247a08c0a4a50a6a76b8fd57f78295d2a1:
toaster/highlight.pack.js: Fix corrupted file (2017-10-10 11:04:10 +0100)
are available in the git repository at:
git://git.openembedded.org/bitbake-contrib paule/python-36-inotify-fix
http://cgit.openembedded.org/bitbake-contrib/log/?h=paule/python-36-inotify-fix
Paul Eggleton (1):
cooker: fix watching directories with Python 3.6+
lib/bb/cooker.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--
2.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] cooker: fix watching directories with Python 3.6+
2017-10-19 3:32 [PATCH 0/1] cooker: fix watching directories with Python 3.6+ Paul Eggleton
@ 2017-10-19 3:32 ` Paul Eggleton
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2017-10-19 3:32 UTC (permalink / raw)
To: bitbake-devel
In Python 3.6, glob.glob() was reimplemented to use os.scandir() (which
itself appeared in Python 3.5), thus our monkey patching of os.listdir()
here was no longer effective. The end result was not only that bitbake
wouldn't notice added recipes or bbappends with BB_SERVER_TIMEOUT set
when being run with Python 3.6 (the shipped Python version on Fedora 26
and some other distribution versions), it also broke devtool modify,
devtool upgrade and devtool extract since they rely on the ability to
create a bbappend on the fly and have bitbake pick it up.
To fix it, do the same monkey patching for os.scandir(), which needs to
be conditional upon that actually existing since we have to support
Python 3.4 that doesn't have it. Long term we should probably look for a
better way to handle this that doesn't involve monkey patching Python
library code.
Fixes [YOCTO #12185].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/cooker.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 73a2fef..c7fdd72 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1686,15 +1686,23 @@ class CookerCollectFiles(object):
# We need to track where we look so that we can add inotify watches. There
# is no nice way to do this, this is horrid. We intercept the os.listdir()
- # calls while we run glob().
+ # (or os.scandir() for python 3.6+) calls while we run glob().
origlistdir = os.listdir
+ if hasattr(os, 'scandir'):
+ origscandir = os.scandir
searchdirs = []
def ourlistdir(d):
searchdirs.append(d)
return origlistdir(d)
+ def ourscandir(d):
+ searchdirs.append(d)
+ return origscandir(d)
+
os.listdir = ourlistdir
+ if hasattr(os, 'scandir'):
+ os.scandir = ourscandir
try:
# Can't use set here as order is important
newfiles = []
@@ -1714,6 +1722,8 @@ class CookerCollectFiles(object):
newfiles.append(g)
finally:
os.listdir = origlistdir
+ if hasattr(os, 'scandir'):
+ os.scandir = origscandir
bbmask = config.getVar('BBMASK')
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-19 3:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19 3:32 [PATCH 0/1] cooker: fix watching directories with Python 3.6+ Paul Eggleton
2017-10-19 3:32 ` [PATCH 1/1] " Paul Eggleton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.