euscanwww: take args from stdin and update INSTALL

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
Corentin Chary
2012-03-02 14:08:28 +01:00
parent 329b20fecf
commit d6f3b6629c
4 changed files with 22 additions and 16 deletions

View File

@ -33,15 +33,15 @@ class Command(BaseCommand):
help = 'Scans metadata and fills database'
def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False:
raise CommandError('You must specify a package or use --all')
if len(args) == 0:
if options['all']:
for pkg in Package.objects.all():
self.scan(options, '%s/%s' % (pkg.category, pkg.name))
else:
elif len(args):
for package in args:
self.scan(options, package)
else:
for package in sys.stdin.readlines():
self.scan(options, package[:-1])
@commit_on_success
def scan(self, options, query=None):

View File

@ -36,21 +36,21 @@ class Command(BaseCommand):
default=False,
help='Be quiet'),
)
args = '<package package ...>'
args = '[package package ...]'
help = 'Scans portage tree and fills database'
def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False:
raise CommandError('You must specify a package or use --all')
if not options['quiet']:
self.stdout.write('Scanning portage tree...\n')
if len(args) == 0:
if options['all']:
self.scan(options)
else:
elif len(args):
for package in args:
self.scan(options, package)
else:
for package in sys.stdin.readlines():
self.scan(options, package[:-1])
if options['purge-versions']:
self.purge_versions(options)

View File

@ -42,9 +42,6 @@ class Command(BaseCommand):
help = 'Scans metadata and fills database'
def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False and options['feed'] == False:
raise CommandError('You must specify a package or use --all')
if options['feed']:
self.parse_output(options, sys.stdin)
if options['purge-versions']:
@ -56,11 +53,13 @@ class Command(BaseCommand):
packages = []
if len(args) == 0:
if options['all']:
for pkg in Package.objects.all():
packages.append('%s/%s' % (pkg.category, pkg.name))
else:
elif args:
packages = list(args)
else:
packages = [ package[:-1] for package in sys.stdin.readlines() ]
self.scan(options, packages)