Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
hot-backup.py: Modernize Python syntax.
Browse files Browse the repository at this point in the history
* tools/backup/hot-backup.py.in: Drop syntaxes unsupported by ≥py3.0, while
    retaining compatibility with ≥py2.6.  (Both trunk and 1.9.x require ≥py2.7.)


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1721179 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
danielshahaf committed Dec 21, 2015
1 parent 293c6c6 commit f27587e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/backup/hot-backup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def chmod_tree(path, mode, mask):
def safe_rmtree(dirname, retry=0):
"Remove the tree at DIRNAME, making it writable first"
def rmtree(dirname):
chmod_tree(dirname, 0666, 0666)
chmod_tree(dirname, 0o666, 0o666)
shutil.rmtree(dirname)

if not os.path.exists(dirname):
Expand Down Expand Up @@ -117,7 +117,7 @@ try:
"num-backups=",
"verify",
"help"])
except getopt.GetoptError, e:
except getopt.GetoptError as e:
sys.stderr.write("ERROR: %s\n\n" % e)
sys.stderr.flush()
usage(sys.stderr)
Expand Down Expand Up @@ -231,7 +231,7 @@ print("Beginning hot backup of '"+ repo_dir + "'.")

try:
youngest = get_youngest_revision()
except Exception, e:
except Exception as e:
sys.stderr.write("%s\n" % e)
sys.stderr.flush()
sys.exit(1)
Expand Down Expand Up @@ -299,10 +299,10 @@ if archive_type:
tar = tarfile.open(archive_path, 'w:' + archive_type)
tar.add(backup_subdir, os.path.basename(backup_subdir))
tar.close()
except ImportError, e:
except ImportError as e:
err_msg = "Import failed: " + str(e)
err_code = -2
except tarfile.TarError, e:
except tarfile.TarError as e:
err_msg = "Tar failed: " + str(e)
err_code = -3

Expand All @@ -325,10 +325,10 @@ if archive_type:
for dirpath, dirs, files in os.walk(backup_subdir):
add_to_zip(zp, backup_dir, dirpath, dirs + files)
zp.close()
except ImportError, e:
except ImportError as e:
err_msg = "Import failed: " + str(e)
err_code = -4
except zipfile.error, e:
except zipfile.error as e:
err_msg = "Zip failed: " + str(e)
err_code = -5

Expand Down

0 comments on commit f27587e

Please sign in to comment.