mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
make gbz80disasm work with python2.6 again
There was an incompatible change to the json module api between py26 and py27, causing gbz80disasm to not work with py26. The fix is to simply alias the new loads method to the old read function. A possibly better plan might be to not support py26 at all.
This commit is contained in:
parent
00a2e4e119
commit
db5208b41f
@ -13,6 +13,7 @@ import random
|
|||||||
# for capwords
|
# for capwords
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
# for python2.6
|
||||||
if not hasattr(json, "dumps"):
|
if not hasattr(json, "dumps"):
|
||||||
json.dumps = json.write
|
json.dumps = json.write
|
||||||
|
|
||||||
|
@ -4,10 +4,12 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from copy import copy, deepcopy
|
from copy import copy, deepcopy
|
||||||
from ctypes import c_int8
|
from ctypes import c_int8
|
||||||
import json
|
|
||||||
import random
|
import random
|
||||||
|
import json
|
||||||
|
|
||||||
spacing = "\t"
|
# New versions of json don't have read anymore.
|
||||||
|
if not hasattr(json, "read"):
|
||||||
|
json.read = json.loads
|
||||||
|
|
||||||
from romstr import RomStr
|
from romstr import RomStr
|
||||||
|
|
||||||
@ -19,6 +21,8 @@ def load_rom(filename="../baserom.gbc"):
|
|||||||
file_handler.close()
|
file_handler.close()
|
||||||
return rom
|
return rom
|
||||||
|
|
||||||
|
spacing = "\t"
|
||||||
|
|
||||||
temp_opt_table = [
|
temp_opt_table = [
|
||||||
[ "ADC A", 0x8f, 0 ],
|
[ "ADC A", 0x8f, 0 ],
|
||||||
[ "ADC B", 0x88, 0 ],
|
[ "ADC B", 0x88, 0 ],
|
||||||
@ -557,7 +561,7 @@ all_labels = {}
|
|||||||
def load_labels(filename="labels.json"):
|
def load_labels(filename="labels.json"):
|
||||||
global all_labels
|
global all_labels
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
all_labels = json.loads(open(filename, "r").read())
|
all_labels = json.read(open(filename, "r").read())
|
||||||
else:
|
else:
|
||||||
print "You must run crystal.scan_for_predefined_labels() to create \"labels.json\". Trying..."
|
print "You must run crystal.scan_for_predefined_labels() to create \"labels.json\". Trying..."
|
||||||
import crystal
|
import crystal
|
||||||
|
Loading…
Reference in New Issue
Block a user