On Tue, Aug 27, 2013 at 1:08 PM, Jose A. Lopes <[email protected]> wrote:
> From: "Jose A. Lopes" <[email protected]>
>
> Haskell to Python constant generation introduced duplicated constants
> in Haskell. This patch eliminates the duplication and fixes Haskell
> to import the correct constants, instead of the generated ones.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
LGTM
Thanks,
Guido
> ---
> autotools/convert-constants | 5 ++++-
> src/Ganeti/Constants.hs | 7 +++++--
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/autotools/convert-constants b/autotools/convert-constants
> index 7304ddb..14109e0 100755
> --- a/autotools/convert-constants
> +++ b/autotools/convert-constants
> @@ -26,6 +26,7 @@ import re
> import types
>
> from ganeti import _autoconf
> +from ganeti import _constants
> from ganeti import compat
> from ganeti import constants
> from ganeti import errors
> @@ -287,7 +288,9 @@ def Convert(module, prefix):
> """
> lines = [""]
>
> - all_items = dict((name, getattr(module, name)) for name in dir(module))
> + all_items = dict((name, getattr(module, name))
> + for name in dir(module)
> + if name not in dir(_constants))
>
> for name in sorted(all_items.keys()):
> value = all_items[name]
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index 060b6d1..e1f493e 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -1,6 +1,7 @@
> {-| Ganeti constants.
>
> -This module reexports the Haskell constants generated from Python.
> +This module reexports the Haskell constants and those generated from
> +Python.
>
> -}
>
> @@ -25,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> MA
>
> -}
>
> -module Ganeti.Constants (module Ganeti.PyConstants) where
> +module Ganeti.Constants (module Ganeti.Hs2Py.HsConstants,
> + module Ganeti.PyConstants) where
>
> +import Ganeti.Hs2Py.HsConstants
> import Ganeti.PyConstants
> --
> 1.8.3
>
--
Guido Trotter
Ganeti Engineering
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
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370