summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-08-28 19:30:12 +0200
committerGuido Günther <agx@sigxcpu.org>2013-08-28 19:30:12 +0200
commitc9d3d93d28f2a1f839770672f5846115d8d0e3c3 (patch)
tree2b0415593a8ad00a6110134dbdbaee7046481c01 /gbp
parent8f073ebccd35f331981c8e2a396c0999de25a0b2 (diff)
Use open() instead of file()
since the later doesn't exist in python3
Diffstat (limited to 'gbp')
-rw-r--r--gbp/deb/changelog.py2
-rw-r--r--gbp/deb/control.py2
-rw-r--r--gbp/deb/dscfile.py2
-rw-r--r--gbp/deb/format.py4
-rw-r--r--gbp/deb/source.py2
-rw-r--r--gbp/git/repository.py2
-rw-r--r--gbp/patch_series.py2
-rw-r--r--gbp/scripts/common/pq.py8
-rw-r--r--gbp/scripts/dch.py4
-rwxr-xr-xgbp/scripts/pq.py2
10 files changed, 15 insertions, 15 deletions
diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py
index 2857431..356f74d 100644
--- a/gbp/deb/changelog.py
+++ b/gbp/deb/changelog.py
@@ -115,7 +115,7 @@ class ChangeLog(object):
self._cp = cp
def _read(self):
- with file(self.filename) as f:
+ with open(self.filename) as f:
self._contents = f.read()
def __getitem__(self, item):
diff --git a/gbp/deb/control.py b/gbp/deb/control.py
index b15d360..a4cef2f 100644
--- a/gbp/deb/control.py
+++ b/gbp/deb/control.py
@@ -47,7 +47,7 @@ class Control(object):
if not os.access(filename, os.F_OK):
raise NoControlError("Control file %s does not exist" % filename)
- with file(filename) as f:
+ with open(filename) as f:
control = email.message_from_file(f)
if not control.items():
diff --git a/gbp/deb/dscfile.py b/gbp/deb/dscfile.py
index abaf690..e2492dc 100644
--- a/gbp/deb/dscfile.py
+++ b/gbp/deb/dscfile.py
@@ -49,7 +49,7 @@ class DscFile(object):
self.native = False
self.dscfile = os.path.abspath(dscfile)
- f = file(self.dscfile)
+ f = open(self.dscfile)
fromdir = os.path.dirname(os.path.abspath(dscfile))
for line in f:
m = self.version_re.match(line)
diff --git a/gbp/deb/format.py b/gbp/deb/format.py
index 9abba73..3a4c8ab 100644
--- a/gbp/deb/format.py
+++ b/gbp/deb/format.py
@@ -92,7 +92,7 @@ class DebianSourceFormat(object):
'quilt'
>>> os.unlink(t.name)
"""
- with file(filename) as f:
+ with open(filename) as f:
return klass(f.read())
@classmethod
@@ -107,7 +107,7 @@ class DebianSourceFormat(object):
the above parameters
"""
format_file = format_file or klass.format_file
- with file(klass.format_file, 'w') as f:
+ with open(klass.format_file, 'w') as f:
f.write("%s (%s)" % (version, type))
return klass.parse_file(klass.format_file)
diff --git a/gbp/deb/source.py b/gbp/deb/source.py
index 1e87312..c740361 100644
--- a/gbp/deb/source.py
+++ b/gbp/deb/source.py
@@ -32,7 +32,7 @@ class FileVfs(object):
def open(self, path, flags=None):
flags = flags or 'r'
- return file(os.path.join(self._dir, path), flags)
+ return open(os.path.join(self._dir, path), flags)
class DebianSourceError(Exception):
pass
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 3fe8d6f..a9204c5 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1653,7 +1653,7 @@ class GitRepository(object):
raise GitRepositoryError("Error running git init: %s" % stderr)
if description:
- with file(os.path.join(abspath, git_dir, "description"), 'w') as f:
+ with open(os.path.join(abspath, git_dir, "description"), 'w') as f:
description += '\n' if description[-1] != '\n' else ''
f.write(description)
return klass(abspath)
diff --git a/gbp/patch_series.py b/gbp/patch_series.py
index 6a65446..10fccfc 100644
--- a/gbp/patch_series.py
+++ b/gbp/patch_series.py
@@ -167,7 +167,7 @@ class PatchSeries(list):
return []
try:
- s = file(seriesfile)
+ s = open(seriesfile)
except Exception as err:
raise GbpError("Cannot open series file: %s" % err)
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index ce06353..7e6e210 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -148,14 +148,14 @@ def patch_write_header(srcname, dstname):
"""
topic = None
- with file(srcname) as src:
+ with open(srcname) as src:
header = patch_read_header(src)
header_len = len(''.join(header))
topic = patch_header_parse_topic(header)
patch_header_mangle_newline(header)
- with file(dstname, 'w') as dst:
+ with open(dstname, 'w') as dst:
dst.write(''.join(header[1:]))
return (header_len, topic)
@@ -165,9 +165,9 @@ def patch_write_content(srcname, dstname, header_len):
"""
Write out the patch body skipping the header
"""
- with file(srcname) as src:
+ with open(srcname) as src:
src.seek(header_len, 0)
- with file(dstname, 'a') as dst:
+ with open(dstname, 'a') as dst:
dst.write(src.read())
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index eb4de5a..a848d6d 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -126,8 +126,8 @@ def mangle_changelog(changelog, cp, snapshot=''):
"""
try:
tmpfile = '%s.%s' % (changelog, snapshot)
- cw = file(tmpfile, 'w')
- cr = file(changelog, 'r')
+ cw = open(tmpfile, 'w')
+ cr = open(changelog, 'r')
print >>cw, ("%(Source)s (%(MangledVersion)s) "
"%(Distribution)s; urgency=%(urgency)s\n" % cp)
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 78f061a..6885078 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -59,7 +59,7 @@ def export_patches(repo, branch, options):
signature=False,
symmetric=False)
if patches:
- f = file(SERIES_FILE, 'w')
+ f = open(SERIES_FILE, 'w')
gbp.log.info("Regenerating patch queue in '%s'." % PATCH_DIR)
for patch in patches:
filename = write_patch(patch, PATCH_DIR, options)