Skip to content

Get URL from PURL #86

Open
Open
@TG1999

Description

@TG1999

From gitter chat https://gitter.im/package-url/Lobby

@tclasen :

Anyone know why the python package isn't letting me get a url from a purl?
@app.command()
def get(purl: str):
    parsed = PackageURL.from_string(purl)
    typer.echo(f"Grabbing {parsed}")
    typer.echo("A", purl2url.get_url(purl))
    typer.echo("B", purl2url.get_url(parsed.to_string()))
    typer.echo("C", purl2url.get_url(str(parsed)))
    typer.echo("D", purl2url.get_url(parsed.to_string()))
For this I've tried the two following PURLs:

pkg:maven/org.apache.commons/[email protected]
pkg:pypi/[email protected]
And for both of them I successfully parse and can print the purl, but the A, B, C, D echos after that are all empty (but don't crash).

@pombredanne :

@tclasen because it has not been implemented yet : https://github.com/package-url/packageurl-python/blob/main/src/packageurl/contrib/purl2url.py :)
It should be reasonably straightforward using tidbits of code from https://github.com/nexB/fetchcode/blob/master/src/fetchcode/package.py and the expansive set in https://github.com/nexB/scancode-toolkit/tree/develop/src/packagedcode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions