diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -526,6 +526,12 @@ : # build lcov report $(MAKE) coverage-lcov +# Run "Argument Clinic" over all source files +# (depends on python having already been built) +.PHONY=clinic +clinic: $(BUILDPYTHON) + $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py */*.c + # Build the interpreter $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -957,7 +957,6 @@ dsl_name = block.dsl_name write = self.f.write - assert (not input) or (input.endswith('\n')) assert not ((dsl_name == None) ^ (output == None)), "you must specify dsl_name and output together, dsl_name " + repr(dsl_name) if not dsl_name: @@ -1091,7 +1090,11 @@ clinic = Clinic(language, verify=verify, filename=filename) with open(filename, 'r', encoding=encoding) as f: - text = clinic.parse(f.read()) + raw = f.read() + + cooked = clinic.parse(raw) + if cooked == raw: + return directory = os.path.dirname(filename) or '.'