mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-11 02:25:32 +03:00
Merge branch 'master' into fix-gitlab-branch
This commit is contained in:
commit
c3194df384
@ -11,7 +11,6 @@ designed to work with nixpkgs but also other package sets.
|
||||
- Gitea
|
||||
- GitHub
|
||||
- GitLab
|
||||
- NotABug.org
|
||||
- PyPi
|
||||
- RubyGems.org
|
||||
- Sourcehut
|
||||
|
@ -323,7 +323,7 @@ def update_version(
|
||||
elif package.parsed_url.netloc == "github.com":
|
||||
_, owner, repo, *_ = package.parsed_url.path.split("/")
|
||||
package.diff_url = f"https://github.com/{owner}/{repo.removesuffix('.git')}/compare/{package.rev}...{new_version.rev or new_version.number}"
|
||||
elif package.parsed_url.netloc in ["codeberg.org", "gitea.com", "notabug.org"]:
|
||||
elif package.parsed_url.netloc in ["codeberg.org", "gitea.com"]:
|
||||
_, owner, repo, *_ = package.parsed_url.path.split("/")
|
||||
package.diff_url = f"https://{package.parsed_url.netloc}/{owner}/{repo}/compare/{package.rev}...{new_version.rev or new_version.number}"
|
||||
elif GITLAB_API.match(package.parsed_url.geturl()) and package.src_homepage:
|
||||
|
@ -133,5 +133,5 @@ def fetch_latest_version(
|
||||
)
|
||||
|
||||
raise VersionError(
|
||||
"Please specify the version. We can only get the latest version from codeberg/crates.io/gitea/github/gitlab/notabug/pypi/savannah/sourcehut/rubygems projects right now"
|
||||
"Please specify the version. We can only get the latest version from codeberg/crates.io/gitea/github/gitlab/pypi/savannah/sourcehut/rubygems projects right now"
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
import json
|
||||
import re
|
||||
from urllib.parse import ParseResult
|
||||
from urllib.request import urlopen
|
||||
|
||||
@ -6,10 +7,11 @@ from .version import Version
|
||||
|
||||
|
||||
def fetch_gitea_versions(url: ParseResult) -> list[Version]:
|
||||
if url.netloc not in ["codeberg.org", "gitea.com", "notabug.org"]:
|
||||
if url.netloc not in ["codeberg.org", "gitea.com"]:
|
||||
return []
|
||||
|
||||
_, owner, repo, *_ = url.path.split("/")
|
||||
repo = re.sub(r"\.git$", "", repo)
|
||||
tags_url = f"https://{url.netloc}/api/v1/repos/{owner}/{repo}/tags"
|
||||
resp = urlopen(tags_url)
|
||||
tags = json.loads(resp.read())
|
||||
@ -17,11 +19,12 @@ def fetch_gitea_versions(url: ParseResult) -> list[Version]:
|
||||
|
||||
|
||||
def fetch_gitea_snapshots(url: ParseResult, branch: str) -> list[Version]:
|
||||
if url.netloc not in ["codeberg.org", "gitea.com", "notabug.org"]:
|
||||
if url.netloc not in ["codeberg.org", "gitea.com"]:
|
||||
return []
|
||||
|
||||
_, owner, repo, *_ = url.path.split("/")
|
||||
commits_url = f"https://{url.netloc}/api/v1/repos/{owner}/{repo}/commits?sha={branch}&limit=1stat=false"
|
||||
repo = re.sub(r"\.git$", "", repo)
|
||||
commits_url = f"https://{url.netloc}/api/v1/repos/{owner}/{repo}/commits?sha={branch}&limit=1&stat=false&verification=false&files=false"
|
||||
resp = urlopen(commits_url)
|
||||
commits = json.loads(resp.read())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user