Yield one or more Package manifest objects given a file ``location`` pointing to a package archive, manifest or similar.
(cls, location, package_only=False)
| 218 | |
| 219 | @classmethod |
| 220 | def parse(cls, location, package_only=False): |
| 221 | """ |
| 222 | Yield one or more Package manifest objects given a file ``location`` |
| 223 | pointing to a package archive, manifest or similar. |
| 224 | """ |
| 225 | podspec = spec.parse_spec( |
| 226 | location=location, |
| 227 | package_type=cls.default_package_type, |
| 228 | ) |
| 229 | |
| 230 | name = podspec.get('name') |
| 231 | version = podspec.get('version') |
| 232 | homepage_url = podspec.get('homepage') |
| 233 | extracted_license_statement = podspec.get('license') |
| 234 | summary = podspec.get('summary') |
| 235 | description = podspec.get('description') |
| 236 | description = build_description( |
| 237 | summary=summary, |
| 238 | description=description, |
| 239 | ) |
| 240 | vcs_url = podspec.get('source') or '' |
| 241 | authors = podspec.get('author') or [] |
| 242 | |
| 243 | # FIXME: we are doing nothing with the email list |
| 244 | parties = [] |
| 245 | if authors: |
| 246 | for author in authors: |
| 247 | auth, email = parse_person(author) |
| 248 | party = models.Party( |
| 249 | type=models.party_person, |
| 250 | name=auth, |
| 251 | email=email, |
| 252 | role='author', |
| 253 | ) |
| 254 | parties.append(party) |
| 255 | |
| 256 | urls = get_urls( |
| 257 | name=name, |
| 258 | version=version, |
| 259 | homepage_url=homepage_url, |
| 260 | vcs_url=vcs_url) |
| 261 | |
| 262 | package_data = dict( |
| 263 | datasource_id=cls.datasource_id, |
| 264 | type=cls.default_package_type, |
| 265 | name=name, |
| 266 | version=version, |
| 267 | primary_language=cls.default_primary_language, |
| 268 | vcs_url=vcs_url, |
| 269 | # FIXME: a source should be a PURL, not a list of URLs |
| 270 | # source_packages=vcs_url.split('\n'), |
| 271 | description=description, |
| 272 | extracted_license_statement=extracted_license_statement, |
| 273 | homepage_url=homepage_url, |
| 274 | parties=parties, |
| 275 | **urls, |
| 276 | ) |
| 277 | yield models.PackageData.from_data(package_data, package_only) |
nothing calls this directly
no test coverage detected