From c9d3d93d28f2a1f839770672f5846115d8d0e3c3 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 28 Aug 2013 19:30:12 +0200 Subject: Use open() instead of file() since the later doesn't exist in python3 --- gbp/deb/changelog.py | 2 +- gbp/deb/control.py | 2 +- gbp/deb/dscfile.py | 2 +- gbp/deb/format.py | 4 ++-- gbp/deb/source.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gbp/deb') 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 -- cgit v1.2.3