diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-01-23 00:59:57 +1300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-24 09:40:33 +0000 |
| commit | 7e1691de0aa6aae6f86143b581700dd77c72afca (patch) | |
| tree | 1c75f31d90348391a22188ff239dc819d3e6cece /scripts/lib/recipetool/create_buildsys.py | |
| parent | 477fa84390b54a83d82a9555aaba8b467c5e6446 (diff) | |
| download | poky-7e1691de0aa6aae6f86143b581700dd77c72afca.tar.gz | |
recipetool: create: strip quotes from values extracted from CMakeLists.txt
Quoting is optional in CMakeLists.txt and is occasionally used, so strip
out quotes if they are present.
(From OE-Core rev: 4ffe2e1ec9df05b92a2ad5746fb0ca6d218fd77e)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create_buildsys.py')
| -rw-r--r-- | scripts/lib/recipetool/create_buildsys.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py index 6afb5de1c2..ba393a840d 100644 --- a/scripts/lib/recipetool/create_buildsys.py +++ b/scripts/lib/recipetool/create_buildsys.py | |||
| @@ -142,6 +142,9 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 142 | subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE) | 142 | subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE) |
| 143 | dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?') | 143 | dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?') |
| 144 | 144 | ||
| 145 | def interpret_value(value): | ||
| 146 | return value.strip('"') | ||
| 147 | |||
| 145 | def parse_cmake_file(fn, paths=None): | 148 | def parse_cmake_file(fn, paths=None): |
| 146 | searchpaths = (paths or []) + [os.path.dirname(fn)] | 149 | searchpaths = (paths or []) + [os.path.dirname(fn)] |
| 147 | logger.debug('Parsing file %s' % fn) | 150 | logger.debug('Parsing file %s' % fn) |
| @@ -166,13 +169,13 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 166 | continue | 169 | continue |
| 167 | res = proj_re.match(line) | 170 | res = proj_re.match(line) |
| 168 | if res: | 171 | if res: |
| 169 | extravalues['PN'] = res.group(1).split()[0] | 172 | extravalues['PN'] = interpret_value(res.group(1).split()[0]) |
| 170 | continue | 173 | continue |
| 171 | res = pkgcm_re.match(line) | 174 | res = pkgcm_re.match(line) |
| 172 | if res: | 175 | if res: |
| 173 | res = dep_re.findall(res.group(2)) | 176 | res = dep_re.findall(res.group(2)) |
| 174 | if res: | 177 | if res: |
| 175 | pcdeps.extend([x[0] for x in res]) | 178 | pcdeps.extend([interpret_value(x[0]) for x in res]) |
| 176 | inherits.append('pkgconfig') | 179 | inherits.append('pkgconfig') |
| 177 | continue | 180 | continue |
| 178 | res = pkgsm_re.match(line) | 181 | res = pkgsm_re.match(line) |
| @@ -180,7 +183,7 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 180 | res = dep_re.findall(res.group(2)) | 183 | res = dep_re.findall(res.group(2)) |
| 181 | if res: | 184 | if res: |
| 182 | # Note: appending a tuple here! | 185 | # Note: appending a tuple here! |
| 183 | item = tuple((x[0] for x in res)) | 186 | item = tuple((interpret_value(x[0]) for x in res)) |
| 184 | if len(item) == 1: | 187 | if len(item) == 1: |
| 185 | item = item[0] | 188 | item = item[0] |
| 186 | pcdeps.append(item) | 189 | pcdeps.append(item) |
| @@ -189,7 +192,7 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 189 | res = findpackage_re.match(line) | 192 | res = findpackage_re.match(line) |
| 190 | if res: | 193 | if res: |
| 191 | origpkg = res.group(1) | 194 | origpkg = res.group(1) |
| 192 | pkg = origpkg.lower() | 195 | pkg = interpret_value(origpkg.lower()) |
| 193 | if pkg == 'gettext': | 196 | if pkg == 'gettext': |
| 194 | inherits.append('gettext') | 197 | inherits.append('gettext') |
| 195 | elif pkg == 'perl': | 198 | elif pkg == 'perl': |
| @@ -209,7 +212,7 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 209 | continue | 212 | continue |
| 210 | res = checklib_re.match(line) | 213 | res = checklib_re.match(line) |
| 211 | if res: | 214 | if res: |
| 212 | lib = res.group(1) | 215 | lib = interpret_value(res.group(1)) |
| 213 | if not lib.startswith('$'): | 216 | if not lib.startswith('$'): |
| 214 | libdeps.append(lib) | 217 | libdeps.append(lib) |
| 215 | if line.lower().startswith('useswig'): | 218 | if line.lower().startswith('useswig'): |
