Skip to content
Snippets Groups Projects
Commit 8cd73c23 authored by Dylan Aïssi's avatar Dylan Aïssi
Browse files

Keep compatibility with python3.sh 1.x, by using _return_cmd only when required.


python3.sh 1.x is not compatible with _return_cmd, so we should only
use it with an higher version of python3.sh.

Signed-off-by: default avatarDylan Aïssi <dylan.aissi@collabora.com>
parent 68755409
No related branches found
No related tags found
4 merge requests!108Draft: v2026dev2: import-debian-package: stop using a PosixPath object as context manager,!106Draft: import-debian-package: stop using a PosixPath object as context manager,!104Fastforward v2026dev1 -> v2026dev2: Update for compatibility with Trixie,!94Update for compatibility with Trixie
This commit is part of merge request !94. Comments created here will be created in the context of that merge request.
......@@ -15,10 +15,12 @@ from pathlib import Path
from debian.changelog import Changelog, VersionError, format_date
from debian.debian_support import Version
from sh import __version__ as sh_version
from sh.contrib import git
APERTIS_CI_NAME = "Apertis CI"
APERTIS_CI_EMAIL = "devel@lists.apertis.org"
RETURN_CMD = {} if sh_version.startswith("1.") else {"_return_cmd": True}
def git_dir() -> str:
......@@ -176,7 +178,7 @@ def main():
"merge",
"--ff-only",
rebase_tip,
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 128],
_out="/dev/stdout",
_err="/dev/stderr",
......@@ -216,7 +218,7 @@ def main():
args.upstream,
":!debian/changelog",
":!debian/apertis/*",
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 1],
)
msg = [f"Sync from {args.upstream}."]
......
......@@ -16,9 +16,13 @@ import urllib.parse
import urllib.request
from functools import partial
from sh import ErrorReturnCode, ErrorReturnCode_2, apertis_pkg_merge_updates, echo
from sh import ErrorReturnCode, ErrorReturnCode_2
from sh import __version__ as sh_version
from sh import apertis_pkg_merge_updates, echo
from sh.contrib import git
RETURN_CMD = {} if sh_version.startswith("1.") else {"_return_cmd": True}
@dataclasses.dataclass
class Conflict:
......@@ -91,7 +95,7 @@ def is_minor_change(upstream, downstream):
downstream,
":!debian/changelog",
":!debian/apertis/*",
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 1],
)
return o.exit_code == 0
......@@ -357,7 +361,7 @@ def main():
"--is-ancestor",
upstream_branch,
downstream_branch,
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 1],
).exit_code
== 0
......@@ -440,7 +444,7 @@ def main():
"diff",
"--quiet",
f"HEAD..{downstream_branch}",
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 1],
)
if o.exit_code == 0:
......
......@@ -23,8 +23,11 @@ from itertools import chain
import yaml
from debian.changelog import Changelog
from debian.debian_support import Version
from sh import __version__ as sh_version
from sh.contrib import git
RETURN_CMD = {} if sh_version.startswith("1.") else {"_return_cmd": True}
def debian_branch(suite):
return "debian/" + suite
......@@ -60,7 +63,7 @@ def is_ancestor(this: str, other: str):
"--is-ancestor",
this,
other,
_return_cmd=True,
**RETURN_CMD,
_ok_code=[0, 1],
).exit_code
== 0
......@@ -441,7 +444,7 @@ def main():
"merge",
"--ff-only",
local_version_branch,
_return_cmd=True,
**RETURN_CMD,
_out="/dev/stdout",
_err="/dev/stderr",
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment