On Thu, Nov 14, 2013 at 11:24 AM, Jose A. Lopes <jabolo...@google.com> wrote: > Merge code of 'hs2py-constants' into 'hs2py', which requires adding > flag '--constants', and merge target 'src/hs2py-constants' into > 'src/hs2py' in 'Makefile.am', also updating dependencies and > variables. > > Signed-off-by: Jose A. Lopes <jabolo...@google.com> > --- > Makefile.am | 33 +++++---------------------------- > src/hs2py-constants.hs | 31 ------------------------------- > src/hs2py.hs | 4 +++- > 3 files changed, 8 insertions(+), 60 deletions(-) > delete mode 100644 src/hs2py-constants.hs > > diff --git a/Makefile.am b/Makefile.am > index 02fa6f6..89050e8 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -269,7 +269,6 @@ CLEANFILES = \ > src/ganeti-confd \ > src/ganeti-luxid \ > src/ganeti-mond \ > - src/hs2py-constants \ > .hpc/*.mix src/*.tix test/hs/*.tix *.tix \ > doc/hs-lint.html > > @@ -600,9 +599,7 @@ HS_DEFAULT_PROGS = \ > > HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS) > > -HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) \ > - src/mon-collector.hs \ > - src/hs2py-constants.hs > +HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs > HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail > > HFLAGS = \ > @@ -969,24 +966,6 @@ install-exec-hook: > done > endif > > -# This target cannot be merged with the '$(HS_ALL_PROGS)' target > -# because 'hs2py-constants' cannot depend on 'Ganeti.Constants'. And > -# the reason for this is because 'hs2py-constants' needs to generate > -# Python code, and 'Ganeti.Constants' is generated by Python. > -src/hs2py-constants: src/hs2py-constants.hs src/AutoConf.hs \ > - src/Ganeti/BasicTypes.hs \ > - src/Ganeti/Constants.hs \ > - src/Ganeti/ConstantUtils.hs \ > - src/Ganeti/JSON.hs src/Ganeti/THH.hs \ > - src/Ganeti/Hs2Py/GenConstants.hs \ > - src/Ganeti/Hs2Py/ListConstants.hs \ > - src/Ganeti/PyValueInstances.hs \ > - | stamp-srclinks > - $(GHC) --make \ > - $(HFLAGS) \ > - -osuf $(notdir $@).o -hisuf $(notdir $@).hi \ > - $(HEXTRA) $(HEXTRA_INT) src/hs2py-constants.hs > - > $(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile > @if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \ > echo "Error: cannot run unittests without the development" \ > @@ -1769,10 +1748,9 @@ test/hs/Test/Ganeti/TestImports.hs: > test/hs/Test/Ganeti/TestImports.hs.in \ > done ; \ > } > $@ > > -lib/_constants.py: Makefile lib/_constants.py.in src/hs2py-constants \ > - | stamp-directories > +lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | > stamp-directories > cat $(abs_top_srcdir)/lib/_constants.py.in > $@ > - src/hs2py-constants >> $@ > + src/hs2py --constants >> $@ > > lib/constants.py: lib/_constants.py > > @@ -1867,9 +1845,8 @@ lib/_vcsversion.py: Makefile vcs-version | > stamp-directories > echo "VCS_VERSION = '$$VCSVER'"; \ > } > $@ > > -lib/opcodes.py: Makefile src/hs2py src/Ganeti/Constants.hs \ > - lib/opcodes.py.in_before lib/opcodes.py.in_after \ > - | stamp-directories > +lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \ > + lib/opcodes.py.in_after | stamp-directories > cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@ > src/hs2py --opcodes >> $@ > cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@ > diff --git a/src/hs2py-constants.hs b/src/hs2py-constants.hs > deleted file mode 100644 > index 9eea997..0000000 > --- a/src/hs2py-constants.hs > +++ /dev/null > @@ -1,31 +0,0 @@ > -{-| hs2py-constants > - > -This program outputs the all the converted Haskell to Python > -constants. > - > --} > - > -{- > - > -Copyright (C) 2013 Google Inc. > - > -This program is free software; you can redistribute it and/or modify > -it under the terms of the GNU General Public License as published by > -the Free Software Foundation; either version 2 of the License, or > -(at your option) any later version. > - > -This program is distributed in the hope that it will be useful, but > -WITHOUT ANY WARRANTY; without even the implied warranty of > -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > -General Public License for more details. > - > -You should have received a copy of the GNU General Public License > -along with this program; if not, write to the Free Software > -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > -02110-1301, USA. > - > --} > -import Ganeti.Hs2Py.ListConstants > - > -main :: IO () > -main = putConstants > diff --git a/src/hs2py.hs b/src/hs2py.hs > index 3a9d3db..0743fda 100644 > --- a/src/hs2py.hs > +++ b/src/hs2py.hs > @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > MA > -} > > import Ganeti.Hs2Py.GenOpCodes > +import Ganeti.Hs2Py.ListConstants > > import System.Environment (getArgs) > import System.Exit (exitFailure) > @@ -34,6 +35,7 @@ main = do > args <- getArgs > case args of > ["--opcodes"] -> putStrLn showPyClasses > + ["--constants"] -> putConstants > _ -> do > - hPutStrLn stderr "Usage: hs2py --opcodes" > + hPutStrLn stderr "Usage: hs2py --opcodes | --constants" > exitFailure > -- > 1.8.4.1 >
LGTM, thanks. Michele -- Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores