Skip to content

Commit

Permalink
Warn when autogenerated files mismatch, see issue pytorch#24931.
Browse files Browse the repository at this point in the history
  • Loading branch information
pearu committed Aug 22, 2019
1 parent 38366f1 commit e792ade
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions aten/src/ATen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def cmpfiles_with_eol_normalization(a, b, names):
sys.stdout.write('-' * 80 + '\n')
sys.stdout.write('x={}, a={}, b={}\n'.format(x, a, b))
for i, line in enumerate(list(d.compare(ax.splitlines(), bx.splitlines()))):
if line[:2] != ' ' or i < 20:
if line[:2] != ' ':
sys.stdout.write('{:5d}: {}\n'.format(i, line))
sys.stdout.write('-' * 80 + '\n')
except OSError:
Expand Down Expand Up @@ -453,8 +453,9 @@ def generate_outputs():
if len(mismatch) > 1:
file_component = '{' + file_component + '}'
update_cmd = "cp {}/{} {}".format(core_install_dir, file_component, core_source_path)
raise RuntimeError("Source files: {} did not match generated files. To update the source files, "
"set environment variable GEN_TO_SOURCE or run \"{}\"".format(mismatch, update_cmd))
import warnings
warnings.warn("Source files: {} did not match generated files. To update the source files, "
"set environment variable GEN_TO_SOURCE or run \"{}\"".format(mismatch, update_cmd))

declare_outputs()
if options.output_dependencies is not None:
Expand Down

0 comments on commit e792ade

Please sign in to comment.