diff options
Diffstat (limited to 'gbp/scripts/import_srpm.py')
-rwxr-xr-x | gbp/scripts/import_srpm.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index b573f2bc..0712288e 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Import an RPM source package into a GIT repository""" -import ConfigParser +import configparser import sys import re import os @@ -25,7 +25,7 @@ import glob import time import shutil import errno -import urllib2 +import urllib.request, urllib.error, urllib.parse import gbp.tmpfile as tempfile import gbp.command_wrappers as gbpc @@ -68,13 +68,13 @@ def download_file(target_dir, url): """Download a remote file""" gbp.log.info("Downloading '%s'..." % url) try: - urlobj = urllib2.urlopen(url) + urlobj = urllib.request.urlopen(url) local_fn = os.path.join(target_dir, os.path.basename(url)) with open(local_fn, "wb") as local_file: local_file.write(urlobj.read()) - except urllib2.HTTPError as err: + except urllib.error.HTTPError as err: raise GbpError("Download failed: %s" % err) - except urllib2.URLError as err: + except urllib.error.URLError as err: raise GbpError("Download failed: %s" % err.reason) return local_fn @@ -176,7 +176,7 @@ def parse_args(argv): prefix='', usage='%prog [options] /path/to/package' '.src.rpm') - except ConfigParser.ParsingError, err: + except configparser.ParsingError as err: gbp.log.err(err) return None, None @@ -337,7 +337,7 @@ def main(argv): # Need to copy files to the packaging directory given by caller files = [os.path.basename(patch.path) \ for patch in spec.patchseries(unapplied=True, ignored=True)] - for filename in spec.sources().values(): + for filename in list(spec.sources().values()): files.append(os.path.basename(filename)) files.append(os.path.join(spec.specdir, spec.specfile)) # Don't copy orig source archive, though |