summaryrefslogtreecommitdiffstats
path: root/SCons/Scanner
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2021-01-09 15:08:36 (GMT)
committerAdam Gross <grossag@vmware.com>2021-01-09 15:08:36 (GMT)
commitb9085adbb23b2083a2064928377931578a456f8c (patch)
tree7f033a4f97fe115f9ff0f00d14e00b6aeecd5e0b /SCons/Scanner
parentd0661685465526aadd608f01941890dbe8df47d3 (diff)
downloadSCons-b9085adbb23b2083a2064928377931578a456f8c.zip
SCons-b9085adbb23b2083a2064928377931578a456f8c.tar.gz
SCons-b9085adbb23b2083a2064928377931578a456f8c.tar.bz2
Address review feedback
Better handle relative imports if no paths are provided.
Diffstat (limited to 'SCons/Scanner')
-rw-r--r--SCons/Scanner/Python.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/SCons/Scanner/Python.py b/SCons/Scanner/Python.py
index f8272df..86aa001 100644
--- a/SCons/Scanner/Python.py
+++ b/SCons/Scanner/Python.py
@@ -130,10 +130,6 @@ def scan(node, env, path=()):
if callable(path):
path = path()
- # If there are no paths, there is no point in parsing includes in the loop.
- if not path:
- return []
-
for module, imports in includes:
is_relative = module.startswith('.')
if is_relative:
@@ -152,6 +148,11 @@ def scan(node, env, path=()):
search_paths = [env.Dir(p) for p in path]
search_string = module
+ # If there are no paths, there is no point in parsing includes for this
+ # iteration of the loop.
+ if not search_paths:
+ continue
+
module_components = [x for x in search_string.split('.') if x]
package_dir = None
hit_dir = None