euscan-ng/euscanwww/djeuscan/management/commands/scan_metadata.py
volpino 779ccdf5d3 euscanwww: use logging in djeuscan.processing
Signed-off-by: volpino <fox91@anche.no>
2012-06-22 11:31:15 +02:00

38 lines
973 B
Python

import sys
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from djeuscan.processing import set_verbosity_level
from djeuscan.processing.scan_metadata import scan_metadata
logger = logging.getLogger(__name__)
class Command(BaseCommand):
_overlays = {}
option_list = BaseCommand.option_list + (
make_option('--all',
action='store_true',
dest='all',
default=False,
help='Scan all packages'),
)
args = '<package package ...>'
help = 'Scans metadata and fills database'
def handle(self, *args, **options):
set_verbosity_level(logger, options.get("verbosity", 1))
if options['all']:
packages = None
elif len(args):
packages = [pkg for pkg in args]
else:
packages = [pkg[:-1] for pkg in sys.stdin.readlines()]
scan_metadata(packages=packages, logger=logger)