diff --git a/NOTICE b/NOTICE index 65936b2b..cbdaef79 100644 --- a/NOTICE +++ b/NOTICE @@ -2,7 +2,7 @@ # Copyright (c) nexB Inc. and others. # SPDX-License-Identifier: Apache-2.0 # -# Visit https://aboutcode.org and https://github.com/nexB/ for support and download. +# Visit https://aboutcode.org and https://github.com/aboutcode-org/ for support and download. # ScanCode is a trademark of nexB Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/README.rst b/README.rst index df744442..2c107598 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ systems. It can work using plain HTTP and FTP URLs, as well as as used in Python pip and as specified in `SPDX Package Download Location `_ -Homepage and support: https://github.com/nexB/fetchcode +Homepage and support: https://github.com/aboutcode-org/fetchcode Why FetchCode? @@ -24,7 +24,7 @@ Development installation Clone the repo:: - git clone https://github.com/nexB/fetchcode + git clone https://github.com/aboutcode-org/fetchcode Then install all the requirements using this command (on POSIX):: @@ -45,13 +45,13 @@ Usage Fetch a code archive and get a ``fetchcode.fetch.Response`` object back:: >>> from fetchcode import fetch - >>> f = fetch('https://github.com/nexB/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip') + >>> f = fetch('https://github.com/aboutcode-org/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip') >>> f.location '/tmp/tmp_cm02xsg' >>> f.content_type 'application/zip' >>> f.url - 'https://github.com/nexB/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip' + 'https://github.com/aboutcode-org/fetchcode/archive/ab65b2e645c889887227ea49eb3332d885fd0a54.zip' Fetch some package metadata and get a ``fetchcode.packagedcode_models.Package`` object back:: diff --git a/configure b/configure index 926a894e..22d92885 100755 --- a/configure +++ b/configure @@ -3,7 +3,7 @@ # Copyright (c) nexB Inc. and others. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/ for support or download. +# See https://github.com/aboutcode-org/ for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # diff --git a/configure.bat b/configure.bat index 5e95b311..5b9a9d68 100644 --- a/configure.bat +++ b/configure.bat @@ -4,7 +4,7 @@ @rem Copyright (c) nexB Inc. and others. All rights reserved. @rem SPDX-License-Identifier: Apache-2.0 @rem See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -@rem See https://github.com/nexB/ for support or download. +@rem See https://github.com/aboutcode-org/ for support or download. @rem See https://aboutcode.org for more information about nexB OSS projects. diff --git a/setup.cfg b/setup.cfg index 200c39cb..e40f38ac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ license = Apache-2.0 description = fetchcode is a library to reliably fetch code via HTTP, FTP and version control systems. long_description = file:README.rst long_description_content_type = text/x-rst -url = https://github.com/nexB/fetchcode +url = https://github.com/aboutcode-org/fetchcode author = nexB. Inc. and others author_email = info@aboutcode.org diff --git a/src/fetchcode/__init__.py b/src/fetchcode/__init__.py index c573991f..115e4a7e 100644 --- a/src/fetchcode/__init__.py +++ b/src/fetchcode/__init__.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -41,7 +41,7 @@ def __init__(self, location, content_type, size, url): def fetch_http(url, location): """ Return a `Response` object built from fetching the content at a HTTP/HTTPS based `url` URL string - saving the content in a file at `location` + saving the content in a file at `location` """ r = requests.get(url) with open(location, 'wb') as f: @@ -51,7 +51,8 @@ def fetch_http(url, location): size = r.headers.get('content-length') size = int(size) if size else None - resp = Response(location=location, content_type=content_type, size=size, url=url) + resp = Response(location=location, + content_type=content_type, size=size, url=url) return resp @@ -59,7 +60,7 @@ def fetch_http(url, location): def fetch_ftp(url, location): """ Return a `Response` object built from fetching the content at a FTP based `url` URL string - saving the content in a file at `location` + saving the content in a file at `location` """ url_parts = urlparse(url) @@ -84,7 +85,8 @@ def fetch_ftp(url, location): ftp.retrbinary(file, f.write) ftp.close() - resp = Response(location=location, content_type=content_type, size=size, url=url) + resp = Response(location=location, + content_type=content_type, size=size, url=url) return resp diff --git a/src/fetchcode/package.py b/src/fetchcode/package.py index 22d50b9c..edba3733 100644 --- a/src/fetchcode/package.py +++ b/src/fetchcode/package.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -92,7 +92,8 @@ def get_cargo_data_from_purl(purl): ) versions = response.get("versions", []) for version in versions: - version_purl = PackageURL(type=purl.type, name=name, version=version.get("num")) + version_purl = PackageURL( + type=purl.type, name=name, version=version.get("num")) dl_path = version.get("dl_path") if dl_path: download_url = f"{base_url}/{dl_path}" @@ -355,7 +356,8 @@ def get_gnu_data_from_purl(purl): purl = PackageURL.from_string(purl) source_archive_url = f"https://ftp.gnu.org/pub/gnu/{purl.name}/" version_regex_template = r"^({}-)(?P[\w.-]*)(.tar.gz)$" - version_regex = re.compile(version_regex_template.format(re.escape(purl.name))) + version_regex = re.compile( + version_regex_template.format(re.escape(purl.name))) yield from extract_packages_from_listing( purl, source_archive_url, version_regex, [] @@ -427,7 +429,8 @@ def get_package_info(cls, package_url): else: for version, data in UDHCP_RELEASES.items(): - purl = PackageURL(type="generic", name="udhcp", version=version) + purl = PackageURL( + type="generic", name="udhcp", version=version) yield Package( homepage_url=cls.source_url, download_url=data["url"], @@ -481,7 +484,8 @@ class UtilLinuxDirectoryListedSource(DirectoryListedSource): class BusyBoxDirectoryListedSource(DirectoryListedSource): source_url = "https://www.busybox.net/downloads/" # Source archive ex: busybox-1.2.3.tar.bz2 - source_archive_regex = re.compile(r"^(busybox-)(?P[\w.-]*)(.tar.bz2)$") + source_archive_regex = re.compile( + r"^(busybox-)(?P[\w.-]*)(.tar.bz2)$") is_nested = False ignored_files_and_dir = [] @@ -489,7 +493,8 @@ class BusyBoxDirectoryListedSource(DirectoryListedSource): class UclibcDirectoryListedSource(DirectoryListedSource): source_url = "https://www.uclibc.org/downloads/" # Source archive ex: uClibc-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(uClibc-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(uClibc-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -497,7 +502,8 @@ class UclibcDirectoryListedSource(DirectoryListedSource): class UclibcNGDirectoryListedSource(DirectoryListedSource): source_url = "https://downloads.uclibc-ng.org/releases/" # Source archive ex: uClibc-ng-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(uClibc-ng-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(uClibc-ng-)(?P[\w.-]*)(.tar.gz)$") is_nested = True ignored_files_and_dir = [] @@ -505,7 +511,8 @@ class UclibcNGDirectoryListedSource(DirectoryListedSource): class Bzip2DirectoryListedSource(DirectoryListedSource): source_url = "https://sourceware.org/pub/bzip2/" # Source archive ex: bzip2-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(bzip2-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(bzip2-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -513,7 +520,8 @@ class Bzip2DirectoryListedSource(DirectoryListedSource): class OpenSSHDirectoryListedSource(DirectoryListedSource): source_url = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/" # Source archive ex: openssh-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(openssh-)(?P[\w.-]*)(.tgz|.tar.gz)$") + source_archive_regex = re.compile( + r"^(openssh-)(?P[\w.-]*)(.tgz|.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -531,7 +539,8 @@ class DnsmasqDirectoryListedSource(DirectoryListedSource): class EbtablesDirectoryListedSource(DirectoryListedSource): source_url = "https://www.netfilter.org/pub/ebtables/" # Source archive ex: ebtables-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(ebtables-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(ebtables-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -539,7 +548,8 @@ class EbtablesDirectoryListedSource(DirectoryListedSource): class HostapdDirectoryListedSource(DirectoryListedSource): source_url = "https://w1.fi/releases/" # Source archive ex: hostapd-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(hostapd-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(hostapd-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -557,7 +567,8 @@ class Iproute2DirectoryListedSource(DirectoryListedSource): class IptablesDirectoryListedSource(DirectoryListedSource): source_url = "https://www.netfilter.org/pub/iptables/" # Source archive ex: iptables-1.2.3.tar.bz2 - source_archive_regex = re.compile(r"^(iptables-)(?P[\w.-]*)(.tar.bz2)$") + source_archive_regex = re.compile( + r"^(iptables-)(?P[\w.-]*)(.tar.bz2)$") is_nested = False ignored_files_and_dir = [] @@ -565,7 +576,8 @@ class IptablesDirectoryListedSource(DirectoryListedSource): class LibnlDirectoryListedSource(DirectoryListedSource): source_url = "https://www.infradead.org/~tgr/libnl/files/" # Source archive ex: libnl-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(libnl-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(libnl-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -573,7 +585,8 @@ class LibnlDirectoryListedSource(DirectoryListedSource): class LighttpdDirectoryListedSource(DirectoryListedSource): source_url = "https://download.lighttpd.net/lighttpd/releases-1.4.x/" # Source archive ex: lighttpd-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(lighttpd-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(lighttpd-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -601,7 +614,8 @@ class WpaSupplicantDirectoryListedSource(DirectoryListedSource): class SyslinuxDirectoryListedSource(DirectoryListedSource): source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/" # Source archive ex: syslinux-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(syslinux-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(syslinux-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -609,7 +623,8 @@ class SyslinuxDirectoryListedSource(DirectoryListedSource): class SyslinuxDirectoryListedSource(DirectoryListedSource): source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/" # Source archive ex: syslinux-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(syslinux-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(syslinux-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -646,7 +661,8 @@ class DropbearDirectoryListedSource(DirectoryListedSource): class SambaDirectoryListedSource(DirectoryListedSource): source_url = "https://download.samba.org/pub/samba/stable/" # Source archive ex: samba-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(samba-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(samba-)(?P[\w.-]*)(.tar.gz)$") is_nested = False ignored_files_and_dir = [] @@ -654,7 +670,8 @@ class SambaDirectoryListedSource(DirectoryListedSource): class MtdUtilsDirectoryListedSource(DirectoryListedSource): source_url = "https://infraroot.at/pub/mtd/" # Source archive ex: mtd-utils-1.2.3.tar.bz2 - source_archive_regex = re.compile(r"^(mtd-utils-)(?P[\w.-]*)(.tar.bz2)$") + source_archive_regex = re.compile( + r"^(mtd-utils-)(?P[\w.-]*)(.tar.bz2)$") is_nested = False ignored_files_and_dir = [] @@ -662,7 +679,8 @@ class MtdUtilsDirectoryListedSource(DirectoryListedSource): class BareboxDirectoryListedSource(DirectoryListedSource): source_url = "https://www.barebox.org/download/" # Source archive ex: barebox-1.2.3.tar.bz2 - source_archive_regex = re.compile(r"^(barebox-)(?P[\w.-]*)(.tar.bz2)$") + source_archive_regex = re.compile( + r"^(barebox-)(?P[\w.-]*)(.tar.bz2)$") is_nested = False ignored_files_and_dir = [] @@ -670,7 +688,8 @@ class BareboxDirectoryListedSource(DirectoryListedSource): class LinuxDirectoryListedSource(DirectoryListedSource): source_url = "https://mirrors.edge.kernel.org/pub/linux/kernel/" # Source archive ex: linux-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(linux-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(linux-)(?P[\w.-]*)(.tar.gz)$") is_nested = True ignored_files_and_dir = [ "Historic/", @@ -692,7 +711,8 @@ class E2fsprogsDirectoryListedSource(DirectoryListedSource): "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/" ) # Source archive ex: e2fsprogs-1.2.3.tar.gz - source_archive_regex = re.compile(r"^(e2fsprogs-)(?P[\w.-]*)(.tar.gz)$") + source_archive_regex = re.compile( + r"^(e2fsprogs-)(?P[\w.-]*)(.tar.gz)$") is_nested = True ignored_files_and_dir = ["testing/"] diff --git a/src/fetchcode/package_util.py b/src/fetchcode/package_util.py index 282f9261..2acb1b95 100644 --- a/src/fetchcode/package_util.py +++ b/src/fetchcode/package_util.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -165,7 +165,8 @@ class SquashfsToolsGitHubSource(GitHubSource): class PupnpGitHubSource(GitHubSource): - version_regex = re.compile(r"\brelease-?(?P(?:\d+(\.\d+){1,2}))\b") + version_regex = re.compile( + r"\brelease-?(?P(?:\d+(\.\d+){1,2}))\b") ignored_tag_regex = None @@ -180,7 +181,8 @@ class BpftoolGitHubSource(GitHubSource): class SqliteGitHubSource(GitHubSource): - version_regex = re.compile(r"\bversion-?(?P(?:\d+(\.\d+){1,2}))\b") + version_regex = re.compile( + r"\bversion-?(?P(?:\d+(\.\d+){1,2}))\b") ignored_tag_regex = None @@ -190,7 +192,8 @@ class LlvmGitHubSource(GitHubSource): class RpmGitHubSource(GitHubSource): - version_regex = re.compile(r"rpm-(?P[^-]+(?:-(?!release).*)?|-release)") + version_regex = re.compile( + r"rpm-(?P[^-]+(?:-(?!release).*)?|-release)") ignored_tag_regex = None diff --git a/src/fetchcode/package_versions.py b/src/fetchcode/package_versions.py index 0a565d04..d2720b3d 100644 --- a/src/fetchcode/package_versions.py +++ b/src/fetchcode/package_versions.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -317,7 +317,8 @@ def get_golang_versions_from_purl(purl): break if response is None or escaped_pkg is None or trimmed_pkg is None: - logger.error(f"Error while fetching versions for {package_slug!r} from goproxy") + logger.error( + f"Error while fetching versions for {package_slug!r} from goproxy") return for version_info in response.split("\n"): @@ -347,7 +348,7 @@ def trim_go_url_path(url_path: str) -> Optional[str]: # some advisories contains this prefix in package name, e.g. https://github.com/advisories/GHSA-7h6j-2268-fhcm go_url_prefix = "https://pkg.go.dev/" if url_path.startswith(go_url_prefix): - url_path = url_path[len(go_url_prefix) :] + url_path = url_path[len(go_url_prefix):] parsed_url_path = urlparse(url_path) path = parsed_url_path.path @@ -408,7 +409,8 @@ def fetch_version_info(version_info: str, escaped_pkg: str) -> Optional[PackageV f"Error while fetching version info for {escaped_pkg}/{escaped_ver} " f"from goproxy:\n{traceback.format_exc()}" ) - release_date = dateparser.parse(response.get("Time", "")) if response else None + release_date = dateparser.parse( + response.get("Time", "")) if response else None return PackageVersion(value=version, release_date=release_date) diff --git a/src/fetchcode/packagedcode_models.py b/src/fetchcode/packagedcode_models.py index fd48ae78..f76cae3c 100644 --- a/src/fetchcode/packagedcode_models.py +++ b/src/fetchcode/packagedcode_models.py @@ -1,7 +1,7 @@ -# Copied from https://github.com/nexB/scancode-toolkit/blob/b4ea9c640f8ee4ed8851b5618c6d223bb1c02d47/src/packagedcode/models.py +# Copied from https://github.com/aboutcode-org/scancode-toolkit/blob/b4ea9c640f8ee4ed8851b5618c6d223bb1c02d47/src/packagedcode/models.py # # Copyright (c) 2017 nexB Inc. and others. All rights reserved. -# http://nexb.com and https://github.com/nexB/scancode-toolkit/ +# http://nexb.com and https://github.com/aboutcode-org/scancode-toolkit/ # The ScanCode software is licensed under the Apache License version 2.0. # Data generated with ScanCode require an acknowledgment. # ScanCode is a trademark of nexB Inc. @@ -21,7 +21,7 @@ # ScanCode should be considered or used as legal advice. Consult an Attorney # for any legal advice. # ScanCode is a free software code scanning tool from nexB Inc. and others. -# Visit https://github.com/nexB/scancode-toolkit/ for support and download. +# Visit https://github.com/aboutcode-org/scancode-toolkit/ for support and download. from __future__ import absolute_import from __future__ import print_function @@ -144,7 +144,7 @@ class Party(BaseModel): validator=choices(PARTY_TYPES), label='party type', help='the type of this party: One of: ' - +', '.join(p for p in PARTY_TYPES if p)) + + ', '.join(p for p in PARTY_TYPES if p)) role = String( label='party role', @@ -284,7 +284,8 @@ def set_purl(self, package_url): if not isinstance(package_url, PackageURL): package_url = PackageURL.from_string(package_url) - attribs = ['type', 'namespace', 'name', 'version', 'qualifiers', 'subpath'] + attribs = ['type', 'namespace', 'name', + 'version', 'qualifiers', 'subpath'] for att in attribs: self_val = getattr(self, att) purl_val = getattr(package_url, att) @@ -302,7 +303,8 @@ def to_dict(self, **kwargs): mapping['repository_download_url'] = self.repository_download_url() mapping['api_data_url'] = self.api_data_url() if self.qualifiers: - mapping['qualifiers'] = normalize_qualifiers(self.qualifiers, encode=False) + mapping['qualifiers'] = normalize_qualifiers( + self.qualifiers, encode=False) return mapping @classmethod @@ -399,7 +401,7 @@ class Package(BasePackage): api_url = String( label='API URL', - help='URL of API for this package.') + help='URL of API for this package.') size = Integer( default=None, @@ -433,8 +435,8 @@ class Package(BasePackage): vcs_url = String( help='a URL to the VCS repository in the SPDX form of: ' 'https://github.com/nexb/scancode-toolkit.git@405aaa4b3 ' - 'See SPDX specification "Package Download Location" ' - 'at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 ') + 'See SPDX specification "Package Download Location" ' + 'at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 ') copyright = String( label='Copyright', @@ -608,7 +610,8 @@ class DebianPackage(Package): metafiles = ('*.control',) extensions = ('.deb',) filetypes = ('debian binary package',) - mimetypes = ('application/x-archive', 'application/vnd.debian.binary-package',) + mimetypes = ('application/x-archive', + 'application/vnd.debian.binary-package',) default_type = 'deb' @@ -670,6 +673,8 @@ class IvyJar(JavaJar): default_primary_language = 'Java' # FIXME: move to bower.py + + @attr.s() class BowerPackage(Package): metafiles = ('bower.json',) @@ -842,4 +847,4 @@ class SquashfsPackage(Package): default_type = 'squashfs' -# TODO: Add VM images formats(VMDK, OVA, OVF, VDI, etc) and Docker/other containers \ No newline at end of file +# TODO: Add VM images formats(VMDK, OVA, OVF, VDI, etc) and Docker/other containers diff --git a/src/fetchcode/utils.py b/src/fetchcode/utils.py index 1e5ab842..3116caca 100644 --- a/src/fetchcode/utils.py +++ b/src/fetchcode/utils.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -141,7 +141,8 @@ def github_response(graphql_query): headers = {"Authorization": f"bearer {gh_token}"} endpoint = "https://api.github.com/graphql" - response = requests.post(endpoint, headers=headers, json=graphql_query).json() + response = requests.post(endpoint, headers=headers, + json=graphql_query).json() message = response.get("message") if message and message == "Bad credentials": diff --git a/src/fetchcode/vcs/__init__.py b/src/fetchcode/vcs/__init__.py index db9cb4da..ef429ef5 100644 --- a/src/fetchcode/vcs/__init__.py +++ b/src/fetchcode/vcs/__init__.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org diff --git a/src/fetchcode/vcs/git.py b/src/fetchcode/vcs/git.py index 9d9c6cca..f602516c 100644 --- a/src/fetchcode/vcs/git.py +++ b/src/fetchcode/vcs/git.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org diff --git a/tests/data/package/dirlisting/regenerate_mock_data.py b/tests/data/package/dirlisting/regenerate_mock_data.py index a3161665..067b8308 100644 --- a/tests/data/package/dirlisting/regenerate_mock_data.py +++ b/tests/data/package/dirlisting/regenerate_mock_data.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -601,204 +601,204 @@ }, ], }, - { - "purl": "pkg:generic/e2fsprogs", - "sources": [ - { - "filename": "generic/e2fsprogs/index.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/", - }, - { - "filename": "generic/e2fsprogs/0.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.1/", - }, - { - "filename": "generic/e2fsprogs/1.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.10/", - }, - { - "filename": "generic/e2fsprogs/2.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.11/", - }, - { - "filename": "generic/e2fsprogs/3.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.12/", - }, - { - "filename": "generic/e2fsprogs/4.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.13/", - }, - { - "filename": "generic/e2fsprogs/5.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.2/", - }, - { - "filename": "generic/e2fsprogs/6.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.3/", - }, - { - "filename": "generic/e2fsprogs/7.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.4/", - }, - { - "filename": "generic/e2fsprogs/8.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.5/", - }, - { - "filename": "generic/e2fsprogs/9.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.6/", - }, - { - "filename": "generic/e2fsprogs/10.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.7/", - }, - { - "filename": "generic/e2fsprogs/11.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.8/", - }, - { - "filename": "generic/e2fsprogs/12.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.9/", - }, - { - "filename": "generic/e2fsprogs/13.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43/", - }, - { - "filename": "generic/e2fsprogs/14.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.1/", - }, - { - "filename": "generic/e2fsprogs/15.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.2/", - }, - { - "filename": "generic/e2fsprogs/16.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.3/", - }, - { - "filename": "generic/e2fsprogs/17.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.4/", - }, - { - "filename": "generic/e2fsprogs/18.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.5/", - }, - { - "filename": "generic/e2fsprogs/19.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.6/", - }, - { - "filename": "generic/e2fsprogs/20.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.7/", - }, - { - "filename": "generic/e2fsprogs/21.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.8/", - }, - { - "filename": "generic/e2fsprogs/22.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.9/", - }, - { - "filename": "generic/e2fsprogs/23.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.0/", - }, - { - "filename": "generic/e2fsprogs/24.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.1/", - }, - { - "filename": "generic/e2fsprogs/25.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.2/", - }, - { - "filename": "generic/e2fsprogs/26.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.3/", - }, - { - "filename": "generic/e2fsprogs/27.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.3-rc2/", - }, - { - "filename": "generic/e2fsprogs/28.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.4/", - }, - { - "filename": "generic/e2fsprogs/29.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.5/", - }, - { - "filename": "generic/e2fsprogs/30.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.6/", - }, - { - "filename": "generic/e2fsprogs/31.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.0/", - }, - { - "filename": "generic/e2fsprogs/32.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.1/", - }, - { - "filename": "generic/e2fsprogs/33.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.2/", - }, - { - "filename": "generic/e2fsprogs/34.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.3/", - }, - { - "filename": "generic/e2fsprogs/35.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.4/", - }, - { - "filename": "generic/e2fsprogs/36.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.5/", - }, - { - "filename": "generic/e2fsprogs/37.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.6/", - }, - { - "filename": "generic/e2fsprogs/38.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.7/", - }, - { - "filename": "generic/e2fsprogs/39.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.0/", - }, - { - "filename": "generic/e2fsprogs/40.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.1/", - }, - { - "filename": "generic/e2fsprogs/41.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.2/", - }, - { - "filename": "generic/e2fsprogs/42.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.3/", - }, - { - "filename": "generic/e2fsprogs/43.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.4/", - }, - { - "filename": "generic/e2fsprogs/44.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.5/", - }, - { - "filename": "generic/e2fsprogs/45.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.6/", - }, - { - "filename": "generic/e2fsprogs/46.html", - "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.0/", - }, + { + "purl": "pkg:generic/e2fsprogs", + "sources": [ + { + "filename": "generic/e2fsprogs/index.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/", + }, + { + "filename": "generic/e2fsprogs/0.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.1/", + }, + { + "filename": "generic/e2fsprogs/1.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.10/", + }, + { + "filename": "generic/e2fsprogs/2.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.11/", + }, + { + "filename": "generic/e2fsprogs/3.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.12/", + }, + { + "filename": "generic/e2fsprogs/4.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.13/", + }, + { + "filename": "generic/e2fsprogs/5.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.2/", + }, + { + "filename": "generic/e2fsprogs/6.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.3/", + }, + { + "filename": "generic/e2fsprogs/7.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.4/", + }, + { + "filename": "generic/e2fsprogs/8.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.5/", + }, + { + "filename": "generic/e2fsprogs/9.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.6/", + }, + { + "filename": "generic/e2fsprogs/10.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.7/", + }, + { + "filename": "generic/e2fsprogs/11.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.8/", + }, + { + "filename": "generic/e2fsprogs/12.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.9/", + }, + { + "filename": "generic/e2fsprogs/13.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43/", + }, + { + "filename": "generic/e2fsprogs/14.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.1/", + }, + { + "filename": "generic/e2fsprogs/15.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.2/", + }, + { + "filename": "generic/e2fsprogs/16.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.3/", + }, + { + "filename": "generic/e2fsprogs/17.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.4/", + }, + { + "filename": "generic/e2fsprogs/18.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.5/", + }, + { + "filename": "generic/e2fsprogs/19.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.6/", + }, + { + "filename": "generic/e2fsprogs/20.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.7/", + }, + { + "filename": "generic/e2fsprogs/21.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.8/", + }, + { + "filename": "generic/e2fsprogs/22.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.9/", + }, + { + "filename": "generic/e2fsprogs/23.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.0/", + }, + { + "filename": "generic/e2fsprogs/24.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.1/", + }, + { + "filename": "generic/e2fsprogs/25.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.2/", + }, + { + "filename": "generic/e2fsprogs/26.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.3/", + }, + { + "filename": "generic/e2fsprogs/27.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.3-rc2/", + }, + { + "filename": "generic/e2fsprogs/28.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.4/", + }, + { + "filename": "generic/e2fsprogs/29.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.5/", + }, + { + "filename": "generic/e2fsprogs/30.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.44.6/", + }, + { + "filename": "generic/e2fsprogs/31.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.0/", + }, + { + "filename": "generic/e2fsprogs/32.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.1/", + }, + { + "filename": "generic/e2fsprogs/33.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.2/", + }, + { + "filename": "generic/e2fsprogs/34.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.3/", + }, + { + "filename": "generic/e2fsprogs/35.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.4/", + }, + { + "filename": "generic/e2fsprogs/36.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.5/", + }, + { + "filename": "generic/e2fsprogs/37.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.6/", + }, + { + "filename": "generic/e2fsprogs/38.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.7/", + }, + { + "filename": "generic/e2fsprogs/39.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.0/", + }, + { + "filename": "generic/e2fsprogs/40.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.1/", + }, + { + "filename": "generic/e2fsprogs/41.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.2/", + }, + { + "filename": "generic/e2fsprogs/42.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.3/", + }, + { + "filename": "generic/e2fsprogs/43.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.4/", + }, + { + "filename": "generic/e2fsprogs/44.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.5/", + }, + { + "filename": "generic/e2fsprogs/45.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.6/", + }, + { + "filename": "generic/e2fsprogs/46.html", + "url": "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.0/", + }, - ], -}, + ], + }, ] diff --git a/tests/data/package/github/regenerate_mock_data.py b/tests/data/package/github/regenerate_mock_data.py index 41467300..9a2b33ef 100644 --- a/tests/data/package/github/regenerate_mock_data.py +++ b/tests/data/package/github/regenerate_mock_data.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -41,7 +41,8 @@ def fetch_github_mock_data(owner, name, subdir): while True: response = github_response(graphql_query) refs = response["data"]["repository"]["refs"] - mock_data_file = data_location / f"{subdir}/github_mock_data_{file_count}.json" + mock_data_file = data_location / \ + f"{subdir}/github_mock_data_{file_count}.json" with open(mock_data_file, "w") as file: json.dump(response, file, indent=2) diff --git a/tests/data/package_versions/regenerate_mock_data.py b/tests/data/package_versions/regenerate_mock_data.py index 68ee76d2..9dbcaefb 100644 --- a/tests/data/package_versions/regenerate_mock_data.py +++ b/tests/data/package_versions/regenerate_mock_data.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -140,7 +140,8 @@ def fetch_golang_mock_data(): url = f"https://proxy.golang.org/github.com/blockloop/scan/@v/list" version_list = get_response(url=url, content_type="text") for version in version_list.split(): - file_name = data_location / f"golang/versions/golang_mock_{version}_data.json" + file_name = data_location / \ + f"golang/versions/golang_mock_{version}_data.json" response = get_response( url=f"https://proxy.golang.org/github.com/blockloop/scan/@v/{version}.info", content_type="json", @@ -168,7 +169,8 @@ def fetch_github_mock_data(): while True: response = github_response(graphql_query) refs = response["data"]["repository"]["refs"] - mock_data_file = data_location / f"github/github_mock_data_{file_count}.json" + mock_data_file = data_location / \ + f"github/github_mock_data_{file_count}.json" with open(mock_data_file, "w") as file: json.dump(response, file, indent=4) diff --git a/tests/test_fetch.py b/tests/test_fetch.py index 09b0bf4a..6366da36 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org diff --git a/tests/test_package.py b/tests/test_package.py index 68c93507..fa1f5ea8 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -120,7 +120,8 @@ def test_packages_github_source_avahi( test_data = [ "tests/data/package/github/avahi/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/avahi/github_mock_data_0.json" ) @@ -138,7 +139,8 @@ def test_packages_github_source_avahi( test_data = [ "tests/data/package/github/avahi/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/avahi/github_mock_data_0.json" ) @@ -156,7 +158,8 @@ def test_packages_github_source_bpftool( test_data = [ "tests/data/package/github/bpftool/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/bpftool/github_mock_data_0.json" ) @@ -174,7 +177,8 @@ def test_packages_github_source_brotli( test_data = [ "tests/data/package/github/brotli/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/brotli/github_mock_data_0.json" ) @@ -192,7 +196,8 @@ def test_packages_github_source_dosfstools( test_data = [ "tests/data/package/github/dosfstools/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/dosfstools/github_mock_data_0.json" ) @@ -210,7 +215,8 @@ def test_packages_github_source_genext2fs( test_data = [ "tests/data/package/github/genext2fs/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/genext2fs/github_mock_data_0.json" ) @@ -228,7 +234,8 @@ def test_packages_github_source_inotify_tools( test_data = [ "tests/data/package/github/inotify-tools/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/inotify-tools/github_mock_data_0.json" ) @@ -248,7 +255,8 @@ def test_packages_github_source_llvm_project( "tests/data/package/github/llvm-project/github_mock_data_2.json", "tests/data/package/github/llvm-project/github_mock_data_3.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/llvm-project/github_mock_data_0.json" ) @@ -266,7 +274,8 @@ def test_packages_github_source_miniupnpc( test_data = [ "tests/data/package/github/miniupnp/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/miniupnp/github_mock_data_0.json" ) @@ -284,7 +293,8 @@ def test_packages_github_source_miniupnpd( test_data = [ "tests/data/package/github/miniupnp/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/miniupnp/github_mock_data_0.json" ) @@ -302,7 +312,8 @@ def test_packages_github_source_minissdpd( test_data = [ "tests/data/package/github/miniupnp/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/miniupnp/github_mock_data_0.json" ) @@ -319,7 +330,8 @@ def test_packages_github_source_nix(self, mock_github_response, mock_get_respons "tests/data/package/github/nix/github_mock_data_1.json", "tests/data/package/github/nix/github_mock_data_2.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/nix/github_mock_data_0.json" ) @@ -337,7 +349,8 @@ def test_packages_github_source_pupnp( test_data = [ "tests/data/package/github/pupnp/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/pupnp/github_mock_data_0.json" ) @@ -360,7 +373,8 @@ def test_packages_github_source_cpython( "tests/data/package/github/cpython/github_mock_data_5.json", "tests/data/package/github/cpython/github_mock_data_6.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/cpython/github_mock_data_0.json" ) @@ -377,7 +391,8 @@ def test_packages_github_source_rpm(self, mock_github_response, mock_get_respons "tests/data/package/github/rpm/github_mock_data_1.json", "tests/data/package/github/rpm/github_mock_data_2.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/rpm/github_mock_data_0.json" ) @@ -395,7 +410,8 @@ def test_packages_github_source_shadow( test_data = [ "tests/data/package/github/shadow/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/shadow/github_mock_data_0.json" ) @@ -414,7 +430,8 @@ def test_packages_github_source_sqlite( "tests/data/package/github/sqlite/github_mock_data_1.json", "tests/data/package/github/sqlite/github_mock_data_2.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/sqlite/github_mock_data_0.json" ) @@ -432,7 +449,8 @@ def test_packages_github_source_squashfs_tools( test_data = [ "tests/data/package/github/squashfs-tools/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/squashfs-tools/github_mock_data_0.json" ) @@ -450,7 +468,8 @@ def test_packages_github_source_wireless_tools( test_data = [ "tests/data/package/github/wireless-tools/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/wireless-tools/github_mock_data_0.json" ) @@ -472,7 +491,8 @@ def test_packages_github_source_uboot( "tests/data/package/github/u-boot/github_mock_data_4.json", "tests/data/package/github/u-boot/github_mock_data_5.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/u-boot/github_mock_data_0.json" ) @@ -490,7 +510,8 @@ def test_packages_github_source_erofs_utils( test_data = [ "tests/data/package/github/erofs-utils/github_mock_data_1.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/erofs-utils/github_mock_data_0.json" ) @@ -511,7 +532,8 @@ def test_packages_github_source_openssl( "tests/data/package/github/openssl/github_mock_data_3.json", "tests/data/package/github/openssl/github_mock_data_4.json", ] - mock_github_response.side_effect = [file_json(file) for file in test_data] + mock_github_response.side_effect = [ + file_json(file) for file in test_data] mock_get_response.return_value = file_json( "tests/data/package/github/openssl/github_mock_data_0.json" ) diff --git a/tests/test_package_versions.py b/tests/test_package_versions.py index 1b5ad8d4..6c17c7b3 100644 --- a/tests/test_package_versions.py +++ b/tests/test_package_versions.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -23,7 +23,8 @@ from fetchcode.package_versions import versions -FETCHCODE_REGEN_TEST_FIXTURES = os.getenv("FETCHCODE_REGEN_TEST_FIXTURES", False) +FETCHCODE_REGEN_TEST_FIXTURES = os.getenv( + "FETCHCODE_REGEN_TEST_FIXTURES", False) data_location = Path(__file__).parent / "data" / "package_versions" @@ -190,7 +191,8 @@ def test_get_golang_versions_from_purl(mock_get_response): for version in version_list.split(): side_effect.append( get_json_data( - data_location / f"golang/versions/golang_mock_{version}_data.json" + data_location / + f"golang/versions/golang_mock_{version}_data.json" ) ) diff --git a/tests/test_vcs.py b/tests/test_vcs.py index 869bf800..9c22b0f8 100644 --- a/tests/test_vcs.py +++ b/tests/test_vcs.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -25,32 +25,56 @@ def obtain(dest, url): pass + @pytest.mark.parametrize( "url, vcs_type, domain", [ - pytest.param("git+http://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_http"), - pytest.param("git://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git"), - pytest.param("git+https://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_https"), - pytest.param("git+ssh://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_ssh"), - pytest.param("git+file://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_file"), - pytest.param("git+git://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_git"), - pytest.param("bzr+http://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_http"), - pytest.param("bzr+https://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_https"), - pytest.param("bzr://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr"), - pytest.param("bzr+ssh://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_ssh"), - pytest.param("bzr+ftp://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_ftp"), - pytest.param("bzr+sftp://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_sftp"), - pytest.param("bzr+lp://gitlab.com/jamesor/mongoose-versioner", "bzr", "gitlab.com", id="bzr_lp"), - pytest.param("hg://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg"), - pytest.param("hg+file://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg_file"), - pytest.param("hg+http://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg_http"), - pytest.param("hg+https://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg_https"), - pytest.param("hg+ssh://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg_ssh"), - pytest.param("hg+static-http://bitbucket.com/jamesor/mongoose-versioner", "hg", "bitbucket.com", id="hg_static_http"), - pytest.param("svn://bitbucket.com/jamesor/mongoose-versioner", "svn", "bitbucket.com", id="svn"), - pytest.param("svn+http://bitbucket.com/jamesor/mongoose-versioner", "svn", "bitbucket.com", id="svn_http"), - pytest.param("svn+https://bitbucket.com/jamesor/mongoose-versioner", "svn", "bitbucket.com", id="svn_https"), - pytest.param("svn+svn://bitbucket.com/jamesor/mongoose-versioner", "svn", "bitbucket.com", id="svn_svn") + pytest.param("git+http://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_http"), + pytest.param("git://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git"), + pytest.param("git+https://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_https"), + pytest.param("git+ssh://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_ssh"), + pytest.param("git+file://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_file"), + pytest.param("git+git://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_git"), + pytest.param("bzr+http://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_http"), + pytest.param("bzr+https://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_https"), + pytest.param("bzr://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr"), + pytest.param("bzr+ssh://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_ssh"), + pytest.param("bzr+ftp://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_ftp"), + pytest.param("bzr+sftp://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_sftp"), + pytest.param("bzr+lp://gitlab.com/jamesor/mongoose-versioner", + "bzr", "gitlab.com", id="bzr_lp"), + pytest.param("hg://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg"), + pytest.param("hg+file://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg_file"), + pytest.param("hg+http://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg_http"), + pytest.param("hg+https://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg_https"), + pytest.param("hg+ssh://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg_ssh"), + pytest.param("hg+static-http://bitbucket.com/jamesor/mongoose-versioner", + "hg", "bitbucket.com", id="hg_static_http"), + pytest.param("svn://bitbucket.com/jamesor/mongoose-versioner", + "svn", "bitbucket.com", id="svn"), + pytest.param("svn+http://bitbucket.com/jamesor/mongoose-versioner", + "svn", "bitbucket.com", id="svn_http"), + pytest.param("svn+https://bitbucket.com/jamesor/mongoose-versioner", + "svn", "bitbucket.com", id="svn_https"), + pytest.param("svn+svn://bitbucket.com/jamesor/mongoose-versioner", + "svn", "bitbucket.com", id="svn_svn") ], ) @mock.patch("fetchcode.vcs.vcs.get_backend_for_scheme") @@ -60,6 +84,7 @@ def test_fetch_via_vcs_returns_response(mock_backend, url, vcs_type, domain): assert response.vcs_type == vcs_type assert response.domain == domain + def test_fetch_with_invalid_scheme(): invalid_urls = [ "https://github.com/TG1999/fetchcode", diff --git a/tests/test_vcs_git.py b/tests/test_vcs_git.py index 3972b768..8434abf4 100644 --- a/tests/test_vcs_git.py +++ b/tests/test_vcs_git.py @@ -1,5 +1,5 @@ # fetchcode is a free software tool from nexB Inc. and others. -# Visit https://github.com/nexB/fetchcode for support and download. +# Visit https://github.com/aboutcode-org/fetchcode for support and download. # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and http://aboutcode.org @@ -28,12 +28,18 @@ def obtain(dest, url): @pytest.mark.parametrize( "url, vcs_type, domain", [ - pytest.param("git+http://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_http"), - pytest.param("git://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git"), - pytest.param("git+https://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_https"), - pytest.param("git+ssh://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_ssh"), - pytest.param("git+file://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_file"), - pytest.param("git+git://github.com/jamesor/mongoose-versioner", "git", "github.com", id="git_git") + pytest.param("git+http://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_http"), + pytest.param("git://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git"), + pytest.param("git+https://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_https"), + pytest.param("git+ssh://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_ssh"), + pytest.param("git+file://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_file"), + pytest.param("git+git://github.com/jamesor/mongoose-versioner", + "git", "github.com", id="git_git") ], ) @mock.patch("fetchcode.vcs.git.vcs.get_backend") @@ -43,6 +49,7 @@ def test_fetch_via_vcs_returns_response(mock_backend, url, vcs_type, domain): assert response.vcs_type == vcs_type assert response.domain == domain + def test_fetch_with_git_invalid_scheme(): invalid_urls = [ "https://github.com/TG1999/fetchcode",