Source: ply Version: 3.9-1 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: toolchain randomness X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that ply generates non-determinstic output. This is affecting the reproducibility of other packages such as astropy: --- a/python3-astropy_3.0-1_amd64.deb/usr/lib/python3/dist-packages/astropy/units/format/generic_lextab.py 2018-02-13 13:36:43.000000000 +0000 +++ b/python3-astropy_3.0-1_amd64.deb/usr/lib/python3/dist-packages/astropy/units/format/generic_lextab.py 2018-02-13 13:36:43.000000000 +0000 @@ -11,7 +11,7 @@ # generic_lextab.py. This file automatically created by PLY (version 3.9). Don't edit! _tabversion = '3.8' -_lextokens = set(('UFLOAT', 'DOUBLE_STAR', 'STAR', 'FUNCNAME', 'UNIT', 'PERIOD', 'SOLIDUS', 'CLOSE_PAREN', 'OPEN_PAREN', 'SIGN', 'UINT', 'CARET')) +_lextokens = set(('UNIT', 'PERIOD', 'DOUBLE_STAR', 'CARET', 'UINT', 'SIGN', 'STAR', 'SOLIDUS', 'FUNCNAME', 'OPEN_PAREN', 'UFLOAT', 'CLOSE_PAREN')) _lexreflags = 32 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive'} Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
diff --git a/ply/lex.py b/ply/lex.py index 0f3e464..8cf6b6b 100644 --- a/ply/lex.py +++ b/ply/lex.py @@ -179,7 +179,7 @@ class Lexer: with open(filename, 'w') as tf: tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__)) tf.write('_tabversion = %s\n' % repr(__tabversion__)) - tf.write('_lextokens = set(%s)\n' % repr(tuple(self.lextokens))) + tf.write('_lextokens = set(%s)\n' % repr(sorted(tuple(self.lextokens)))) tf.write('_lexreflags = %s\n' % repr(self.lexreflags)) tf.write('_lexliterals = %s\n' % repr(self.lexliterals)) tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo))