Commit 77ad22b6 authored by Noé Gaumont's avatar Noé Gaumont 🐙
Browse files

revert: remove add_new_version

parent 7c923565e1db
Pipeline #73999 passed with stage
in 1 minute and 5 seconds
......@@ -4,7 +4,6 @@ import subprocess
from cube_doctor import EmptyCubeQueryResult
# from cube_doctor.transforms.add_new_version import AddNewVersion
from cube_doctor.transforms.add_tox import AddTox # noqa
from cube_doctor.transforms.add_pypi_publish import AddPypiPublish
from cube_doctor.transforms.add_deb_publish import AddDebPublish
......@@ -100,7 +99,6 @@ commands = {
"regenerate-gitlab-ci": RegenerateGitlabCI().workflow,
"run-script": RunScript().workflow,
"rebase-all-my-mrs": RebaseAllMyMRs().workflow,
# "add-new-version": AddNewVersion().workflow,
}
......
from tox.config import parseconfig
from cube_doctor import Command
NEW_VERSION = """
[testenv:new-version]
basepython = python3
skip_install = true
passenv = DEBEMAIL DEBFULLNAME
whitelist_externals =
sh
dch
commands =
sh -c "while [ -z $CONTINUE ]; do read -p 'Make a new version ? [y/n]: ' -r CONTINUE; done; \\
if [ $CONTINUE != 'y' ] && [ $CONTINUE != 'Y' ] ; \\
then \\
echo Exiting version creation ;\\
exit 1 ; \\
fi"
sh -c "if [ ! command -v dch &> /dev/null] ; \\
then \\
echo dch could not be found ; \\
exit 1 ; \\
fi"
sh -c "if [ -z $DEBEMAIL ] || [ -z $DEBFULLNAME ] ; \\
then \\
echo Define the env variable DEBEMAIL and DEBFULLNAME ;\\
exit 1 ; \\
fi"
sh -c "echo -c '\\n\\n\\n\\nPlease verify what should be committed'"
sh -c "VERSION=$(python3 setup.py --version) && \\
dch -v $VERSION'-'1 -D unstable 'New upstream release' && \\
hg commit -i -m '[pkg] version '$VERSION && \\
hg tag -r . $VERSION debian/$VERSION"
"""
class AddNewVersion(Command):
BRANCH_NAME = "topic/default/new-version"
commit_message = "chore(tox): add new-version"
TARGETS = ("cubes",)
base_query = "?project lgg:has_new_version false . " "?project lgg:has_tox true"
def pre_check(self, root_files):
if "tox.ini" not in root_files:
return "continue"
if "setup.py" not in root_files:
return "continue"
def modify_code(self, cube, repo, root_files, branches, other_args):
tox_ini_path = repo.path / "tox.ini"
tox = parseconfig(["-c", str(tox_ini_path)])
if "new-version" in tox.envconfigs:
return
tox_content = repo.read_file("tox.ini")
tox_content = tox_content.rstrip() + NEW_VERSION
repo.write_file("tox.ini", tox_content)
yield {"branch_name": self.BRANCH_NAME, "commit_message": self.commit_message}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment