Skip to content

Commit

Permalink
Compatibility: unbreak urllib import for old distros
Browse files Browse the repository at this point in the history
Old versions of python-six shipped on e.g. Debian 7, Ubuntu 12.04 and
openSUSE 12.3 do not contain urllib.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
  • Loading branch information
marquiz committed Jan 28, 2016
1 parent cf1b749 commit c50ca96
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gbp/scripts/create_remote_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from six.moves import configparser
import sys
import os, os.path
from six.moves import urllib
import subprocess
import tty, termios
import re
Expand Down Expand Up @@ -108,7 +107,14 @@ def parse_url(remote_url, name, pkg, template_dir=None):
...
GbpError: URL contains invalid ~username expansion.
"""
frags = urllib.parse.urlparse(remote_url)
# Fix for old distros like Debian 7, Ubuntu 12.04 and openSUSE 12.3 with old
# python-six that doesn't have urllib
try:
from six.moves import urllib
frags = urllib.parse.urlparse(remote_url)
except ImportError:
import urlparse
frags = urlparse.urlparse(remote_url)
if frags.scheme in ['ssh', 'git+ssh', '']:
scheme = frags.scheme
else:
Expand Down

0 comments on commit c50ca96

Please sign in to comment.