summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 73a2fef287..c7fdd72901 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1686,15 +1686,23 @@ class CookerCollectFiles(object):
1686 1686
1687 # We need to track where we look so that we can add inotify watches. There 1687 # We need to track where we look so that we can add inotify watches. There
1688 # is no nice way to do this, this is horrid. We intercept the os.listdir() 1688 # is no nice way to do this, this is horrid. We intercept the os.listdir()
1689 # calls while we run glob(). 1689 # (or os.scandir() for python 3.6+) calls while we run glob().
1690 origlistdir = os.listdir 1690 origlistdir = os.listdir
1691 if hasattr(os, 'scandir'):
1692 origscandir = os.scandir
1691 searchdirs = [] 1693 searchdirs = []
1692 1694
1693 def ourlistdir(d): 1695 def ourlistdir(d):
1694 searchdirs.append(d) 1696 searchdirs.append(d)
1695 return origlistdir(d) 1697 return origlistdir(d)
1696 1698
1699 def ourscandir(d):
1700 searchdirs.append(d)
1701 return origscandir(d)
1702
1697 os.listdir = ourlistdir 1703 os.listdir = ourlistdir
1704 if hasattr(os, 'scandir'):
1705 os.scandir = ourscandir
1698 try: 1706 try:
1699 # Can't use set here as order is important 1707 # Can't use set here as order is important
1700 newfiles = [] 1708 newfiles = []
@@ -1714,6 +1722,8 @@ class CookerCollectFiles(object):
1714 newfiles.append(g) 1722 newfiles.append(g)
1715 finally: 1723 finally:
1716 os.listdir = origlistdir 1724 os.listdir = origlistdir
1725 if hasattr(os, 'scandir'):
1726 os.scandir = origscandir
1717 1727
1718 bbmask = config.getVar('BBMASK') 1728 bbmask = config.getVar('BBMASK')
1719 1729