mirror of
https://github.com/saltstack/salt.git
synced 2025-04-15 17:20:19 +00:00
Removed all remaining invoke
support
Fixes #64374 Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
eeaa88b4e9
commit
effd3da06f
11 changed files with 12 additions and 307 deletions
|
@ -129,6 +129,16 @@ repos:
|
|||
- salt-loaders
|
||||
- check-virtual
|
||||
|
||||
- id: tools
|
||||
alias: check-filemap
|
||||
name: Check Filename Map Change Matching
|
||||
files: ^tests/(filename_map\.yml|.*\.py)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- pre-commit
|
||||
- filemap
|
||||
- check
|
||||
|
||||
# ----- Packaging Requirements ------------------------------------------------------------------------------------>
|
||||
|
||||
- repo: https://github.com/saltstack/pip-tools-compile-impersonate
|
||||
|
@ -1039,56 +1049,6 @@ repos:
|
|||
- requirements/static/ci/changelog.in
|
||||
# <---- Changelog --------------------------------------------------------------------------------------------------
|
||||
|
||||
# ----- Invoke ---------------------------------------------------------------------------------------------------->
|
||||
- id: pip-tools-compile
|
||||
alias: compile-ci-invoke-3.7-requirements
|
||||
name: Linux CI Py3.7 Invoke Requirements
|
||||
files: ^requirements/static/ci/(invoke\.in|py3.7/(invoke|linux)\.txt)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- -v
|
||||
- --build-isolation
|
||||
- --py-version=3.7
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
alias: compile-ci-invoke-3.8-requirements
|
||||
name: Linux CI Py3.8 Invoke Requirements
|
||||
files: ^requirements/static/ci/(invoke\.in|py3.8/(invoke|linux)\.txt)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- -v
|
||||
- --build-isolation
|
||||
- --py-version=3.8
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
alias: compile-ci-invoke-3.9-requirements
|
||||
name: Linux CI Py3.9 Invoke Requirements
|
||||
files: ^requirements/static/ci/(invoke\.in|py3.9/(invoke|linux)\.txt)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- -v
|
||||
- --build-isolation
|
||||
- --py-version=3.9
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
alias: compile-ci-invoke-3.10-requirements
|
||||
name: Linux CI Py3.10 Invoke Requirements
|
||||
files: ^requirements/static/ci/(invoke\.in|py3.10/(invoke|linux)\.txt)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- -v
|
||||
- --build-isolation
|
||||
- --py-version=3.10
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
# <---- Invoke -----------------------------------------------------------------------------------------------------
|
||||
|
||||
# ----- Tools ---------------------------------------------------------------------------------------------------->
|
||||
- id: pip-tools-compile
|
||||
alias: compile-ci-tools-3.9-requirements
|
||||
|
@ -1242,50 +1202,6 @@ repos:
|
|||
# <---- Security ---------------------------------------------------------------------------------------------------
|
||||
|
||||
# ----- Pre-Commit ------------------------------------------------------------------------------------------------>
|
||||
- repo: https://github.com/saltstack/invoke-pre-commit
|
||||
rev: v1.9.0
|
||||
hooks:
|
||||
- id: invoke
|
||||
alias: check-filemap
|
||||
name: Check Filename Map Change Matching
|
||||
files: ^tests/(filename_map\.yml|.*\.py)$
|
||||
pass_filenames: false
|
||||
args:
|
||||
- filemap.check
|
||||
additional_dependencies:
|
||||
- blessings==1.7
|
||||
- pyyaml==6.0.1
|
||||
- distro==1.7.0
|
||||
- jinja2==3.0.3
|
||||
- msgpack==1.0.3
|
||||
- packaging
|
||||
- looseversion
|
||||
|
||||
- repo: https://github.com/saltstack/invoke-pre-commit
|
||||
rev: v1.9.0
|
||||
hooks:
|
||||
- id: invoke
|
||||
alias: check-known-missing-docstrings
|
||||
name: Check Known Missing Docstrings
|
||||
stages: [manual]
|
||||
files: salt/.*\.py$
|
||||
exclude: >
|
||||
(?x)^(
|
||||
templates/.*|
|
||||
salt/ext/.*|
|
||||
)$
|
||||
args:
|
||||
- docstrings.check
|
||||
- --error-on-known-failures
|
||||
additional_dependencies:
|
||||
- blessings==1.7
|
||||
- pyyaml==6.0.1
|
||||
- distro==1.7.0
|
||||
- jinja2==3.0.3
|
||||
- msgpack==1.0.3
|
||||
- packaging
|
||||
- looseversion
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.3.0
|
||||
hooks:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Migrated some [`invoke`](https://www.pyinvoke.org/) tasks to [`python-tools-scripts`](https://github.com/s0undt3ch/python-tools-scripts).
|
||||
Migrated all [`invoke`](https://www.pyinvoke.org/) tasks to [`python-tools-scripts`](https://github.com/s0undt3ch/python-tools-scripts).
|
||||
|
||||
* `tasks/docs.py` -> `tools/precommit/docs.py`
|
||||
* `tasks/docstrings.py` -> `tools/precommit/docstrings.py`
|
||||
|
|
33
noxfile.py
33
noxfile.py
|
@ -1536,7 +1536,7 @@ def lint_salt(session):
|
|||
paths = session.posargs
|
||||
else:
|
||||
# TBD replace paths entries when implement pyproject.toml
|
||||
paths = ["setup.py", "noxfile.py", "salt/", "tasks/"]
|
||||
paths = ["setup.py", "noxfile.py", "salt/"]
|
||||
_lint(session, ".pylintrc", flags, paths)
|
||||
|
||||
|
||||
|
@ -1648,37 +1648,6 @@ def docs_man(session, compress, update, clean):
|
|||
os.chdir("..")
|
||||
|
||||
|
||||
@nox.session(name="invoke", python="3")
|
||||
def invoke(session):
|
||||
"""
|
||||
Run invoke tasks
|
||||
"""
|
||||
if _upgrade_pip_setuptools_and_wheel(session):
|
||||
_install_requirements(session)
|
||||
requirements_file = os.path.join(
|
||||
"requirements", "static", "ci", _get_pydir(session), "invoke.txt"
|
||||
)
|
||||
install_command = ["--progress-bar=off", "-r", requirements_file]
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
cmd = ["inv"]
|
||||
files = []
|
||||
|
||||
# Unfortunately, invoke doesn't support the nargs functionality like argpase does.
|
||||
# Let's make it behave properly
|
||||
for idx, posarg in enumerate(session.posargs):
|
||||
if idx == 0:
|
||||
cmd.append(posarg)
|
||||
continue
|
||||
if posarg.startswith("--"):
|
||||
cmd.append(posarg)
|
||||
continue
|
||||
files.append(posarg)
|
||||
if files:
|
||||
cmd.append("--files={}".format(" ".join(files)))
|
||||
session.run(*cmd)
|
||||
|
||||
|
||||
@nox.session(name="changelog", python="3")
|
||||
@nox.parametrize("draft", [False, True])
|
||||
@nox.parametrize("force", [False, True])
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
--constraint=./py{py_version}/{platform}.txt
|
||||
|
||||
invoke
|
||||
blessings
|
||||
pyyaml
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
invoke==1.4.1
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
pyyaml==6.0.1
|
||||
# via
|
||||
# -c requirements/static/ci/py3.10/linux.txt
|
||||
# -r requirements/static/ci/invoke.in
|
||||
six==1.16.0
|
||||
# via
|
||||
# -c requirements/static/ci/py3.10/linux.txt
|
||||
# blessings
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.7/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
invoke==1.4.1
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
pyyaml==6.0.1
|
||||
# via
|
||||
# -c requirements/static/ci/py3.7/linux.txt
|
||||
# -r requirements/static/ci/invoke.in
|
||||
six==1.16.0
|
||||
# via
|
||||
# -c requirements/static/ci/py3.7/linux.txt
|
||||
# blessings
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
invoke==1.4.1
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
pyyaml==6.0.1
|
||||
# via
|
||||
# -c requirements/static/ci/py3.8/linux.txt
|
||||
# -r requirements/static/ci/invoke.in
|
||||
six==1.16.0
|
||||
# via
|
||||
# -c requirements/static/ci/py3.8/linux.txt
|
||||
# blessings
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
invoke==1.4.1
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
pyyaml==6.0.1
|
||||
# via
|
||||
# -c requirements/static/ci/py3.9/linux.txt
|
||||
# -r requirements/static/ci/invoke.in
|
||||
six==1.16.0
|
||||
# via
|
||||
# -c requirements/static/ci/py3.9/linux.txt
|
||||
# blessings
|
|
@ -1,28 +0,0 @@
|
|||
# What is this directory?
|
||||
|
||||
This directory contains python scripts which should be called by [invoke](https://pypi.org/project/invoke).
|
||||
|
||||
Instead of having several multi-purpose python scripts scatered through multiple paths in the salt code base,
|
||||
we will now concentrate them under an invoke task.
|
||||
|
||||
## Calling Invoke
|
||||
|
||||
Invoke can be called in the following ways.
|
||||
|
||||
### Installed system-wide
|
||||
|
||||
If invoke is installed system-wide, be sure you also have `blessings` installed if you want coloured output, although
|
||||
it's not a hard requirement.
|
||||
|
||||
```
|
||||
inv docs.check
|
||||
```
|
||||
|
||||
### Using Nox
|
||||
|
||||
Since salt already uses nox, and nox manages virtual environments and respective requirements, calling invoke is as
|
||||
simple as:
|
||||
|
||||
```
|
||||
nox -e invoke -- docs.check
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
from invoke import Collection # pylint: disable=3rd-party-module-not-gated
|
||||
|
||||
from . import docs, docstrings, filemap, loader
|
||||
|
||||
ns = Collection()
|
||||
ns.add_collection(Collection.from_module(docs, name="docs"), name="docs")
|
||||
ns.add_collection(
|
||||
Collection.from_module(docstrings, name="docstrings"), name="docstrings"
|
||||
)
|
||||
ns.add_collection(Collection.from_module(loader, name="loader"), name="loader")
|
||||
ns.add_collection(Collection.from_module(filemap, name="filemap"), name="filemap")
|
|
@ -1,64 +0,0 @@
|
|||
"""
|
||||
tasks.utils
|
||||
~~~~~~~~~~~
|
||||
|
||||
Invoke utilities
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from blessings import Terminal
|
||||
|
||||
try:
|
||||
terminal = Terminal()
|
||||
HAS_BLESSINGS = True
|
||||
except Exception: # pylint: disable=broad-except
|
||||
terminal = None
|
||||
HAS_BLESSINGS = False
|
||||
except ImportError:
|
||||
terminal = None
|
||||
HAS_BLESSINGS = False
|
||||
|
||||
|
||||
def exit_invoke(exitcode, message=None, *args, **kwargs):
|
||||
if message is not None:
|
||||
if exitcode > 0:
|
||||
warn(message, *args, **kwargs)
|
||||
else:
|
||||
info(message, *args, **kwargs)
|
||||
sys.exit(exitcode)
|
||||
|
||||
|
||||
def info(message, *args, **kwargs):
|
||||
if not isinstance(message, str):
|
||||
message = str(message)
|
||||
message = message.format(*args, **kwargs)
|
||||
if terminal:
|
||||
message = terminal.bold(terminal.green(message))
|
||||
write_message(message)
|
||||
|
||||
|
||||
def warn(message, *args, **kwargs):
|
||||
if not isinstance(message, str):
|
||||
message = str(message)
|
||||
message = message.format(*args, **kwargs)
|
||||
if terminal:
|
||||
message = terminal.bold(terminal.yellow(message))
|
||||
write_message(message)
|
||||
|
||||
|
||||
def error(message, *args, **kwargs):
|
||||
if not isinstance(message, str):
|
||||
message = str(message)
|
||||
message = message.format(*args, **kwargs)
|
||||
if terminal:
|
||||
message = terminal.bold(terminal.red(message))
|
||||
write_message(message)
|
||||
|
||||
|
||||
def write_message(message):
|
||||
sys.stderr.write(message)
|
||||
if not message.endswith("\n"):
|
||||
sys.stderr.write("\n")
|
||||
sys.stderr.flush()
|
Loading…
Add table
Reference in a new issue