new copr-Makefile: use pygit2 from Fedora repos

Installing pygit2 with pip presents problems when there is no compiled
wheel available on PyPI.
This commit is contained in:
Maxwell G 2024-03-02 18:54:11 +00:00
commit 65d85e1efd
Signed by: gotmax23
GPG key ID: F79E4E25E8C661F8
2 changed files with 22 additions and 13 deletions

View file

@ -1,10 +1,11 @@
# Copyright (C) 2023 Maxwell G <maxwell@gtmx.me>
# SPDX-License-Identifier: MIT
# Copyright (C) 2024 Maxwell G <maxwell@gtmx.me>
# SPDX-License-Identifier: GPL-1.0-or-later
outdir ::= results_forge-srpm-macros
srpm:
command -v pipx || $(sudo) dnf install -y pipx
command -v git || $(sudo) dnf install -y git-core
pipx run nox -e srpm -- -o $(outdir)
command -v pip || $(SUDO) dnf install -y python3-pip
command -v fclogr || $(SUDO) dnf install -y python3-pygit2
command -v fclogr || pip install --user fclogr
command -v nox || $(SUDO) dnf install -y nox
python3 -m nox --no-venv -e srpm -- -o $(outdir)

View file

@ -18,6 +18,14 @@ nox.options.sessions = (*LINT_SESSIONS, "test")
# Helpers
def install(session: nox.Session, *args, **kwargs):
# nox --no-venv
if isinstance(session.virtualenv, nox.virtualenv.PassthroughEnv):
session.warn(f"No venv. Skipping installation of {args}")
return
session.install(*args, **kwargs)
def git(session: nox.Session, *args, **kwargs):
return session.run("git", *args, **kwargs, external=True)
@ -36,7 +44,7 @@ def lint(session: nox.Session):
@nox.session
def static(session: nox.Session):
session.install("ruff", "reuse", "yamllint")
install(session, "ruff", "reuse", "yamllint")
session.run("ruff", *session.posargs, *PY_FILES)
session.run("yamllint", *YAML_FILES)
session.run("reuse", "lint")
@ -46,7 +54,7 @@ def static(session: nox.Session):
def formatters(session: nox.Session, posargs: Sequence[str] | None = None):
if posargs is None:
posargs = session.posargs
session.install("black", "isort")
install(session, "black", "isort")
session.run("black", *posargs, *PY_FILES)
session.run("isort", *posargs, *PY_FILES)
@ -58,21 +66,21 @@ def formatters_check(session: nox.Session):
@nox.session
def typing(session: nox.Session):
session.install("mypy", "nox", "pytest", "pyyaml", "types-pyyaml")
install(session, "mypy", "nox", "pytest", "pyyaml", "types-pyyaml")
session.run("mypy", *session.posargs, *PY_FILES)
@nox.session
def test(session: nox.Session):
session.install("pytest", "pyyaml")
install(session, "pytest", "pyyaml")
session.run("pytest", *session.posargs)
@nox.session
def srpm(session: nox.Session, posargs: Sequence[str] | None = None):
session.install("fclogr")
install(session, "fclogr")
posargs = posargs or session.posargs
session.run("fclogr", "--debug", "dev-srpm", *posargs)
session.run("python3", "-m", "fclogr", "--debug", "dev-srpm", *posargs)
@nox.session
@ -96,7 +104,7 @@ def mockbuild(session: nox.Session):
@nox.session
def bump(session: nox.Session):
version = session.posargs[0]
session.install(RELEASERR, "fclogr")
install(session, RELEASERR, "fclogr")
session.run("releaserr", "check-tag", version)
session.run(
"fclogr", "bump", "--new", version, "--comment", f"Update to {version}."