aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-17 16:43:48 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-17 16:43:48 +0800
commit580dccba8d997a229e8c02e0fbbc75771a5aa372 (patch)
tree5e8967502a5136cfa7067ed23120748a27f712ff /fg21sim
parent6b14162d0b9a464be102daf0b0ff791a7b9e9f48 (diff)
downloadfg21sim-580dccba8d997a229e8c02e0fbbc75771a5aa372.tar.bz2
configs/manager.py: Fix the bug that breaks specifications loading
The "filter()" returns an iterator, that is consumed after the use, therefore, the "specfiles" is used by the print under "DEBUG_FG21SIM". Then "specfiles" is empty and thus prevents the reading of the specification files.
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/configs/manager.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py
index 5ee4ecf..3206c29 100644
--- a/fg21sim/configs/manager.py
+++ b/fg21sim/configs/manager.py
@@ -28,7 +28,10 @@ logger = logging.getLogger(__name__)
def _get_configspec():
"""Found and read all the configuration specifications"""
files = sorted(pkg_resources.resource_listdir(__name__, ""))
- specfiles = filter(lambda fn: fn.endswith(".conf.spec"), files)
+ # NOTE:
+ # Explicit convert the filter results to a list, since the returned
+ # iterator can ONLY be used ONCE.
+ specfiles = list(filter(lambda fn: fn.endswith(".conf.spec"), files))
if os.environ.get("DEBUG_FG21SIM"):
print("DEBUG: Found config specifications: %s" % ", ".join(specfiles),
file=sys.stderr)