Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Apr 1, 2024
1 parent cdfa818 commit f9ab495
Show file tree
Hide file tree
Showing 6 changed files with 10,783 additions and 12,176 deletions.
4 changes: 3 additions & 1 deletion src/fetchcode/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ class UtilLinuxDirectoryListedSource(DirectoryListedSource):
source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/"
is_nested = True
# Source archive ex: util-linux-1.2.3.tar.gz
source_archive_regex = re.compile(r"^(util-linux-)(?P<version>[\w.-]*)(.tar.gz)$")
source_archive_regex = re.compile(
r"^(util-linux-|util-linux-ng-)(?P<version>[\w.-]*)(.tar.gz)$"
)
ignored_files_and_dir = []


Expand Down
8 changes: 7 additions & 1 deletion src/fetchcode/package_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ def _get_github_packages(purl, version_regex, ignored_tag_regex, default_package
else:
version = tag

version = version.strip("Vv").strip().replace("_", ".")
version = version.strip("Vv").strip()
if "+" in version:
first, last = version.split("+")
first.replace("_", ".")
version = f"{first}+{last}"
else:
version = version.replace("_", ".")
if not version or not version[0].isdigit():
continue

Expand Down
5 changes: 4 additions & 1 deletion src/fetchcode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class GitHubTokenError(Exception):
class GraphQLError(Exception):
pass


def get_github_token():
gh_token = os.environ.get("GH_TOKEN", None)
if not gh_token:
Expand Down Expand Up @@ -152,9 +153,11 @@ def github_response(graphql_query):

return response


def get_github_rest(url):
headers = None
if gh_token := get_github_token():
gh_token = get_github_token()
if gh_token:
headers = {
"Authorization": f"Bearer {gh_token}",
}
Expand Down
Loading

0 comments on commit f9ab495

Please sign in to comment.