diff options
author | Olav Vitters <olav@vitters.nl> | 2015-01-25 21:12:48 +0100 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2015-01-25 21:12:48 +0100 |
commit | c3c3d15fb063b985a512cf69da8ad5dc581fd29b (patch) | |
tree | 8839dc20ab0ab992b919b3a0c0c2757ef755e3c5 | |
parent | cd2502fa439d6e67fc6b566b7c21c6cf9cd41e8d (diff) | |
download | mgagnome-c3c3d15fb063b985a512cf69da8ad5dc581fd29b.tar mgagnome-c3c3d15fb063b985a512cf69da8ad5dc581fd29b.tar.gz mgagnome-c3c3d15fb063b985a512cf69da8ad5dc581fd29b.tar.bz2 mgagnome-c3c3d15fb063b985a512cf69da8ad5dc581fd29b.tar.xz mgagnome-c3c3d15fb063b985a512cf69da8ad5dc581fd29b.zip |
fix various byte vs string differences
-rwxr-xr-x | mgagnome | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -363,7 +363,7 @@ class SpecFile(object): @property def version(self): - return subprocess.check_output(["rpm", "--define", "_topdir %s" % os.path.join(self.cwd, ".."), "--specfile", self.path, "--queryformat", "%{VERSION}\n"]).splitlines()[0] + return subprocess.check_output(["rpm", "--define", "_topdir %s" % os.path.join(self.cwd, ".."), "--specfile", self.path, "--queryformat", "%{VERSION}\n"]).decode("utf-8").splitlines()[0] def _sources_and_patches(self, flag=None): os.chdir(self.cwd) @@ -769,7 +769,7 @@ class SpecFile(object): if not self.ensure_no_local_changes(force): return False - with open(self.path, "rw") as f: + with open(self.path, "r") as f: data = f.read() if data.count("%subrel") != 0: @@ -1023,7 +1023,7 @@ class Downstream(object): for line in contents: try: - srpm, version, filename = line.split("|") + srpm, version, filename = line.decode("utf-8").split("|") except ValueError: print(line, file=sys.stderr) continue @@ -1068,7 +1068,7 @@ class Downstream(object): Inner working: $ urpmq --whatprovides $search_for --provides""" if search_for not in cls._provides_cache: - cls._provides_cache[search_for] = subprocess.check_output(["urpmq", "--whatprovides", search_for, "--provides"]).splitlines() + cls._provides_cache[search_for] = subprocess.check_output(["urpmq", "--whatprovides", search_for, "--provides"]).decode("utf-8").splitlines() return cls._provides_cache[search_for] @@ -1148,7 +1148,7 @@ class Downstream(object): raise ValueError("Multiple packages found and cannot determine package for version %s" % version) def write_file(path, data): - with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst: + with tempfile.NamedTemporaryFile(mode='w+t',dir=os.path.dirname(path), delete=False) as fdst: fdst.write(data) fdst.flush() os.rename(fdst.name, path) @@ -1217,7 +1217,7 @@ def join_streams(show_version=False, only_diff_version=False): def cmd_group_owner(options, parser): groups = set(options.group) - output = [pkg.split("\t") for pkg in subprocess.check_output(["urpmf", "-F|", "--qf", "%group\t%name\t%sourcerpm\t%version\t%release", "."]).splitlines()] + output = [pkg.split("\t") for pkg in subprocess.check_output(["urpmf", "-F|", "--qf", "%group\t%name\t%sourcerpm\t%version\t%release", "."]).decode("utf-8").splitlines()] if not output: return # Filter by groups @@ -1240,7 +1240,7 @@ def cmd_group_owner(options, parser): packages[group][source].add(name) - maints = dict([line.rpartition(" ")[::2] for line in subprocess.check_output(["mgarepo", "maintdb", "get"]).splitlines()]) + maints = dict([line.rpartition(" ")[::2] for line in subprocess.check_output(["mgarepo", "maintdb", "get"]).decode("utf-8").splitlines()]) def get_output(source, maints, packages): for source in list(packages.keys()): |