diff --git a/cmake/generate.py b/cmake/generate.py index cfb13f98a..c19936459 100644 --- a/cmake/generate.py +++ b/cmake/generate.py @@ -22,7 +22,6 @@ import simgen.cmake_container as SCC import simgen.parse_makefile as SPM import simgen.packaging as SPKG -## from simgen.text_file import TextFile def process_makefile(makefile_dir, debug=0): @@ -189,4 +188,4 @@ def walk_target_deps(target, defs, rules, actions, simulators, depth='', debug=0 ## Emit all of the individual CMakeLists.txt sims.write_simulators(makefile_dir, debug=debug_level) ## Emit the packaging data - SPKG.write_packaging(makefile_dir) \ No newline at end of file + SPKG.write_packaging(makefile_dir) diff --git a/cmake/simgen/parse_makefile.py b/cmake/simgen/parse_makefile.py index 2923f6d7b..73f98f582 100644 --- a/cmake/simgen/parse_makefile.py +++ b/cmake/simgen/parse_makefile.py @@ -23,7 +23,9 @@ def parse_makefile(fn, g_vars=None, g_rules=None, g_actions=None): Collects all of the variable definitions, rules and actions associated with rules. """ - from distutils.text_file import TextFile + ## Python 3.11 and onward dropped distuitls, so import our local copy. + from simgen.text_file import TextFile + fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape") if g_vars is None: diff --git a/cmake/simgen/text_file.py b/cmake/simgen/text_file.py index 27b651794..818155c98 100644 --- a/cmake/simgen/text_file.py +++ b/cmake/simgen/text_file.py @@ -2,12 +2,7 @@ provides the TextFile class, which gives an interface to text files that (optionally) takes care of stripping comments, ignoring blank -lines, and joining lines with backslashes. - -NOTE: This Python source code is adapted from the distutils module. -Given that the future of distutils is uncertain, keep and maintain -a local copy here. -""" +lines, and joining lines with backslashes.""" import sys, io