mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-08-21 15:57:27 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2e013a33b |
@@ -1,3 +1,5 @@
|
||||
"""Shared pytest fixtures."""
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
+2
-2
@@ -68,8 +68,8 @@ COPY --chown=build . "/home/build/ahriman"
|
||||
## create package archive and install it
|
||||
RUN cd "/home/build/ahriman" && \
|
||||
tox -e archive && \
|
||||
cp ./dist/*.tar.gz "archlinux" && \
|
||||
cd "archlinux" && \
|
||||
cp ./dist/*.tar.gz "package/archlinux" && \
|
||||
cd "package/archlinux" && \
|
||||
runuser -u build -- makepkg --noconfirm --skipchecksums && \
|
||||
cd / && rm -r "/home/build/ahriman"
|
||||
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
ahriman.application.handlers package
|
||||
====================================
|
||||
|
||||
Subpackages
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
ahriman.application.handlers.triggers_support
|
||||
ahriman.application.handlers.web
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
@@ -277,6 +268,14 @@ ahriman.application.handlers.triggers module
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.handlers.triggers\_support module
|
||||
-----------------------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.triggers_support
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.handlers.unsafe\_commands module
|
||||
----------------------------------------------------
|
||||
|
||||
@@ -317,6 +316,14 @@ ahriman.application.handlers.versions module
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.handlers.web module
|
||||
---------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.web
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
ahriman.application.handlers.triggers\_support package
|
||||
======================================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
ahriman.application.handlers.triggers\_support.triggers\_support module
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.triggers_support.triggers_support
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.triggers_support
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,21 +0,0 @@
|
||||
ahriman.application.handlers.web package
|
||||
========================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
ahriman.application.handlers.web.web module
|
||||
-------------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.web.web
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.web
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
+17
-22
@@ -1,19 +1,19 @@
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --group pyproject.toml:docs --no-emit-package ahriman-core --no-emit-package ahriman-triggers --no-emit-package ahriman-web --output-file docs/requirements.txt pyproject.toml
|
||||
# uv pip compile --group pyproject.toml:docs --extra s3 --extra validator --extra web --output-file docs/requirements.txt pyproject.toml
|
||||
aiohappyeyeballs==2.6.1
|
||||
# via aiohttp
|
||||
aiohttp==3.11.18
|
||||
# via
|
||||
# ahriman-web
|
||||
# ahriman (pyproject.toml)
|
||||
# aiohttp-cors
|
||||
# aiohttp-jinja2
|
||||
# aiohttp-sse
|
||||
aiohttp-cors==0.8.1
|
||||
# via ahriman-web
|
||||
# via ahriman (pyproject.toml)
|
||||
aiohttp-jinja2==1.6
|
||||
# via ahriman-web
|
||||
# via ahriman (pyproject.toml)
|
||||
aiohttp-sse==2.2.0
|
||||
# via ahriman-web
|
||||
# via ahriman (pyproject.toml)
|
||||
aiosignal==1.3.2
|
||||
# via aiohttp
|
||||
alabaster==1.0.0
|
||||
@@ -25,15 +25,15 @@ attrs==25.3.0
|
||||
babel==2.17.0
|
||||
# via sphinx
|
||||
bcrypt==4.3.0
|
||||
# via ahriman-core
|
||||
boto3==1.43.47
|
||||
# via ahriman-core
|
||||
botocore==1.43.47
|
||||
# via ahriman (pyproject.toml)
|
||||
boto3==1.38.11
|
||||
# via ahriman (pyproject.toml)
|
||||
botocore==1.38.11
|
||||
# via
|
||||
# boto3
|
||||
# s3transfer
|
||||
cerberus==1.3.8
|
||||
# via ahriman-core
|
||||
cerberus==1.3.7
|
||||
# via ahriman (pyproject.toml)
|
||||
certifi==2025.4.26
|
||||
# via requests
|
||||
charset-normalizer==3.4.2
|
||||
@@ -44,7 +44,7 @@ docutils==0.21.2
|
||||
# sphinx-argparse
|
||||
# sphinx-rtd-theme
|
||||
filelock==3.24.0
|
||||
# via ahriman-core
|
||||
# via ahriman (pyproject.toml)
|
||||
frozenlist==1.6.0
|
||||
# via
|
||||
# aiohttp
|
||||
@@ -56,12 +56,12 @@ idna==3.10
|
||||
imagesize==1.4.1
|
||||
# via sphinx
|
||||
inflection==0.5.1
|
||||
# via ahriman-core
|
||||
# via ahriman (pyproject.toml)
|
||||
jinja2==3.1.6
|
||||
# via
|
||||
# aiohttp-jinja2
|
||||
# sphinx
|
||||
jmespath==1.1.0
|
||||
jmespath==1.0.1
|
||||
# via
|
||||
# boto3
|
||||
# botocore
|
||||
@@ -80,18 +80,18 @@ propcache==0.3.1
|
||||
pydeps==3.0.1
|
||||
# via ahriman (pyproject.toml:docs)
|
||||
pyelftools==0.32
|
||||
# via ahriman-core
|
||||
# via ahriman (pyproject.toml)
|
||||
pygments==2.19.1
|
||||
# via sphinx
|
||||
python-dateutil==2.9.0.post0
|
||||
# via botocore
|
||||
requests==2.32.3
|
||||
# via
|
||||
# ahriman-core
|
||||
# ahriman (pyproject.toml)
|
||||
# sphinx
|
||||
roman-numerals-py==3.1.0
|
||||
# via sphinx
|
||||
s3transfer==0.19.1
|
||||
s3transfer==0.12.0
|
||||
# via boto3
|
||||
shtab==1.7.2
|
||||
# via ahriman (pyproject.toml:docs)
|
||||
@@ -131,8 +131,3 @@ urllib3==2.4.0
|
||||
# requests
|
||||
yarl==1.20.0
|
||||
# via aiohttp
|
||||
|
||||
# The following packages were excluded from the output:
|
||||
# ahriman-core
|
||||
# ahriman-triggers
|
||||
# ahriman-web
|
||||
|
||||
@@ -36,7 +36,6 @@ check = [
|
||||
"pylint",
|
||||
]
|
||||
docs = [
|
||||
"ahriman-core[s3,validator]",
|
||||
"Sphinx",
|
||||
"argparse-manpage",
|
||||
"pydeps",
|
||||
@@ -82,15 +81,3 @@ workspace.members = [
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "ahriman-core/src/ahriman/__init__.py"
|
||||
|
||||
[tool.uv.sources]
|
||||
ahriman-core = {workspace = true}
|
||||
ahriman-triggers = {workspace = true}
|
||||
ahriman-web = {workspace = true}
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = [
|
||||
"ahriman-core",
|
||||
"ahriman-triggers",
|
||||
"ahriman-web",
|
||||
]
|
||||
|
||||
@@ -91,6 +91,7 @@ deps = [
|
||||
{ replace = "ref", of = ["project", "extras"], extend = true },
|
||||
]
|
||||
pip_pre = true
|
||||
skip_install = true
|
||||
set_env.CFLAGS = "-Wno-unterminated-string-initialization"
|
||||
set_env.MYPYPATH = "ahriman-core/src:ahriman-triggers/src:ahriman-web/src"
|
||||
commands = [
|
||||
@@ -159,8 +160,9 @@ deps = [
|
||||
{ replace = "ref", of = ["project", "extras"], extend = true },
|
||||
"uv",
|
||||
]
|
||||
dynamic_version = "{[project]name}"
|
||||
dynamic_version = "{[project]name}.__version__"
|
||||
pip_pre = true
|
||||
set_env.PYTHONPATH = "ahriman-core/src:ahriman-triggers/src:ahriman-web/src"
|
||||
set_env.SPHINX_APIDOC_OPTIONS = "members,no-undoc-members,show-inheritance"
|
||||
commands = [
|
||||
[
|
||||
@@ -188,14 +190,16 @@ commands = [
|
||||
"--dot-output", "{tox_root}/docs/_static/architecture.dot",
|
||||
"--no-output",
|
||||
"--show-dot",
|
||||
"{envsitepackagesdir}/{[project]name}",
|
||||
"ahriman-core/src/ahriman",
|
||||
],
|
||||
[
|
||||
"sphinx-apidoc",
|
||||
"--force",
|
||||
"--no-toc",
|
||||
"--output-dir", "docs",
|
||||
"{envsitepackagesdir}/{[project]name}",
|
||||
"ahriman-core/src",
|
||||
"ahriman-triggers/src",
|
||||
"ahriman-web/src",
|
||||
],
|
||||
# compile list of dependencies for rtd.io
|
||||
[
|
||||
@@ -203,9 +207,9 @@ commands = [
|
||||
"pip",
|
||||
"compile",
|
||||
"--group", "pyproject.toml:docs",
|
||||
"--no-emit-package", "ahriman-core",
|
||||
"--no-emit-package", "ahriman-triggers",
|
||||
"--no-emit-package", "ahriman-web",
|
||||
"--extra", "s3",
|
||||
"--extra", "validator",
|
||||
"--extra", "web",
|
||||
"--output-file", "docs/requirements.txt",
|
||||
"--quiet",
|
||||
"pyproject.toml",
|
||||
@@ -242,7 +246,7 @@ commands = [
|
||||
"sphinx-build",
|
||||
"--builder", "html",
|
||||
"--fail-on-warning",
|
||||
"--jobs", "1",
|
||||
"--jobs", "auto",
|
||||
"--write-all",
|
||||
"docs",
|
||||
"{envtmpdir}/html",
|
||||
@@ -264,9 +268,9 @@ commands = [
|
||||
[
|
||||
"git",
|
||||
"add",
|
||||
"archlinux/PKGBUILD",
|
||||
"docs/_static/architecture.dot",
|
||||
"frontend/package.json",
|
||||
"package/archlinux/PKGBUILD",
|
||||
"ahriman-core/package/share/man/man1/ahriman.1",
|
||||
"ahriman-core/package/share/bash-completion/completions/_ahriman",
|
||||
"ahriman-core/package/share/zsh/site-functions/_ahriman",
|
||||
@@ -323,7 +327,6 @@ allowlist_externals = [
|
||||
deps = [
|
||||
"packaging",
|
||||
]
|
||||
skip_install = true
|
||||
commands = [
|
||||
# check if version is set and validate it
|
||||
[
|
||||
@@ -346,6 +349,6 @@ commands = [
|
||||
"sed",
|
||||
"--in-place",
|
||||
"s/pkgver=.*/pkgver={posargs}/",
|
||||
"archlinux/PKGBUILD",
|
||||
"package/archlinux/PKGBUILD",
|
||||
],
|
||||
]
|
||||
|
||||
+23
-20
@@ -17,7 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from importlib.metadata import Distribution, PackageNotFoundError
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
from tox.config.sets import EnvConfigSet
|
||||
from tox.plugin import impl
|
||||
@@ -25,34 +26,32 @@ from tox.session.state import State
|
||||
from tox.tox_env.api import ToxEnv
|
||||
|
||||
|
||||
def _extract_version(tox_env: ToxEnv) -> dict[str, str]:
|
||||
def _extract_version(env_conf: EnvConfigSet, python_path: str | None = None) -> dict[str, str]:
|
||||
"""
|
||||
extract version dynamically and set VERSION environment variable
|
||||
|
||||
Args:
|
||||
tox_env(ToxEnv): tox environment containing the installed package
|
||||
env_conf(EnvConfigSet): the core configuration object
|
||||
python_path(str | None): python path variable if available
|
||||
|
||||
Returns:
|
||||
dict[str, str]: environment variables which must be inserted
|
||||
|
||||
Raises:
|
||||
PackageNotFoundError: no installed distribution has been found
|
||||
"""
|
||||
distribution = tox_env.conf["dynamic_version"]
|
||||
if not distribution:
|
||||
import_path = env_conf["dynamic_version"]
|
||||
if not import_path:
|
||||
return {}
|
||||
|
||||
installed = next(
|
||||
(
|
||||
package for package in Distribution.discover(path=[str(tox_env.env_site_package_dir())])
|
||||
if package.name == distribution
|
||||
),
|
||||
None,
|
||||
)
|
||||
if installed is None:
|
||||
raise PackageNotFoundError(distribution)
|
||||
if python_path is not None:
|
||||
sys.path.append(python_path)
|
||||
|
||||
return {"VERSION": installed.version}
|
||||
module_name, variable_name = import_path.rsplit(".", maxsplit=1)
|
||||
module = importlib.import_module(module_name)
|
||||
version = getattr(module, variable_name)
|
||||
|
||||
# reset import paths
|
||||
sys.path.pop()
|
||||
|
||||
return {"VERSION": version}
|
||||
|
||||
|
||||
@impl
|
||||
@@ -71,7 +70,7 @@ def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None:
|
||||
keys=["dynamic_version"],
|
||||
of_type=str,
|
||||
default="",
|
||||
desc="distribution name used to populate the VERSION environment variable",
|
||||
desc="import path for the version variable",
|
||||
)
|
||||
|
||||
|
||||
@@ -83,4 +82,8 @@ def tox_before_run_commands(tox_env: ToxEnv) -> None:
|
||||
Args:
|
||||
tox_env(ToxEnv): the tox environment being executed
|
||||
"""
|
||||
tox_env.conf["set_env"].update(_extract_version(tox_env))
|
||||
env_conf = tox_env.conf
|
||||
set_env = env_conf["set_env"]
|
||||
|
||||
python_path = set_env.load("PYTHONPATH") if "PYTHONPATH" in set_env else None
|
||||
set_env.update(_extract_version(env_conf, python_path))
|
||||
|
||||
Reference in New Issue
Block a user