Kaydet (Commit) b18c2e5e authored tarafından Eray Özkural's avatar Eray Özkural

* fixx0r #570: do not store destdir option as relative path

* short option -N for --no-color
üst 9a18e4bf
......@@ -64,7 +64,7 @@ class Command(object):
(self.options, self.args) = self.parser.parse_args()
self.args.pop(0) # exclude command arg
self.check_auth_info()
self.process_opts()
def commonopts(self):
'''common options'''
......@@ -85,7 +85,7 @@ class Command(object):
p.add_option("-n", "--dry-run", action="store_true", default=False,
help = _("do not perform any action, just show what\
would be done"))
p.add_option("", "--no-color", action="store_true", default=False,
p.add_option("-N", "--no-color", action="store_true", default=False,
help = _("print like a man"))
return p
......@@ -94,6 +94,18 @@ class Command(object):
options function it will be called"""
pass
def process_opts(self):
self.check_auth_info()
# make destdir absolute
if self.options.destdir:
dir = str(self.options.destdir)
import os.path
if not os.path.exists(dir):
raise Exception, _('Destination directory %s does not exist') % dir
self.options.destdir = os.path.realpath(dir)
def check_auth_info(self):
username = self.options.username
password = self.options.password
......
......@@ -47,9 +47,13 @@ class Config(object):
def dest_dir(self):
dir = self.get_option('destdir')
if dir:
return str(dir)
dir = str(dir)
else:
return self.values.general.destinationdirectory
dir = self.values.general.destinationdirectory
import os.path
if not os.path.exists(dir):
raise Exception, _('Destination directory %s does not exist') % dir
return dir
def lib_dir(self):
return join(self.dest_dir(), self.values.dirs.lib_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment