Merge remote-tracking branch 'origin/master' into sdl2-branch

This commit is contained in:
Simon Howard 2017-01-30 22:53:36 -05:00
commit c5af517b3b
3 changed files with 23 additions and 7 deletions

View file

@ -3,7 +3,7 @@ AC_INIT(Chocolate Doom, 2.999.0, chocolate-doom-dev-list@chocolate-doom.org,
PACKAGE_SHORTNAME=${PACKAGE_NAME% Doom}
PACKAGE_SHORTDESC="Conservative source port"
PACKAGE_COPYRIGHT="Copyright (C) 1993-2015"
PACKAGE_COPYRIGHT="Copyright (C) 1993-2017"
PACKAGE_LICENSE="GNU General Public License, version 2"
PACKAGE_MAINTAINER="Simon Howard"
PACKAGE_URL="https://www.chocolate-doom.org/"

View file

@ -28,6 +28,7 @@
# CONFIG_VARIABLE_INT(my_variable, c_variable),
#
import io
import sys
import os
import re
@ -36,6 +37,14 @@ import getopt
INCLUDE_STATEMENT_RE = re.compile("@include\s+(\S+)")
# Use appropriate stdout function for Python 2 or 3
def stdout(buf):
if sys.version_info.major < 3:
sys.stdout.write(buf)
else:
sys.stdout.buffer.write(buf)
# Find the maximum width of a list of parameters (for plain text output)
def parameter_list_width(params):
@ -300,7 +309,9 @@ class Parameter:
# Read list of wiki pages
def read_wikipages():
with open("wikipages") as f:
f = io.open("wikipages", encoding='UTF-8')
try:
for line in f:
line = line.rstrip()
@ -352,7 +363,9 @@ def process_file(filename):
current_config_file = None
with open(filename) as f:
f = io.open(file, encoding='UTF-8')
try:
param = None
waiting_for_checkparm = False
@ -414,7 +427,9 @@ def process_files(path):
process_file(path)
def print_template(template_file, content):
with open(template_file) as f:
f = io.open(template_file, encoding='UTF-8')
try:
for line in f:
match = INCLUDE_STATEMENT_RE.search(line)
if match:
@ -424,7 +439,7 @@ def print_template(template_file, content):
print_template(filename, content)
else:
line = line.replace("@content", content)
print(line.rstrip())
stdout(line.rstrip().encode('UTF-8') + b'\n')
def manpage_output(targets, template_file):
@ -441,7 +456,7 @@ def wiki_output(targets, template):
read_wikipages()
for t in targets:
print(t.wiki_output())
stdout(t.wiki_output().encode('UTF-8') + b'\n')
def plaintext_output(targets, template_file):

View file

@ -40,6 +40,7 @@
#
import collections
import io
import sys
import re
@ -76,7 +77,7 @@ def parse_stream(stream):
raise Exception("Mismatched #if in '%s'" % stream.name)
def parse_file(filename):
f = open(filename)
f = io.open(filename, encoding='UTF-8')
try:
parse_stream(f)