On Wed, Jul 31, 2013 at 01:12:22PM +0200, Guido Trotter wrote: > On Wed, Jul 31, 2013 at 1:11 PM, Guido Trotter <[email protected]> wrote: > > On Wed, Jul 31, 2013 at 12:54 PM, Jose A. Lopes <[email protected]> > > wrote: > >> From: "Jose A. Lopes" <[email protected]> > >> > >> Move opcode names to Constants.hs.in instead of being generated from > >> lib/opcodes.py. This step is necessary to avoid a cyclic dependency > >> between Haskell and Python code in what Haskell to Python opcode > >> generation is concerned. > >> > >> Signed-off-by: Jose A. Lopes <[email protected]> > >> --- > >> autotools/convert-constants | 12 ------- > >> src/Ganeti/Constants.hs.in | 84 > >> +++++++++++++++++++++++++++++++++++++++++++++ > >> 2 files changed, 84 insertions(+), 12 deletions(-) > >> > >> diff --git a/autotools/convert-constants b/autotools/convert-constants > >> index 0cb07bb..7304ddb 100755 > >> --- a/autotools/convert-constants > >> +++ b/autotools/convert-constants > >> @@ -30,7 +30,6 @@ from ganeti import compat > >> from ganeti import constants > >> from ganeti import errors > >> from ganeti import luxi > >> -from ganeti import opcodes > >> from ganeti import qlang > >> from ganeti import jstore > >> > >> @@ -300,16 +299,6 @@ def Convert(module, prefix): > >> return "\n".join(lines) > >> > >> > >> -def ConvertMisc(): > >> - """Convert some extra computed-values to Haskell. > >> - > >> - """ > >> - lines = [""] > >> - lines.extend(ConvertVariable("opcodes", "OP_IDS", > >> - opcodes.OP_MAPPING.keys(), {})) > >> - return "\n".join(lines) > >> - > >> - > >> def main(): > >> print Convert(constants, "") > >> print Convert(luxi, "luxi") > >> @@ -317,7 +306,6 @@ def main(): > >> print Convert(_autoconf, "autoconf") > >> print Convert(errors, "errors") > >> print Convert(jstore, "jstore") > >> - print ConvertMisc() > >> > >> > >> if __name__ == "__main__": > >> diff --git a/src/Ganeti/Constants.hs.in b/src/Ganeti/Constants.hs.in > >> index 7a52a9d..616d1aa 100644 > >> --- a/src/Ganeti/Constants.hs.in > >> +++ b/src/Ganeti/Constants.hs.in > >> @@ -28,3 +28,87 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, > >> Boston, MA > >> -} > >> > >> module Ganeti.Constants where > >> + > >> + > > > > Please add a comment specifying that this is OK for now beause this > > constant is just used in haskell unittests. > > > > I'm also wondering if we shouldn't put this in OpCodes.hs instead of > constants, since it's just a list of all the opcodes, and used nowhere > else.
This is a transition patch. This list goes away in the next patch. > > Thanks, > > Guido
