diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-13 18:22:12 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-13 18:22:12 +0200 |
| commit | ac692af07a123b3d623e51df7f1e7a10b88c1ddd (patch) | |
| tree | c2e5f410748fb544f2c1e4b320729bb997553410 /kconfiglib.py | |
| parent | 47ab37c4e7c5c917bb57c0a6bdfbca72d2f2941d (diff) | |
Fix absolute $srctree prefixes showing up on gsource'd files
When using gsource with $srctree set to an absolute path, the $srctree
prefix would show up in MenuNode.filename, trickling its way into e.g.
generated documentation.
This was due to a broken test: os.path.isabs() was checked after joining
the pattern with $srctree, making it mistake an absolute $srctree for an
absolute path in the Kconfig file.
Fix the test.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index a879da4..c6a51f9 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2178,15 +2178,20 @@ class Kconfig(object): pattern = os.path.join(os.path.dirname(self._filename), pattern) - # If $srctree is set, glob relative to it - if self.srctree is not None: + if self.srctree is None: + strip_srctree = False + else: + # $srctree set and pattern not absolute? + strip_srctree = not os.path.isabs(pattern) + + # If $srctree is set, glob relative to it pattern = os.path.join(self.srctree, pattern) # Sort the glob results to ensure a consistent ordering of # Kconfig symbols, which indirectly ensures a consistent # ordering in e.g. .config files for filename in sorted(glob.iglob(pattern)): - if self.srctree is not None and not os.path.isabs(filename): + if strip_srctree: # Strip the $srctree prefix from the filename and let # the normal $srctree logic find the file. This makes # the globbed filenames appear without a $srctree |
