Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for directory listed source archives in package.info #107

Merged
merged 15 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ python_requires = >=3.7
install_requires =
attrs
commoncode
htmllistparse
packageurl-python
requests
python-dateutil
Expand Down
784 changes: 781 additions & 3 deletions src/fetchcode/package.py

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/fetchcode/package_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def versions(purl):
except NoRouteAvailable:
return


@dataclasses.dataclass(frozen=True)
class PackageVersion:
value: str
Expand Down Expand Up @@ -377,8 +378,8 @@ def escape_path(path: str) -> str:


def fetch_version_info(version_info: str, escaped_pkg: str) -> Optional[PackageVersion]:
# Example version_info:
# "v1.3.0 2019-04-19T01:47:04Z"
# Example version_info:
# "v1.3.0 2019-04-19T01:47:04Z"
# "v1.3.0"
version_parts = version_info.split()
if not version_parts:
Expand All @@ -391,7 +392,7 @@ def fetch_version_info(version_info: str, escaped_pkg: str) -> Optional[PackageV
if date:
# get release date from the second part. see
# https://github.com/golang/go/blob/ac02fdec7cd16ea8d3de1fc33def9cfabec5170d/src/cmd/go/internal/modfetch/proxy.go#L136-L147

release_date = dateparser.parse(date)
else:
escaped_ver = escape_path(version)
Expand Down Expand Up @@ -537,7 +538,7 @@ def get_response(url, content_type="json", headers=None):
def remove_debian_default_epoch(version):
"""
Remove the default epoch from a Debian ``version`` string.

For Example::
>>> remove_debian_default_epoch("0:1.2.3-4")
'1.2.3-4'
Expand Down
Loading
Loading