diff options
author | Papoteur <papoteur@mageialinux-online.org> | 2015-10-10 09:16:26 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageialinux-online.org> | 2015-10-10 09:16:26 +0200 |
commit | 142d404aa8cffc9f4785e5347f26036463dedcd4 (patch) | |
tree | c58f4d5c692c945eb10180baadb123d2c3762ad3 /MgaRepo/mirror.py | |
parent | 3e3e90e699192df60eeafb2ec7a9e087aff97195 (diff) | |
download | mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.gz mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.bz2 mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.xz mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.zip |
Apply 2to3-3.4
Diffstat (limited to 'MgaRepo/mirror.py')
-rw-r--r-- | MgaRepo/mirror.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/MgaRepo/mirror.py b/MgaRepo/mirror.py index 1d1fcf3..205cc52 100644 --- a/MgaRepo/mirror.py +++ b/MgaRepo/mirror.py @@ -1,7 +1,7 @@ import sys import os -import urlparse -import urllib +import urllib.parse +import urllib.request, urllib.parse, urllib.error from MgaRepo import Error, config, layout from MgaRepo.svn import SVN @@ -12,24 +12,24 @@ def mirror_url(): def normalize_path(url): """normalize url for relocate_path needs""" - parsed = urlparse.urlparse(url) + parsed = urllib.parse.urlparse(url) path = os.path.normpath(parsed[2]) - newurl = urlparse.urlunparse((parsed[0], parsed[1], path, + newurl = urllib.parse.urlunparse((parsed[0], parsed[1], path, parsed[3], parsed[4], parsed[5])) return newurl def _joinurl(url, relpath): - parsed = urlparse.urlparse(url) + parsed = urllib.parse.urlparse(url) newpath = os.path.join(parsed[2], relpath) - newurl = urlparse.urlunparse((parsed[0], parsed[1], newpath, + newurl = urllib.parse.urlunparse((parsed[0], parsed[1], newpath, parsed[3], parsed[4], parsed[5])) return newurl def strip_username(url): - parsed = list(urlparse.urlparse(url)) - _, parsed[1] = urllib.splituser(parsed[1]) - newurl = urlparse.urlunparse(parsed) + parsed = list(urllib.parse.urlparse(url)) + _, parsed[1] = urllib.parse.splituser(parsed[1]) + newurl = urllib.parse.urlunparse(parsed) return newurl def same_base(parent, url): @@ -99,13 +99,13 @@ def autoswitch(svn, wcpath, wcurl, newbaseurl=None): repository = layout.repository_url() current = repository if repository is None: - raise Error, "the option repository from mgarepo.conf is "\ - "required" + raise Error("the option repository from mgarepo.conf is "\ + "required") indefault = same_base(repository, wcurl) if not newbaseurl: if not mirror: - raise Error, "an URL is needed when the option mirror "\ - "from mgarepo.conf is not set" + raise Error("an URL is needed when the option mirror "\ + "from mgarepo.conf is not set") if indefault: chosen = mirror elif same_base(mirror, wcurl): @@ -122,8 +122,8 @@ def autoswitch(svn, wcpath, wcurl, newbaseurl=None): nobase = True chosen = newbaseurl if nobase: - raise Error, "the URL of this working copy is not based in "\ - "repository nor mirror URLs" + raise Error("the URL of this working copy is not based in "\ + "repository nor mirror URLs") assert current != chosen newurl = mirror_relocate(current, chosen, wcurl, wcpath) return newurl |