Skip to content

Add support for homebrew packages - #47

Closed
tushar912 wants to merge 1 commit into
aboutcode-org:masterfrom
tushar912:issue-44
Closed

Add support for homebrew packages#47
tushar912 wants to merge 1 commit into
aboutcode-org:masterfrom
tushar912:issue-44

Conversation

@tushar912

Copy link
Copy Markdown

I have added support for homebrew packages.

@TG1999

TG1999 commented Feb 11, 2021

Copy link
Copy Markdown
Collaborator

Please use "black" for formatting

@tushar912

Copy link
Copy Markdown
Author

On the entire code?.... I thought that it might disturb the rest of code.

@TG1999

TG1999 commented Feb 11, 2021

Copy link
Copy Markdown
Collaborator

Run black on the files that you are submitting for review

@tushar912

Copy link
Copy Markdown
Author

Ok

@tushar912

Copy link
Copy Markdown
Author

@TG1999 I have ran black on the files I changed.

Comment thread tests/test_package.py
@mock.patch("fetchcode.package.get_response")
def test_homebrew_packages(mock_get):
side_effect = [file_data("tests/data/homebrew_mock_data.json")]
purl = "pkg:homebrew/node"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make one more test case where purl has a version in it.

@tushar912

Copy link
Copy Markdown
Author

@TG1999 I have added additional test case.

@TG1999

TG1999 commented Mar 1, 2021

Copy link
Copy Markdown
Collaborator

Hey @tushar912 please check what a version inside purl means, checkout packageurl-python to know more

@tushar912

Copy link
Copy Markdown
Author

Oh I misunderstood , I would make the change ASAP.

Signed-off-by: Tushar912 <tushar.912u@gmail.com>
@TG1999

TG1999 commented Mar 2, 2021

Copy link
Copy Markdown
Collaborator

@pombredanne @MaJuRG ping

Comment thread fetchcode/package.py
Comment on lines +354 to +362
versions = response.get("versions") or {}
version_purl = PackageURL(type=purl.type, name=name, version=versions.get("stable"))
yield Package(
homepage_url=homepage_url,
api_url=api_url,
declared_license=declared_license,
download_url=download_url,
**version_purl.to_dict(),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is more than one entry in versions, wouldnt we need to loop thru them all?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaJuRG I checked and from what I can see there is only one version of interest under the attribute "stable"
@tushar912 do you concur?

Comment thread fetchcode/package.py
urls = response.get("urls") or {}
stable_url = urls.get("stable") or {}
download_url = stable_url.get("url")
yield Package(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we yield a package without a version and one with a version?

@pombredanne

Copy link
Copy Markdown
Member

This is highly similar (of course) to the code in #44 .... when merging (it still needs love) I think it would be best to credit both authors.

@pombredanne

Copy link
Copy Markdown
Member

@tushar912 gentle ping ... do you still want to finish merge this so we can merge? If not we may close it soon. Thanks!

pombredanne added a commit that referenced this pull request Feb 9, 2022
Handle as_text correctly in cache
@keshav-space

Copy link
Copy Markdown
Member

@tushar912 closing this, feel free to reopen if you’re still interested in getting this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants