[eit.*] some code cleanup

This commit is contained in:
Fabio Erculiani
2011-10-17 22:28:30 +02:00
parent 86fdfbaba0
commit 905a01ea1f
11 changed files with 18 additions and 9 deletions

View File

@@ -28,6 +28,10 @@ class EitInit(EitCommand):
NAME = "init"
ALIASES = []
def __init__(self, args):
EitCommand.__init__(self, args)
self._ask = True
def _get_parser(self):
""" Overridden from EitInit """
descriptor = EitCommandDescriptor.obtain_descriptor(
@@ -40,7 +44,7 @@ class EitInit(EitCommand):
parser.add_argument("repo", nargs=1, default=None,
metavar="<repo>", help=_("repository"))
parser.add_argument("--quick", action="store_true",
default=False,
default=not self._ask,
help=_("no stupid questions"))
return parser
@@ -51,6 +55,7 @@ class EitInit(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._ask = not nsargs.quick

View File

@@ -64,6 +64,7 @@ class EitList(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._quiet = nsargs.quiet

View File

@@ -47,6 +47,7 @@ class EitLog(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
return self._call_locked, [self._log, nsargs.repo]

View File

@@ -54,6 +54,7 @@ class EitMv(EitCp):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._source = nsargs.source

View File

@@ -76,6 +76,7 @@ class EitPush(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._ask = not nsargs.quick

View File

@@ -277,7 +277,6 @@ class EitQuery(EitCommand):
sets = entropy_server.Sets()
match_num = 0
exit_st = 0
if not self._nsargs.sets:
self._nsargs.sets.append("*")
for item in self._nsargs.sets:

View File

@@ -10,7 +10,6 @@
"""
import sys
import os
import argparse
from entropy.i18n import _
@@ -49,6 +48,7 @@ class EitRepack(EitCommit):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
# setup atoms variable before spawning commit

View File

@@ -43,8 +43,9 @@ class EitRepo(EitCommand):
""" Overridden from EitCommand """
parser = self._get_parser()
try:
nsargs = parser.parse_args(self._args)
parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
return self._call_locked, [self._void, None]

View File

@@ -10,11 +10,10 @@
"""
import sys
import os
import argparse
from entropy.i18n import _
from entropy.output import darkgreen, teal
from entropy.output import darkgreen
from eit.commands.descriptor import EitCommandDescriptor
from eit.commands.push import EitPush
@@ -59,6 +58,7 @@ class EitReset(EitPush):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._local = nsargs.local

View File

@@ -53,6 +53,7 @@ class EitStatus(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
return self._call_locked, [self._status, nsargs.repo]
@@ -71,7 +72,6 @@ class EitStatus(EitCommand):
repo_data = repos_data[repo_id]
repo_rev = entropy_server.local_repository_revision(repo_id)
store_dir = entropy_server._get_local_store_directory(repo_id)
upload_basedir = entropy_server._get_local_upload_directory(repo_id)
upload_files, upload_packages = \
entropy_server.Mirrors._calculate_local_upload_files(repo_id)
key_sorter = lambda x: \

View File

@@ -10,11 +10,10 @@
"""
import sys
import os
import argparse
from entropy.i18n import _
from entropy.output import teal, purple
from entropy.output import purple
from eit.commands.descriptor import EitCommandDescriptor
from eit.commands.command import EitCommand
@@ -60,6 +59,7 @@ class EitVacuum(EitCommand):
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._ask = not nsargs.quick