Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 239523 Details for
Bug 311533
app-misc/mved: Verify and potentially improve Python-related code
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fixes syntax errors and runtime errors when using python-3
mved-py3.diff (text/plain), 3.88 KB, created by
marty rosenberg
on 2010-07-20 09:09:37 UTC
(
hide
)
Description:
fixes syntax errors and runtime errors when using python-3
Filename:
MIME Type:
Creator:
marty rosenberg
Created:
2010-07-20 09:09:37 UTC
Size:
3.88 KB
patch
obsolete
>diff --git a/mved b/mved >index 91a5197..c08be9b 100755 >--- a/mved >+++ b/mved >@@ -67,7 +67,8 @@ Options: > %s. > This can be changed by setting the > EDITOR environment variable. >- -f, --force overwrite existing files.""" % editor >+ -f, --force overwrite existing files. >+""" % editor > > > def giveup(message): >@@ -81,18 +82,18 @@ def warn(message): > > def usage(long = 0): > """ print usage information. """ >- print 'mved %s - an editor-focused multiple file move utility' % version >+ stdout.write('mved %s - an editor-focused multiple file move utility\n' % version) > if long: >- print LICENSE >- print DIRECTIONS >- print USAGE >+ stdout.write(LICENSE) >+ stdout.write(DIRECTIONS) >+ stdout.write(USAGE) > > def getoptions(): > """ get options. returns a list of all non-option arguments. """ > global editor, force > try: > options, args = getopt(argv[1:], 'he:f', ['help', 'editor=','force']) >- except GetoptError, e: >+ except GetoptError as e: > giveup(str(e) + ", try 'mved --help' for more information.") > > for opt, arg in options: >@@ -120,9 +121,9 @@ def edit(oldnames): > tmpfd, tmpfilename = mkstemp() > try: > for name in oldnames: >- write(tmpfd, '%s\n' % name) >+ write(tmpfd, (name + '\n').encode("ascii")) > fsync(tmpfd) >- except IOError, e: >+ except IOError as e: > giveup("%s: %s", (tmpfilename, str(e))) > > # warn user if EDITOR is not an absolute path >@@ -136,9 +137,9 @@ def edit(oldnames): > newnames = readlines(tmpfd) > close(tmpfd) > remove(tmpfilename) >- except OSError, e: >+ except OSError as e: > giveup("%s: %s", (tmpfilename, str(e))) >- except IOError, e: >+ except IOError as e: > giveup("%s: %s", (tmpfilename, str(e))) > for i in range(len(newnames)): > newnames[i] = newnames[i].strip('\n') >@@ -151,7 +152,7 @@ def edit(oldnames): > else: > try: > remove(tmpfilename) >- except IOError, e: >+ except IOError as e: > warn("Could not remove %s: %s", (tmpfilename, str(e))) > giveup('Editor exited ungracefully.') > >@@ -164,6 +165,7 @@ def readlines(fd): > lseek(fd, 0, 0) > while True: > ch = read(fd, 1) >+ ch = ch.decode("ascii") > if ch == '': > if str: out.append(str) > break >@@ -401,27 +403,27 @@ if __name__ == '__main__': > msg += '1 does not' > else: > msg += '%i do not' % dontchange >- print msg >+ stdout.write(msg + "\n") > > renamer.checkrenamings(force) > sequence = renamer.renamingsequence() > > for i in sequence: > try: >- print "moving %s -> %s " % (i.frm, i.to) >+ stdout.write("moving %s -> %s \n" % (i.frm, i.to)) > if force == 0 and exists.exists(i.to): > sched = "" > for i in sequence: > sched += "\n%s -> %s" % (i.frm, i.to) >- print "error detected. moving schedule was: %s " % sched >+ stdout.write("error detected. moving schedule was: %s \n" % sched) > giveup("will not overwrite %s\n** RENAMING INTERRUPTED **" \ > % i.to) > rename(i.frm, expanduser(i.to)) >- except OSError, e: >+ except OSError as e: > sched = "" > for i in sequence: > sched += "\n%s -> %s" % (i.frm, i.to) >- print "error detected. moving schedule was: %s" % sched >+ stdout.write("error detected. moving schedule was: %s\n" % sched) > giveup("Could not rename %s to %s: %s\n** RENAMING INTERRUPTED **" \ > % (i.frm, i.to, str(e))) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 311533
: 239523 |
240273