Skip to content
Snippets Groups Projects
Commit 58f3139a authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Get first build passing on mac

parent 00a39cb2
No related branches found
No related tags found
1 merge request!35Convert viewer tree to utilize python3
...@@ -575,13 +575,13 @@ def replace_in(self, src, dst=None, searchdict={}): ...@@ -575,13 +575,13 @@ def replace_in(self, src, dst=None, searchdict={}):
if dst == None: if dst == None:
dst = src dst = src
# read src # read src
f = open(self.src_path_of(src), "rbU") f = open(self.src_path_of(src), "rU")
contents = f.read() contents = f.read()
f.close() f.close()
# apply dict replacements # apply dict replacements
for old, new in searchdict.iteritems(): for old, new in searchdict.items():
contents = contents.replace(old, new) contents = contents.replace(old, new)
self.put_in_file(contents, dst) self.put_in_file(contents.encode("utf-8"), dst)
self.created_paths.append(dst) self.created_paths.append(dst)
def copy_action(self, src, dst): def copy_action(self, src, dst):
......
...@@ -272,7 +272,7 @@ def icon_path(self): ...@@ -272,7 +272,7 @@ def icon_path(self):
def extract_names(self,src): def extract_names(self,src):
try: try:
contrib_file = open(src,'r') contrib_file = open(src,'rU')
except IOError: except IOError:
print("Failed to open '%s'" % src) print("Failed to open '%s'" % src)
raise raise
...@@ -291,7 +291,7 @@ def extract_names(self,src): ...@@ -291,7 +291,7 @@ def extract_names(self,src):
names.append(line.rstrip()) names.append(line.rstrip())
# It's not fair to always put the same people at the head of the list # It's not fair to always put the same people at the head of the list
random.shuffle(names) random.shuffle(names)
return ', '.join(names) return ', '.join(names).encode("utf-8")
def relsymlinkf(self, src, dst=None, catch=True): def relsymlinkf(self, src, dst=None, catch=True):
""" """
...@@ -658,8 +658,7 @@ def wpath(path): ...@@ -658,8 +658,7 @@ def wpath(path):
result = "" result = ""
dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])] dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])]
# sort deepest hierarchy first # sort deepest hierarchy first
dest_files.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) dest_files.sort(key=lambda path: (path.count(os.path.sep), path), reverse=True)
dest_files.reverse()
out_path = None out_path = None
for pkg_file in dest_files: for pkg_file in dest_files:
rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,'')) rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,''))
...@@ -682,8 +681,7 @@ def wpath(path): ...@@ -682,8 +681,7 @@ def wpath(path):
for d in deleted_file_dirs: for d in deleted_file_dirs:
deleted_dirs.extend(path_ancestors(d)) deleted_dirs.extend(path_ancestors(d))
# sort deepest hierarchy first # sort deepest hierarchy first
deleted_dirs.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b)) deleted_dirs.sort(key=lambda path: (path.count(os.path.sep), path), reverse=True)
deleted_dirs.reverse()
prev = None prev = None
for d in deleted_dirs: for d in deleted_dirs:
if d != prev: # skip duplicates if d != prev: # skip duplicates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment