diff --git a/build/management/commands/create_fake_buildrelease.py b/build/management/commands/create_fake_buildrelease.py index 59b6d38..968d5a3 100644 --- a/build/management/commands/create_fake_buildrelease.py +++ b/build/management/commands/create_fake_buildrelease.py @@ -18,7 +18,7 @@ from django.core.management.base import BaseCommand from django.core.management.base import CommandError from build.models import BuildRelease -from build.models.br import regex_mrXX +from build.models import regex_mrXX from build.utils import ReleaseConfig diff --git a/build/models/br.py b/build/models.py similarity index 98% rename from build/models/br.py rename to build/models.py index a31f2b8..4cb057f 100644 --- a/build/models/br.py +++ b/build/models.py @@ -21,10 +21,10 @@ from django.db.models import Q from django.forms.models import model_to_dict from django.utils import timezone -from ..conf import settings -from build.exceptions import BuildReleaseUnique -from build.utils import get_simple_release -from build.utils import ReleaseConfig +from .conf import settings +from .exceptions import BuildReleaseUnique +from .utils import get_simple_release +from .utils import ReleaseConfig from repoapi.models import JenkinsBuildInfo logger = structlog.get_logger(__name__) @@ -154,7 +154,7 @@ class BuildRelease(models.Model): def resume(self): if not self.done: - from build.tasks import build_resume + from .tasks import build_resume build_resume.delay(self.id) diff --git a/build/models/__init__.py b/build/models/__init__.py deleted file mode 100644 index f63e898..0000000 --- a/build/models/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017-2022 The Sipwise Team - http://sipwise.com -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -from .br import BuildRelease # noqa -from repoapi.models import JenkinsBuildInfo # noqa diff --git a/build/signals.py b/build/signals.py index 001f29a..a690108 100644 --- a/build/signals.py +++ b/build/signals.py @@ -20,10 +20,9 @@ from django.dispatch import receiver from django.utils import timezone from .conf import settings -from .models.br import BuildRelease -from build.tasks import build_release -from build.tasks import build_resume -from repoapi.models import JenkinsBuildInfo +from .models import BuildRelease +from .tasks import build_release +from .tasks import build_resume logger = structlog.get_logger(__name__) @@ -46,7 +45,11 @@ def br_manage(sender, **kwargs): logger.debug("BuildRelease:%s triggered", instance) -@receiver(post_save, sender=JenkinsBuildInfo, dispatch_uid="build_jbi_manage") +@receiver( + post_save, + sender="repoapi.JenkinsBuildInfo", + dispatch_uid="build_jbi_manage", +) def jbi_manage(sender, **kwargs): if not kwargs["created"]: return diff --git a/build/tasks.py b/build/tasks.py index 7d9522d..578df4d 100644 --- a/build/tasks.py +++ b/build/tasks.py @@ -16,9 +16,9 @@ import structlog from celery import shared_task from .conf import settings -from build.models.br import BuildRelease -from build.utils import trigger_build -from build.utils import trigger_copy_deps +from .models import BuildRelease +from .utils import trigger_build +from .utils import trigger_copy_deps from repoapi.celery import app logger = structlog.get_logger(__name__)