Skip to content

Commit

Permalink
Merge pull request #12 from nikromen/pkg-archive
Browse files Browse the repository at this point in the history
add get-pkg-archive command
  • Loading branch information
nikromen authored Mar 24, 2023
2 parents 5fafa47 + 62a9eea commit 47c44e8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy-requests.*]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion alpa.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: alpa
Version: 0.1.0
Version: 0.2.0
Release: 1%{?dist}
Summary: Integration tool with Alpa repository

Expand Down
20 changes: 20 additions & 0 deletions alpa/cli/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import click
import requests

from alpa_conf.metadata import Metadata

from alpa.cli.alpa_repo import create, delete, request_package
from alpa.cli.local_repo import (
Expand Down Expand Up @@ -29,6 +32,23 @@ def clone(url: str) -> None:
AlpaRepo.clone(url)


@entry_point.command("get-pkg-archive")
def get_pkg_archive() -> None:
"""Gets archive from package config"""
metadata = Metadata()
resp = requests.get(metadata.upstream_url, allow_redirects=True)
if not resp.ok:
raise ConnectionError(
f"Couldn't download source from {metadata.upstream_url}. "
f"Reason: {resp.reason}"
)

with open(
f"{metadata.package_name}-{metadata.upstream_version}.tar.gz", "wb"
) as archive:
archive.write(resp.content)


entry_point.add_command(create)
entry_point.add_command(delete)
entry_point.add_command(request_package)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyalpa"
version = "0.1.0"
version = "0.2.0"
description = "Integration tool with Alpa repository"
authors = ["Jiri Kyjovsky <[email protected]>"]
maintainers = ["Jiří Kyjovský <[email protected]>"]
Expand All @@ -18,7 +18,7 @@ click = ">=8.0.0"
gitpython = ">=3.0"
pygithub = ">=1.4"
pyyaml = ">=5.0"
alpa-conf = ">=0.1.0"
alpa-conf = ">=0.2.0"


[tool.poetry.dev-dependencies]
Expand Down

0 comments on commit 47c44e8

Please sign in to comment.