shithub: choc

Download patch

ref: c5af517b3b1a80bb00f477008308cd2472f228cb
parent: 025e43897ec2241d85dfbf7f61eed4cfc31cbafa
parent: e392bd160a51b8174450370393693d2b7fe8717e
author: Simon Howard <fraggle@soulsphere.org>
date: Mon Jan 30 17:53:36 EST 2017

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

--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 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/"
--- a/man/docgen
+++ b/man/docgen
@@ -28,6 +28,7 @@
 #   CONFIG_VARIABLE_INT(my_variable,       c_variable),
 #
 
+import io
 import sys
 import os
 import re
@@ -36,6 +37,14 @@
 
 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 @@
 # 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 @@
 
     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 @@
         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 @@
                 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 @@
     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):
 
--- a/man/simplecpp
+++ b/man/simplecpp
@@ -40,6 +40,7 @@
 #
 
 import collections
+import io
 import sys
 import re
 
@@ -76,7 +77,7 @@
 		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)