diff --git a/euscanwww/djeuscan/processing/scan/scan_portage.py b/euscanwww/djeuscan/processing/scan/scan_portage.py
index 306595b..b00c416 100644
--- a/euscanwww/djeuscan/processing/scan/scan_portage.py
+++ b/euscanwww/djeuscan/processing/scan/scan_portage.py
@@ -8,14 +8,12 @@ from xml.etree.ElementTree import iterparse, ParseError
from django.db.transaction import commit_on_success
from django.core.management.color import color_style
-from euscan.helpers import get_version_type
+from euscan.version import get_version_type
from djeuscan.processing import FakeLogger
from djeuscan.models import Package, Version, VersionLog
-
-PORTDB = portage.db[portage.root]["porttree"].dbapi
-
+PORTDB = None
class ScanPortage(object):
def __init__(self, logger=None, no_log=False, purge_packages=False,
@@ -25,6 +23,10 @@ class ScanPortage(object):
self.purge_packages = purge_packages
self.purge_versions = purge_versions
+ if not PORTDB: # Lazy loading for portdb
+ global PORTDB
+ PORTDB = portage.db[portage.root]["porttree"].dbapi
+
self.style = color_style()
self._cache = {'packages': {}, 'versions': {}}
diff --git a/euscanwww/djeuscan/templates/euscan/_categories_table.html b/euscanwww/djeuscan/templates/euscan/_categories_table.html
index cd4ad30..891826f 100644
--- a/euscanwww/djeuscan/templates/euscan/_categories_table.html
+++ b/euscanwww/djeuscan/templates/euscan/_categories_table.html
@@ -1,5 +1,5 @@
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
diff --git a/euscanwww/djeuscan/templates/euscan/_herds_table.html b/euscanwww/djeuscan/templates/euscan/_herds_table.html
index 622c9de..f7e5b54 100644
--- a/euscanwww/djeuscan/templates/euscan/_herds_table.html
+++ b/euscanwww/djeuscan/templates/euscan/_herds_table.html
@@ -1,5 +1,5 @@
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
diff --git a/euscanwww/djeuscan/templates/euscan/_maintainers_table.html b/euscanwww/djeuscan/templates/euscan/_maintainers_table.html
index ffbd536..ebd1748 100644
--- a/euscanwww/djeuscan/templates/euscan/_maintainers_table.html
+++ b/euscanwww/djeuscan/templates/euscan/_maintainers_table.html
@@ -1,5 +1,5 @@
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
diff --git a/euscanwww/djeuscan/templates/euscan/_package_cols.html b/euscanwww/djeuscan/templates/euscan/_package_cols.html
index 20995ce..540a8c1 100644
--- a/euscanwww/djeuscan/templates/euscan/_package_cols.html
+++ b/euscanwww/djeuscan/templates/euscan/_package_cols.html
@@ -1,4 +1,4 @@
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load mul %}
{% load sub %}
{% load div %}
diff --git a/euscanwww/djeuscan/templates/euscan/_packages.html b/euscanwww/djeuscan/templates/euscan/_packages.html
index 0ccfdb0..f14072b 100644
--- a/euscanwww/djeuscan/templates/euscan/_packages.html
+++ b/euscanwww/djeuscan/templates/euscan/_packages.html
@@ -1,8 +1,8 @@
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load sub %}
{% load div %}
{% load mul %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
diff --git a/euscanwww/djeuscan/templates/euscan/accounts/categories.html b/euscanwww/djeuscan/templates/euscan/accounts/categories.html
index 3b1b6d4..0caa1a6 100644
--- a/euscanwww/djeuscan/templates/euscan/accounts/categories.html
+++ b/euscanwww/djeuscan/templates/euscan/accounts/categories.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - Watched categories
diff --git a/euscanwww/djeuscan/templates/euscan/accounts/herds.html b/euscanwww/djeuscan/templates/euscan/accounts/herds.html
index f34d364..b9d3f50 100644
--- a/euscanwww/djeuscan/templates/euscan/accounts/herds.html
+++ b/euscanwww/djeuscan/templates/euscan/accounts/herds.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - Watched herds
diff --git a/euscanwww/djeuscan/templates/euscan/accounts/maintainers.html b/euscanwww/djeuscan/templates/euscan/accounts/maintainers.html
index 8bce022..cc8eefe 100644
--- a/euscanwww/djeuscan/templates/euscan/accounts/maintainers.html
+++ b/euscanwww/djeuscan/templates/euscan/accounts/maintainers.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - Watched maintainers
diff --git a/euscanwww/djeuscan/templates/euscan/accounts/overlays.html b/euscanwww/djeuscan/templates/euscan/accounts/overlays.html
index 56dacad..946b61e 100644
--- a/euscanwww/djeuscan/templates/euscan/accounts/overlays.html
+++ b/euscanwww/djeuscan/templates/euscan/accounts/overlays.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/accounts/packages.html b/euscanwww/djeuscan/templates/euscan/accounts/packages.html
index c83d6cd..46e674b 100644
--- a/euscanwww/djeuscan/templates/euscan/accounts/packages.html
+++ b/euscanwww/djeuscan/templates/euscan/accounts/packages.html
@@ -1,7 +1,7 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - Watched packages
diff --git a/euscanwww/djeuscan/templates/euscan/categories.html b/euscanwww/djeuscan/templates/euscan/categories.html
index 8893b65..93a81f6 100644
--- a/euscanwww/djeuscan/templates/euscan/categories.html
+++ b/euscanwww/djeuscan/templates/euscan/categories.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/category.html b/euscanwww/djeuscan/templates/euscan/category.html
index 1f65253..f4f123c 100644
--- a/euscanwww/djeuscan/templates/euscan/category.html
+++ b/euscanwww/djeuscan/templates/euscan/category.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/herd.html b/euscanwww/djeuscan/templates/euscan/herd.html
index 9156d39..c940556 100644
--- a/euscanwww/djeuscan/templates/euscan/herd.html
+++ b/euscanwww/djeuscan/templates/euscan/herd.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/herds.html b/euscanwww/djeuscan/templates/euscan/herds.html
index 638010f..ff04497 100644
--- a/euscanwww/djeuscan/templates/euscan/herds.html
+++ b/euscanwww/djeuscan/templates/euscan/herds.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/maintainer.html b/euscanwww/djeuscan/templates/euscan/maintainer.html
index 828f6b8..a68f987 100644
--- a/euscanwww/djeuscan/templates/euscan/maintainer.html
+++ b/euscanwww/djeuscan/templates/euscan/maintainer.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/maintainers.html b/euscanwww/djeuscan/templates/euscan/maintainers.html
index 0c89c04..1514231 100644
--- a/euscanwww/djeuscan/templates/euscan/maintainers.html
+++ b/euscanwww/djeuscan/templates/euscan/maintainers.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/overlay.html b/euscanwww/djeuscan/templates/euscan/overlay.html
index 3de2687..21e6a3c 100644
--- a/euscanwww/djeuscan/templates/euscan/overlay.html
+++ b/euscanwww/djeuscan/templates/euscan/overlay.html
@@ -1,7 +1,7 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - Overlay: {{ overlay }}
diff --git a/euscanwww/djeuscan/templates/euscan/overlays.html b/euscanwww/djeuscan/templates/euscan/overlays.html
index 2fc8d4c..8bdafe4 100644
--- a/euscanwww/djeuscan/templates/euscan/overlays.html
+++ b/euscanwww/djeuscan/templates/euscan/overlays.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block title %}
diff --git a/euscanwww/djeuscan/templates/euscan/package.html b/euscanwww/djeuscan/templates/euscan/package.html
index 2f92163..97d1b55 100644
--- a/euscanwww/djeuscan/templates/euscan/package.html
+++ b/euscanwww/djeuscan/templates/euscan/package.html
@@ -1,7 +1,7 @@
{% extends "euscan/_datatable.html" %}
{% load sub %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% load url from future %}
{% block meta %}
diff --git a/euscanwww/djeuscan/templates/euscan/world_scan.html b/euscanwww/djeuscan/templates/euscan/world_scan.html
index 11ac23f..ca96488 100644
--- a/euscanwww/djeuscan/templates/euscan/world_scan.html
+++ b/euscanwww/djeuscan/templates/euscan/world_scan.html
@@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
-{% load euscan_tags %}
+{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - World Scan
diff --git a/euscanwww/djeuscan/templatetags/euscan_tags.py b/euscanwww/djeuscan/templatetags/djeuscan_helpers.py
similarity index 90%
rename from euscanwww/djeuscan/templatetags/euscan_tags.py
rename to euscanwww/djeuscan/templatetags/djeuscan_helpers.py
index 625ebb8..9689163 100644
--- a/euscanwww/djeuscan/templatetags/euscan_tags.py
+++ b/euscanwww/djeuscan/templatetags/djeuscan_helpers.py
@@ -1,11 +1,10 @@
from django import template
from django.conf import settings
-from euscan import helpers
+from euscan.version import is_version_type_stable, get_version_type
register = template.Library()
-
@register.inclusion_tag('euscan/_packages.html', takes_context=True)
def packages(context, pkgs):
context['packages'] = pkgs
@@ -61,9 +60,9 @@ def overlays_table(overlays):
@register.filter
def is_stable(version_type):
- return helpers.is_version_type_stable(version_type)
+ return is_version_type_stable(version_type)
@register.filter
def version_type(version):
- return helpers.get_version_type(version)
+ return get_version_type(version)
diff --git a/euscanwww/euscanwww/settings.py b/euscanwww/euscanwww/settings.py
index fc6b668..2397c10 100644
--- a/euscanwww/euscanwww/settings.py
+++ b/euscanwww/euscanwww/settings.py
@@ -239,6 +239,7 @@ CELERYD_CONCURRENCY = 4
TASKS_UPSTREAM_GROUPS = 32
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
+CELERYBEAT_SCHEDULE = {}
# LDAP authentication
# TODO: Test data - change me!
diff --git a/pym/euscan/helpers.py b/pym/euscan/helpers.py
index 0af9315..1e385cd 100644
--- a/pym/euscan/helpers.py
+++ b/pym/euscan/helpers.py
@@ -33,27 +33,6 @@ VERSION_CMP_PACKAGE_QUIRKS = {
_v_end = '((-|_)(pre|p|beta|b|alpha|a|rc|r)\d*)'
_v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(' + _v_end + '*))'
-
-def is_version_stable(version):
- return is_version_type_stable(get_version_type(version))
-
-
-def is_version_type_stable(version_type):
- return version_type not in ("alpha", "beta", "pre", "rc")
-
-
-def get_version_type(version):
- types = []
- gentoo_types = ("alpha", "beta", "pre", "rc", "p")
-
- for token in re.findall("[\._-]([a-zA-Z]+)", version):
- if token in gentoo_types:
- types.append(token)
- if types:
- return types[0] # TODO: consider returning all types
- return "release"
-
-
# Stolen from g-pypi
def gentoo_mangle_version(up_pv):
"""Convert PV to MY_PV if needed
diff --git a/pym/euscan/out.py b/pym/euscan/out.py
index 0717a4b..40374ab 100644
--- a/pym/euscan/out.py
+++ b/pym/euscan/out.py
@@ -170,7 +170,7 @@ class EuscanOutput(object):
raise TypeError("Invalid output format")
def result(self, cp, version, urls, handler, confidence):
- from euscan.helpers import get_version_type
+ from euscan.version import get_version_type
cpv = '%s-%s' % (cp, version)
urls = ' '.join(transform_url(self.config, cpv, url) for url in urls.split())
diff --git a/pym/euscan/scan.py b/pym/euscan/scan.py
index ded800a..55a3381 100644
--- a/pym/euscan/scan.py
+++ b/pym/euscan/scan.py
@@ -13,7 +13,8 @@ from gentoolkit.package import Package
from euscan import CONFIG, BLACKLIST_PACKAGES
from euscan import handlers, output
-from euscan.helpers import version_blacklisted, is_version_stable
+from euscan.helpers import version_blacklisted,
+from euscan.version import is_version_stable
from euscan.ebuild import package_from_ebuild
diff --git a/pym/euscan/version.py b/pym/euscan/version.py
index d836c7e..b2ebdfe 100644
--- a/pym/euscan/version.py
+++ b/pym/euscan/version.py
@@ -1,5 +1,22 @@
import re
+def is_version_type_stable(version_type):
+ return version_type not in ("alpha", "beta", "pre", "rc")
+
+def is_version_stable(version):
+ return is_version_type_stable(get_version_type(version))
+
+def get_version_type(version):
+ types = []
+ gentoo_types = ("alpha", "beta", "pre", "rc", "p")
+
+ for token in re.findall("[\._-]([a-zA-Z]+)", version):
+ if token in gentoo_types:
+ types.append(token)
+ if types:
+ return types[0] # TODO: consider returning all types
+ return "release"
+
# Stolen from pkg_resources, but importing it is not a good idea
component_re = re.compile(r'(\d+ | [a-z]+ | \.| -)', re.VERBOSE)