diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/recipetool/create_go.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py index 0fb7115e26..a85a2f2786 100644 --- a/scripts/lib/recipetool/create_go.py +++ b/scripts/lib/recipetool/create_go.py | |||
| @@ -225,7 +225,7 @@ class GoRecipeHandler(RecipeHandler): | |||
| 225 | 225 | ||
| 226 | def __init__(self): | 226 | def __init__(self): |
| 227 | super().__init__() | 227 | super().__init__() |
| 228 | self.__srv = [] | 228 | self.__srv = {} |
| 229 | 229 | ||
| 230 | def handle_starttag(self, tag, attrs): | 230 | def handle_starttag(self, tag, attrs): |
| 231 | if tag == 'meta' and list( | 231 | if tag == 'meta' and list( |
| @@ -233,19 +233,14 @@ class GoRecipeHandler(RecipeHandler): | |||
| 233 | content = list( | 233 | content = list( |
| 234 | filter(lambda a: (a[0] == 'content'), attrs)) | 234 | filter(lambda a: (a[0] == 'content'), attrs)) |
| 235 | if content: | 235 | if content: |
| 236 | self.__srv = content[0][1].split() | 236 | srv = content[0][1].split() |
| 237 | self.__srv[srv[0]] = srv | ||
| 237 | 238 | ||
| 238 | @property | 239 | def go_import(self, modulepath): |
| 239 | def import_prefix(self): | 240 | if modulepath in self.__srv: |
| 240 | return self.__srv[0] if len(self.__srv) else None | 241 | srv = self.__srv[modulepath] |
| 241 | 242 | return GoImport(srv[0], srv[1], srv[2], None) | |
| 242 | @property | 243 | return None |
| 243 | def vcs(self): | ||
| 244 | return self.__srv[1] if len(self.__srv) else None | ||
| 245 | |||
| 246 | @property | ||
| 247 | def repourl(self): | ||
| 248 | return self.__srv[2] if len(self.__srv) else None | ||
| 249 | 244 | ||
| 250 | url = url.geturl() + "?go-get=1" | 245 | url = url.geturl() + "?go-get=1" |
| 251 | req = urllib.request.Request(url) | 246 | req = urllib.request.Request(url) |
| @@ -265,7 +260,7 @@ class GoRecipeHandler(RecipeHandler): | |||
| 265 | parser.feed(body.decode('utf-8')) | 260 | parser.feed(body.decode('utf-8')) |
| 266 | parser.close() | 261 | parser.close() |
| 267 | 262 | ||
| 268 | return GoImport(parser.import_prefix, parser.vcs, parser.repourl, None) | 263 | return parser.go_import(modulepath) |
| 269 | 264 | ||
| 270 | def __resolve_from_golang_proxy(self, modulepath, version): | 265 | def __resolve_from_golang_proxy(self, modulepath, version): |
| 271 | """ | 266 | """ |
