Handle missing/broken versions gracefully
Committed 990077
--- a/webint_code/__init__.py
+++ b/webint_code/__init__.py
)
)
)
- return [
- (
- version,
- web.application("webint_posts").model.read(
- f"code/projects/{project}/releases/{version}"
- )["resource"],
- )
- for version in versions
- ]
+ releases = []
+ for version in versions:
+ try:
+ releases.append(
+ (
+ version,
+ web.application("webint_posts").model.read(
+ f"code/projects/{project}/releases/{version}"
+ )["resource"],
+ )
+ )
+ except:
+ pass
+ return releases
def get_release(project, release):
"""Return a tuple containing files, log, previous release and next release."""
pypi_name = app.model.get_project_from_name(project)["pypi"].replace("-", "_")
- files = sorted(
- (code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
- )
+
+ if release == "HEAD":
+ files = []
+ else:
+ files = sorted(
+ (code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
+ )
package_releases = get_package_releases(project)
previous_release = None
break
next_release = package_release
repo = gmpg.get_repo(code_dir / project / "source.git")
- log = None
if previous_release:
log = repo.log(f"{previous_release}..{release}")
+ else:
+ log = repo.log()
return files, log, previous_release, next_release