mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
Compare commits
2 Commits
148d978468
...
06653f815b
Author | SHA1 | Date | |
---|---|---|---|
06653f815b | |||
6738f9206d |
@ -72,7 +72,7 @@ package_ahriman-triggers() {
|
||||
package_ahriman-web() {
|
||||
pkgname='ahriman-web'
|
||||
pkgdesc="ArcH linux ReposItory MANager, web server"
|
||||
depends=("$pkgbase-core=$pkgver" 'python-aiohttp-cors' 'python-aiohttp-jinja2' 'python-marshmallow')
|
||||
depends=("$pkgbase-core=$pkgver" 'python-aiohttp-cors' 'python-aiohttp-jinja2')
|
||||
optdepends=('python-aioauth-client: OAuth2 authorization support'
|
||||
'python-aiohttp-apispec>=3.0.0: autogenerated API documentation'
|
||||
'python-aiohttp-security: authorization support'
|
||||
|
@ -21,7 +21,6 @@ import configparser
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from typing import Any, Self
|
||||
|
||||
@ -68,7 +67,6 @@ class Configuration(configparser.RawConfigParser):
|
||||
_LEGACY_ARCHITECTURE_SPECIFIC_SECTIONS = ["web"]
|
||||
ARCHITECTURE_SPECIFIC_SECTIONS = ["alpm", "build", "sign"]
|
||||
SYSTEM_CONFIGURATION_PATH = Path(sys.prefix) / "share" / "ahriman" / "settings" / "ahriman.ini"
|
||||
converters: dict[str, Callable[[str], Any]] # typing guard
|
||||
|
||||
def __init__(self, allow_no_value: bool = False, allow_multi_key: bool = True) -> None:
|
||||
"""
|
||||
|
@ -19,5 +19,14 @@
|
||||
#
|
||||
try:
|
||||
import aiohttp_apispec # type: ignore[import-untyped]
|
||||
|
||||
from marshmallow import Schema, fields
|
||||
except ImportError:
|
||||
from unittest.mock import Mock
|
||||
|
||||
Schema = object # type: ignore[assignment,misc]
|
||||
aiohttp_apispec = None
|
||||
fields = Mock()
|
||||
|
||||
|
||||
__all__ = ["Schema", "aiohttp_apispec", "fields"]
|
||||
|
@ -17,11 +17,10 @@
|
||||
# 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 marshmallow import Schema
|
||||
from typing import Any, Callable
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.apispec import aiohttp_apispec
|
||||
from ahriman.web.apispec import Schema, aiohttp_apispec
|
||||
from ahriman.web.schemas import AuthSchema, ErrorSchema
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class AURPackageSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class AuthSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class BuildOptionsSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class ChangesSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class CountersSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class DependenciesSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class ErrorSchema(Schema):
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman.models.event import EventType
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class EventSchema(Schema):
|
||||
|
@ -17,9 +17,9 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.models.event import EventType
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.pagination_schema import PaginationSchema
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class FileSchema(Schema):
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
|
||||
|
||||
|
@ -17,9 +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 marshmallow import fields
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.counters_schema import CountersSchema
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
from ahriman.web.schemas.status_schema import StatusSchema
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class LogSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class LoginSchema(Schema):
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
from ahriman.web.schemas.status_schema import StatusSchema
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class OAuth2Schema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class PackageNameSchema(Schema):
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.build_options_schema import BuildOptionsSchema
|
||||
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.package_names_schema import PackageNamesSchema
|
||||
from ahriman.web.schemas.patch_schema import PatchSchema
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class PackagePropertiesSchema(Schema):
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
from ahriman.web.schemas.package_properties_schema import PackagePropertiesSchema
|
||||
from ahriman.web.schemas.remote_schema import RemoteSchema
|
||||
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
from ahriman.web.schemas.package_schema import PackageSchema
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
from ahriman.web.schemas.status_schema import StatusSchema
|
||||
|
@ -17,9 +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 marshmallow import fields
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.package_name_schema import PackageNameSchema
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class PatchSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class PGPKeyIdSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class PGPKeySchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class ProcessIdSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class ProcessSchema(Schema):
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman.models.package_source import PackageSource
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class RemoteSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class RepositoryIdSchema(Schema):
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class SearchSchema(Schema):
|
||||
|
@ -17,9 +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 marshmallow import Schema, fields
|
||||
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class StatusSchema(Schema):
|
||||
|
@ -17,8 +17,7 @@
|
||||
# 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 marshmallow import fields
|
||||
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.build_options_schema import BuildOptionsSchema
|
||||
|
||||
|
||||
|
@ -17,9 +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 marshmallow import fields
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.web.apispec import fields
|
||||
from ahriman.web.schemas.log_schema import LogSchema
|
||||
from ahriman.web.schemas.repository_id_schema import RepositoryIdSchema
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
# 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 marshmallow import Schema, fields
|
||||
from ahriman.web.apispec import Schema, fields
|
||||
|
||||
|
||||
class WorkerSchema(Schema):
|
||||
|
@ -18,4 +18,7 @@ def test_import_apispec_missing(mocker: MockerFixture) -> None:
|
||||
"""
|
||||
mocker.patch.dict(sys.modules, {"aiohttp_apispec": None})
|
||||
importlib.reload(apispec)
|
||||
|
||||
assert apispec.aiohttp_apispec is None
|
||||
assert apispec.Schema is object
|
||||
assert apispec.fields("arg", kwargs=42)
|
||||
|
Loading…
Reference in New Issue
Block a user