summaryrefslogtreecommitdiff
path: root/redtools/fix_labels.py
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-02-13 18:09:31 -0500
committerGitHub <noreply@github.com>2017-02-13 18:09:31 -0500
commit979c98a7c0f67ad6b9685b2d532c66a1f76ffb22 (patch)
treec67cc7b8500aac4e400d4e8bfdbef57a57b63eb1 /redtools/fix_labels.py
parent74c620d01ad59bfb09cf4111ace549b925fcb9ab (diff)
parent766dea11bd63dee939db2b47198410e6c6e0fc7e (diff)
Merge pull request #103 from eevee/py3
Python 3 compatibility, sort of, maybe
Diffstat (limited to 'redtools/fix_labels.py')
-rw-r--r--redtools/fix_labels.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/redtools/fix_labels.py b/redtools/fix_labels.py
index 321a18e..13350f6 100644
--- a/redtools/fix_labels.py
+++ b/redtools/fix_labels.py
@@ -1,12 +1,14 @@
+from __future__ import print_function
+from __future__ import absolute_import
#author: Bryan Bishop <kanzure@gmail.com>
#date: 2012-01-27
#fix trainer header labels to not suck so much
-import analyze_incbins
+from . import analyze_incbins
def replace_trainer_header_labels(debug=False):
"""trainer header labels could be better"""
asm = analyze_incbins.asm
- if debug: print str(type(asm))
+ if debug: print(str(type(asm)))
single_asm = "\n".join(asm)
current_map_name = "asdjkl;"
line_id = 0
@@ -31,8 +33,8 @@ def replace_trainer_header_labels(debug=False):
new_label = current_map_name + "TH" + str(trainer_header_counter) #trainer_header_name
single_asm = single_asm.replace(old_label + ":", new_label + ":")
single_asm = single_asm.replace(old_label + "\n", new_label + "\n")
- if debug: print "old_label = " + old_label
- if debug: print "new_label = " + new_label
+ if debug: print("old_label = " + old_label)
+ if debug: print("new_label = " + new_label)
trainer_header_counter += 1
@@ -50,8 +52,8 @@ def replace_trainer_header_labels(debug=False):
single_asm = single_asm.replace(old_label + ":", new_label + ":")
single_asm = single_asm.replace(old_label + "\n", new_label + "\n")
single_asm = single_asm.replace(old_label + " ;", new_label + " ;")
- if debug: print "old_label = " + old_label
- if debug: print "new_label = " + new_label
+ if debug: print("old_label = " + old_label)
+ if debug: print("new_label = " + new_label)
#replace a text label
elif " TextAfterBattle" in line and not current_map_name in line:
old_label = line.split("dw ")[1].split(" ;")[0]
@@ -59,8 +61,8 @@ def replace_trainer_header_labels(debug=False):
single_asm = single_asm.replace(old_label + ":", new_label + ":")
single_asm = single_asm.replace(old_label + "\n", new_label + "\n")
single_asm = single_asm.replace(old_label + " ;", new_label + " ;")
- if debug: print "old_label = " + old_label
- if debug: print "new_label = " + new_label
+ if debug: print("old_label = " + old_label)
+ if debug: print("new_label = " + new_label)
#replace a text label
elif " TextEndBattle" in line and not current_map_name in line:
old_label = line.split("dw ")[1].split(" ;")[0]
@@ -68,12 +70,12 @@ def replace_trainer_header_labels(debug=False):
single_asm = single_asm.replace(old_label + ":", new_label + ":")
single_asm = single_asm.replace(old_label + "\n", new_label + "\n")
single_asm = single_asm.replace(old_label + " ;", new_label + " ;")
- if debug: print "old_label = " + old_label
- if debug: print "new_label = " + new_label
+ if debug: print("old_label = " + old_label)
+ if debug: print("new_label = " + new_label)
line_id += 1
- print single_asm
+ print(single_asm)
if __name__ == "__main__":
analyze_incbins.load_asm()