2011-04-13 19:00:31 +02:00
|
|
|
import sys
|
|
|
|
from optparse import make_option
|
|
|
|
|
2012-05-28 21:16:38 +02:00
|
|
|
from django.core.management.base import BaseCommand
|
2012-03-14 14:07:06 +01:00
|
|
|
|
2012-06-22 09:32:39 +02:00
|
|
|
from djeuscan.processing.scan_metadata import scan_metadata
|
2012-05-28 21:16:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
_overlays = {}
|
|
|
|
|
|
|
|
option_list = BaseCommand.option_list + (
|
|
|
|
make_option('--all',
|
|
|
|
action='store_true',
|
|
|
|
dest='all',
|
|
|
|
default=False,
|
|
|
|
help='Scan all packages'),
|
|
|
|
make_option('--quiet',
|
|
|
|
action='store_true',
|
|
|
|
dest='quiet',
|
|
|
|
default=False,
|
|
|
|
help='Be quiet'),
|
|
|
|
)
|
|
|
|
args = '<package package ...>'
|
|
|
|
help = 'Scans metadata and fills database'
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
if options['all']:
|
2012-06-22 09:32:39 +02:00
|
|
|
packages = None
|
|
|
|
|
|
|
|
elif len(args):
|
|
|
|
packages = [pkg for pkg in args]
|
2012-05-28 21:16:38 +02:00
|
|
|
else:
|
2012-06-22 09:32:39 +02:00
|
|
|
packages = [pkg[:-1] for pkg in sys.stdin.readlines()]
|
|
|
|
|
|
|
|
scan_metadata(packages=packages, quiet=options["quiet"])
|