about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-01-17 15:48:57 +0100
committeroy <Tom_Adams@web.de>2011-01-17 15:48:57 +0100
commit232aafa89157839cc63eef28795037f5fe2b15b4 (patch)
tree1d1e4ab3a5f36d7d6e626e5639ed7d3012ed9d3a
parent02db5bfe6626b0e6d480c59110816624083790ce (diff)
downloadzcatch-232aafa89157839cc63eef28795037f5fe2b15b4.tar.gz
zcatch-232aafa89157839cc63eef28795037f5fe2b15b4.zip
added Python 3 support fixes by Sworddragon
-rw-r--r--datasrc/compile.py4
-rw-r--r--scripts/cmd5.py20
2 files changed, 12 insertions, 12 deletions
diff --git a/datasrc/compile.py b/datasrc/compile.py
index 0cca5498..bab13931 100644
--- a/datasrc/compile.py
+++ b/datasrc/compile.py
@@ -69,8 +69,8 @@ if gen_client_content_header or gen_server_content_header:
 	order = []
 	for line in contentlines:
 		line = line.strip()
-		if line[:6] == "class " and '(Struct)' in line:
-			order += [line.split()[1].split("(")[0]]
+		if line[:6] == b"class " and b'(Struct)' in line:
+			order += [line.split()[1].split(b"(")[0].decode('ascii')]
 	for name in order:
 		EmitTypeDeclaration(content.__dict__[name])
 
diff --git a/scripts/cmd5.py b/scripts/cmd5.py
index dbdfae82..6ab65160 100644
--- a/scripts/cmd5.py
+++ b/scripts/cmd5.py
@@ -3,15 +3,15 @@ import hashlib, sys, re
 alphanum = "0123456789abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ_"
 
 def cstrip(lines):
-	d = ""	
+	d = b""	
 	for l in lines:
-		l = re.sub("#.*", "", l)
-		l = re.sub("//.*", "", l)
-		d += l + " "
-	d = re.sub("\/\*.*?\*/", "", d) # remove /* */ comments
-	d = d.replace("\t", " ") # tab to space
-	d = re.sub("  *", " ", d) # remove double spaces
-	d = re.sub("", "", d) # remove /* */ comments
+		l = re.sub(b"#.*", b"", l)
+		l = re.sub(b"//.*", b"", l)
+		d += l + b" "
+	d = re.sub(b"\/\*.*?\*/", b"", d) # remove /* */ comments
+	d = d.replace(b"\t", b" ") # tab to space
+	d = re.sub(b"  *", b" ", d) # remove double spaces
+	d = re.sub(b"", b"", d) # remove /* */ comments
 	
 	d = d.strip()
 	
@@ -24,11 +24,11 @@ def cstrip(lines):
 		i += 1
 	return d
 
-f = ""
+f = b""
 for filename in sys.argv[1:]:
 	f += cstrip([l.strip() for l in open(filename, "rb")])
 
-hash = hashlib.md5(f.encode()).hexdigest().lower()[16:]
+hash = hashlib.md5(f).hexdigest().lower()[16:]
 # TODO: refactor hash that is equal to the 0.5 hash, remove when we 
 # TODO: remove when we don't need it any more
 if hash == "026b8eceb4cdd369":