projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SPDXify generated code.
[open-adventure.git]
/
make_dungeon.py
diff --git
a/make_dungeon.py
b/make_dungeon.py
index f90ad3291e29ac6f27b132cfcb575fe5991a5b3f..5eb7dee5ac60b505797742a86c2d7405c19327ae 100755
(executable)
--- a/
make_dungeon.py
+++ b/
make_dungeon.py
@@
-10,6
+10,9
@@
playermove().
Copyright (c) 2017 by Eric S. Raymond
SPDX-License-Identifier: BSD-2-clause
"""
Copyright (c) 2017 by Eric S. Raymond
SPDX-License-Identifier: BSD-2-clause
"""
+
+# pylint: disable=consider-using-f-string
+
import sys, yaml
YAML_NAME = "adventure.yaml"
import sys, yaml
YAML_NAME = "adventure.yaml"
@@
-18,7
+21,7
@@
C_NAME = "dungeon.c"
H_TEMPLATE_PATH = "templates/dungeon.h.tpl"
C_TEMPLATE_PATH = "templates/dungeon.c.tpl"
H_TEMPLATE_PATH = "templates/dungeon.h.tpl"
C_TEMPLATE_PATH = "templates/dungeon.c.tpl"
-DONOTEDIT_COMMENT = "/* Generated from adventure.yaml - do not hand-hack! */\n\n"
+DONOTEDIT_COMMENT = "/* Generated from adventure.yaml - do not hand-hack! */\n
/* SPDX-License-Identifier: BSD-2-clause */\n
\n"
statedefines = ""
statedefines = ""
@@
-524,7
+527,7
@@
def get_travel(travel):
return out
if __name__ == "__main__":
return out
if __name__ == "__main__":
- with open(YAML_NAME, "r") as f:
+ with open(YAML_NAME, "r"
, encoding='ascii', errors='surrogateescape'
) as f:
db = yaml.safe_load(f)
locnames = [x[0] for x in db["locations"]]
db = yaml.safe_load(f)
locnames = [x[0] for x in db["locations"]]
@@
-536,10
+539,10
@@
if __name__ == "__main__":
db["objects"])
ignore = ""
try:
db["objects"])
ignore = ""
try:
- with open(H_TEMPLATE_PATH, "r") as htf:
+ with open(H_TEMPLATE_PATH, "r"
, encoding='ascii', errors='surrogateescape'
) as htf:
# read in dungeon.h template
h_template = DONOTEDIT_COMMENT + htf.read()
# read in dungeon.h template
h_template = DONOTEDIT_COMMENT + htf.read()
- with open(C_TEMPLATE_PATH, "r") as ctf:
+ with open(C_TEMPLATE_PATH, "r"
, encoding='ascii', errors='surrogateescape'
) as ctf:
# read in dungeon.c template
c_template = DONOTEDIT_COMMENT + ctf.read()
except IOError as e:
# read in dungeon.c template
c_template = DONOTEDIT_COMMENT + ctf.read()
except IOError as e:
@@
-587,10
+590,10
@@
if __name__ == "__main__":
state_definitions = statedefines
)
state_definitions = statedefines
)
- with open(H_NAME, "w") as hf:
+ with open(H_NAME, "w"
, encoding='ascii', errors='surrogateescape'
) as hf:
hf.write(h)
hf.write(h)
- with open(C_NAME, "w") as cf:
+ with open(C_NAME, "w"
, encoding='ascii', errors='surrogateescape'
) as cf:
cf.write(c)
# end
cf.write(c)
# end