1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00

commandline.py: fix "More than one statement on a single line"

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf 2013-05-27 13:38:49 +02:00
parent c261a80d46
commit 42b8d5ff45

View File

@ -145,14 +145,16 @@ class Osc(cmdln.Cmdln):
conf.write_initial_config(e.file, config) conf.write_initial_config(e.file, config)
print('done', file=sys.stderr) print('done', file=sys.stderr)
if try_again: self.postoptparse(try_again = False) if try_again:
self.postoptparse(try_again = False)
except oscerr.ConfigMissingApiurl as e: except oscerr.ConfigMissingApiurl as e:
print(e.msg, file=sys.stderr) print(e.msg, file=sys.stderr)
import getpass import getpass
user = raw_input('Username: ') user = raw_input('Username: ')
passwd = getpass.getpass() passwd = getpass.getpass()
conf.add_section(e.file, e.url, user, passwd) conf.add_section(e.file, e.url, user, passwd)
if try_again: self.postoptparse(try_again = False) if try_again:
self.postoptparse(try_again = False)
self.options.verbose = conf.config['verbose'] self.options.verbose = conf.config['verbose']
self.download_progress = None self.download_progress = None
@ -173,8 +175,10 @@ class Osc(cmdln.Cmdln):
localdir = os.getcwd() localdir = os.getcwd()
except Exception as e: except Exception as e:
## check for Stale NFS file handle: '.' ## check for Stale NFS file handle: '.'
try: os.stat('.') try:
except Exception as ee: e = ee os.stat('.')
except Exception as ee:
e = ee
print("os.getcwd() failed: ", e, file=sys.stderr) print("os.getcwd() failed: ", e, file=sys.stderr)
sys.exit(1) sys.exit(1)
@ -295,7 +299,8 @@ class Osc(cmdln.Cmdln):
pass pass
if len(args) > 0: if len(args) > 0:
project = args[0] project = args[0]
if project == '/': project = None if project == '/':
project = None
if project == '.': if project == '.':
cwd = os.getcwd() cwd = os.getcwd()
if is_project_dir(cwd): if is_project_dir(cwd):
@ -418,7 +423,8 @@ class Osc(cmdln.Cmdln):
print_not_found = False print_not_found = False
else: else:
print('\n'.join(l)) print('\n'.join(l))
if opts.expand or opts.unexpand or not link_seen: break if opts.expand or opts.unexpand or not link_seen:
break
m = show_files_meta(apiurl, project, package) m = show_files_meta(apiurl, project, package)
li = Linkinfo() li = Linkinfo()
li.read(ET.fromstring(''.join(m)).find('linkinfo')) li.read(ET.fromstring(''.join(m)).find('linkinfo'))
@ -1208,7 +1214,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if rdiff != '': if rdiff != '':
targetprojects.append(t) targetprojects.append(t)
pac.append(p) pac.append(p)
rdiffmsg.append("old: %s/%s\nnew: %s/%s\n%s" % (t, p, project, p,rdiff)) rdiffmsg.append("old: %s/%s\nnew: %s/%s\n%s" % (t, p, project, p, rdiff))
else: else:
print("Skipping package ", p, " since it has no difference with the target package.") print("Skipping package ", p, " since it has no difference with the target package.")
else: else:
@ -2930,7 +2936,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
${cmd_option_list} ${cmd_option_list}
""" """
if subcmd == 'getpac' or subcmd == 'branchco' or subcmd == 'bco': opts.checkout = True if subcmd == 'getpac' or subcmd == 'branchco' or subcmd == 'bco':
opts.checkout = True
args = slash_split(args) args = slash_split(args)
tproject = tpackage = None tproject = tpackage = None
@ -3088,7 +3095,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
## FIXME: core.py:commitDelPackage() should have something similar ## FIXME: core.py:commitDelPackage() should have something similar
rlist = get_request_list(apiurl, prj, pkg) rlist = get_request_list(apiurl, prj, pkg)
for rq in rlist: print(rq) for rq in rlist:
print(rq)
if len(rlist) >= 1 and not opts.force: if len(rlist) >= 1 and not opts.force:
print('Package has pending requests. Deleting the package will break them. '\ print('Package has pending requests. Deleting the package will break them. '\
'They should be accepted/declined/revoked before deleting the package. '\ 'They should be accepted/declined/revoked before deleting the package. '\
@ -5426,7 +5434,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# drop the --argument, value tuple from the list # drop the --argument, value tuple from the list
def drop_arg2(lst, name): def drop_arg2(lst, name):
if not name: return lst if not name:
return lst
while name in lst: while name in lst:
i = lst.index(name) i = lst.index(name)
lst.pop(i+1) lst.pop(i+1)
@ -5520,7 +5529,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
return ret return ret
for arg, long_name in ((opts.rsyncsrc, '--rsync-src'), (opts.overlay, '--overlay')): for arg, long_name in ((opts.rsyncsrc, '--rsync-src'), (opts.overlay, '--overlay')):
if not arg: continue if not arg:
continue
ret = rsync_dirs_2host(hostargs, None, long_name, (arg, )) ret = rsync_dirs_2host(hostargs, None, long_name, (arg, ))
if ret != 0: if ret != 0:
return ret return ret
@ -6554,9 +6564,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
v = sr.get('version') v = sr.get('version')
r = sr.get('rev') r = sr.get('rev')
s = sr.get('srcmd5') s = sr.get('srcmd5')
if not v or v == 'unknown': v = '-' if not v or v == 'unknown':
if not r: r = '-' v = '-'
if not s: s = '-' if not r:
r = '-'
if not s:
s = '-'
result.append(v) result.append(v)
result.append(r) result.append(r)
result.append(s) result.append(s)
@ -7057,12 +7070,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# showing the maintainers # showing the maintainers
for maintainers in projects: for maintainers in projects:
indent = "" indent = ""
definingproject=maintainers.get("project") definingproject = maintainers.get("project")
if definingproject: if definingproject:
definingpackage=maintainers.get("package") definingpackage = maintainers.get("package")
indent = " " indent = " "
if definingpackage: if definingpackage:
print("Defined in package: %s/%s " %(definingproject, definingpackage)) print("Defined in package: %s/%s " % (definingproject, definingpackage))
else: else:
print("Defined in project: ", definingproject) print("Defined in project: ", definingproject)