# All configuration values have a default; values that are commented out
# serve to show the default.
+from __future__ import print_function
+from __future__ import unicode_literals
import sys, os
import re
import subprocess
# CONDITIONS OF ANY KIND, either express or implied.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+from builtins import range
+from io import open
import sys
import os
import re
"""
if not os.path.isfile(doxyfile_path):
- print "Doxyfile '%s' does not exist!" % doxyfile_path
+ print("Doxyfile '%s' does not exist!" % doxyfile_path)
sys.exit()
- print "Getting Doxyfile's INPUT"
+ print("Getting Doxyfile's INPUT")
- input_file = open(doxyfile_path, "r")
+ input_file = open(doxyfile_path, "r", encoding='utf-8')
line = input_file.readline()
# read contents of Doxyfile until 'INPUT' statement
"""
if not os.path.isdir(xml_directory_path):
- print "Directory %s does not exist!" % xml_directory_path
+ print("Directory %s does not exist!" % xml_directory_path)
sys.exit()
if not os.path.exists(inc_directory_path):
os.makedirs(inc_directory_path)
list_to_generate = get_doxyfile_input()
- print "Generating 'api_name.inc' files with Doxygen directives"
+ print("Generating 'api_name.inc' files with Doxygen directives")
for header_file_path in list_to_generate.splitlines():
api_name = get_api_name(header_file_path)
inc_file_path = inc_directory_path + "/" + api_name + ".inc"
previous_rst_output = ''
if os.path.isfile(inc_file_path):
- with open(inc_file_path, "r") as inc_file_old:
+ with open(inc_file_path, "r", encoding='utf-8') as inc_file_old:
previous_rst_output = inc_file_old.read()
if previous_rst_output != rst_output:
- with open(inc_file_path, "w") as inc_file:
+ with open(inc_file_path, "w", encoding='utf-8') as inc_file:
inc_file.write(rst_output)
# Process command line arguments, if any
if len(sys.argv) > 1:
if not os.path.isdir(xml_directory_path):
- print "Directory %s does not exist!" % xml_directory_path
+ print("Directory %s does not exist!" % xml_directory_path)
sys.exit()
header_file_path = sys.argv[1]
api_name = get_api_name(header_file_path)
if api_name:
rst_output = generate_directives(header_file_path)
- print "Doxygen directives for '%s'" % header_file_path
- print
- print rst_output
+ print("Doxygen directives for '%s'" % header_file_path)
+ print()
+ print(rst_output)
else:
- print "Options to execute 'gen-dxd.py' application:"
- print "1: $ python gen-dxd.py"
- print " Generate API 'header_file.inc' files for headers defined in '%s'" % doxyfile_path
- print "2: $ python gen-dxd.py header_file_path"
- print " Print out Doxygen directives for a single header file"
- print " example: $ python gen-dxd.py mdns/include/mdns.h"
- print " NOTE: Run Doxygen first to get XML files for the header file"
+ print("Options to execute 'gen-dxd.py' application:")
+ print("1: $ python gen-dxd.py")
+ print(" Generate API 'header_file.inc' files for headers defined in '%s'" % doxyfile_path)
+ print("2: $ python gen-dxd.py header_file_path")
+ print(" Print out Doxygen directives for a single header file")
+ print(" example: $ python gen-dxd.py mdns/include/mdns.h")
+ print(" NOTE: Run Doxygen first to get XML files for the header file")
sys.exit()
# Python script to generate ReSTructured Text .inc snippets
# with version-based content for this IDF version
+from __future__ import print_function
+from __future__ import unicode_literals
+from io import open
import subprocess
import os
import sys
"zipfile_note" : zipfile["stable"] if is_stable else zipfile["unstable"]
}
out_file = os.path.join(out_dir, "git-clone.inc")
- with open(out_file, "w") as f:
+ with open(out_file, "w", encoding='utf-8') as f:
f.write(template["template"] % args)
print("%s written" % out_file)
else:
content = template["branch"] % (ver_type, version)
out_file = os.path.join(out_dir, "version-note.inc")
- with open(out_file, "w") as f:
+ with open(out_file, "w", encoding='utf-8') as f:
f.write(content)
print("%s written" % out_file)
Send bug reports, suggestions and other feedback to ulfalizer a.t Google's
email service. Don't wrestle with internal APIs. Tell me what you need and I
might add it in a safe way as a client API instead."""
+from __future__ import unicode_literals
+from builtins import str
+from builtins import hex
+from builtins import range
+from builtins import object
+from io import open
import os
import re
import sys
for sym in self.syms_iter():
sym.already_written = False
- with open(filename, "w") as f:
+ with open(filename, "w", encoding='utf-8') as f:
# Write header
if header is not None:
f.write(_comment(header))
def __init__(self, filename):
self.filename = _clean_up_path(filename)
- with open(filename, "r") as f:
+ with open(filename, "r", encoding='utf-8') as f:
# No interleaving of I/O and processing yet. Don't know if it would
# help.
self.lines = f.readlines()
T_BOOL, T_TRISTATE, T_HEX, T_INT, T_STRING,
T_DEF_BOOL, T_DEF_TRISTATE,
T_SELECT, T_RANGE, T_OPTION, T_ALLNOCONFIG_Y, T_ENV,
- T_DEFCONFIG_LIST, T_MODULES, T_VISIBLE) = range(39)
+ T_DEFCONFIG_LIST, T_MODULES, T_VISIBLE) = list(range(39))
# The leading underscore before the function assignments below prevent pydoc
# from listing them. The constants could be hidden too, but they're fairly
_sym_ref_re_search = re.compile(r"\$[A-Za-z0-9_]+").search
# Integers representing symbol types
-UNKNOWN, BOOL, TRISTATE, STRING, HEX, INT = range(6)
+UNKNOWN, BOOL, TRISTATE, STRING, HEX, INT = list(range(6))
# Strings to use for types
TYPENAME = {UNKNOWN: "unknown", BOOL: "bool", TRISTATE: "tristate",
NO_SELECTION = 0
# Integers representing expression types
-AND, OR, NOT, EQUAL, UNEQUAL = range(5)
+AND, OR, NOT, EQUAL, UNEQUAL = list(range(5))
# Map from tristate values to integers
TRI_TO_INT = {"n": 0, "m": 1, "y": 2}
# based on http://protips.readthedocs.io/link-roles.html
+from __future__ import print_function
+from __future__ import unicode_literals
import re
import os
from docutils import nodes
def get_github_rev():
path = run_cmd_get_output('git rev-parse --short HEAD')
tag = run_cmd_get_output('git describe --exact-match')
- print ('Git commit ID: ', path)
+ print('Git commit ID: ', path)
if len(tag):
- print ('Git tag: ', tag)
+ print('Git tag: ', tag)
path = tag
return path
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import unicode_literals
+from io import open
import re
import os
import shutil
if not os.path.exists(path_1) or not os.path.exists(path_2):
return False
file_1_contents = ''
- with open(path_1, "r") as f_1:
+ with open(path_1, "r", encoding='utf-8') as f_1:
file_1_contents = f_1.read()
file_2_contents = ''
- with open(path_2, "r") as f_2:
+ with open(path_2, "r", encoding='utf-8') as f_2:
file_2_contents = f_2.read()
return file_1_contents == file_2_contents