Debian Codegraph @

ansible_collections/community/general/noxfile.py

raw
1 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
2 # SPDX-License-Identifier: GPL-3.0-or-later
3 # SPDX-FileCopyrightText: 2025 Felix Fontein <[email protected]>
4
5 # /// script
6 # dependencies = ["nox>=2025.02.09", "antsibull-nox"]
7 # ///
8
9 import os
10 import sys
11
12 import nox # type: ignore[import-not-found]
13
14 # Whether the noxfile is running in CI:
15 IN_CI = os.environ.get("CI") == "true"
16
17
18 try:
19 import antsibull_nox # type: ignore[import-not-found]
20 except ImportError:
21 print("You need to install antsibull-nox in the same Python environment as nox.")
22 sys.exit(1)
23
24
25 antsibull_nox.load_antsibull_nox_toml()
26
27
28 @nox.session(name="aliases", python=False, default=True)
29 def aliases(session: nox.Session) -> None:
30 session.run("python", "tests/sanity/extra/aliases.py")
31
32
33 @nox.session(name="botmeta", default=True)
34 def botmeta(session: nox.Session) -> None:
35 session.install("PyYAML", "voluptuous")
36 session.run("python", "tests/sanity/extra/botmeta.py")
37
38
39 @nox.session(name="ansible-output", default=False)
40 def ansible_output(session: nox.Session) -> None:
41 session.install(
42 "ansible-core",
43 "antsibull-docs",
44 # Needed libs for some code blocks:
45 "jc",
46 "hashids",
47 # Tools for post-processing
48 "ruamel.yaml", # used by docs/docsite/reformat-yaml.py
49 )
50 args = []
51 if IN_CI:
52 args.append("--check")
53 session.run("antsibull-docs", "ansible-output", *args, *session.posargs)
54
55
56 # Allow to run the noxfile with `python noxfile.py`, `pipx run noxfile.py`, or similar.
57 # Requires nox >= 2025.02.09
58 if __name__ == "__main__":
59 nox.main()