Skip to content

Commit

Permalink
Add the function and test to parse wheel file #253
Browse files Browse the repository at this point in the history
Signed-off-by: Li <[email protected]>
  • Loading branch information
Li committed Jun 1, 2019
1 parent e4f62b7 commit 794a684
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/packagedcode/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,23 @@ def parse_wheel(location):
Passing wheel file location which is generated via setup.py bdist_wheel.
"""
wheel = Wheel(location)
if wheel:
if wheel and wheel.name:
common_data = dict(
name=wheel.name,
version=wheel.version,
description = wheel.description,
download_url = wheel.download_url,
homepage_url = wheel.home_page,
)
package = PythonPackage(**common_data)
if wheel.license:
#TODO: We should make the declared license as it is, this should be updated in scancode to parse a pure string
package.declared_license = {'license': wheel.license}

if wheel.maintainer:
common_data['parties'] = []
common_data['parties'].append(models.Party(
type=models.party_person, name=wheel.maintainer, role='author', email=wheel.maintainer_email))
return package


Expand Down Expand Up @@ -460,4 +471,4 @@ def build_package(package_data):
common_data['keywords'] = [k.strip() for k in kw.split(',') if k.strip()]

package = PythonPackage(**common_data)
return package
return package

0 comments on commit 794a684

Please sign in to comment.