Commit 81959e7b authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Generate WConfD Python stubs from Haskell



The generation is included in hs2py.hs, together with other
Haskell to Python code generators.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent c4071978
......@@ -304,7 +304,8 @@ built_base_sources = \
built_python_base_sources = \
lib/_constants.py \
lib/_vcsversion.py \
lib/opcodes.py
lib/opcodes.py \
lib/rpc/stub/wconfd.py
BUILT_PYTHON_SOURCES = \
$(nodist_pkgpython_PYTHON) \
......@@ -332,7 +333,8 @@ nodist_pkgpython_PYTHON = \
$(built_python_base_sources) \
lib/_generated_rpc.py
nodist_pkgpython_rpc_stub_PYTHON =
nodist_pkgpython_rpc_stub_PYTHON = \
lib/rpc/stub/wconfd.py
nodist_pkgpython_bin_SCRIPTS = \
$(nodist_pkglib_python_scripts)
......@@ -1941,6 +1943,9 @@ lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
lib/rpc/stub/wconfd.py: Makefile src/hs2py | stamp-directories
src/hs2py --wconfd-rpc > $@
$(SHELL_ENV_INIT): Makefile stamp-directories
set -e; \
{ echo '# Allow overriding for tests'; \
......
{-# LANGUAGE TemplateHaskell #-}
{-| Haskell to Python opcode generation program.
-}
......@@ -25,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
import Ganeti.Hs2Py.GenOpCodes
import Ganeti.Hs2Py.ListConstants
import Ganeti.THH.PyRPC
import qualified Ganeti.WConfd.Core as WConfd
import System.Environment (getArgs)
import System.Exit (exitFailure)
......@@ -36,6 +40,11 @@ main = do
case args of
["--opcodes"] -> putStrLn showPyClasses
["--constants"] -> putConstants
["--wconfd-rpc"] -> putStrLn $
$( genPyUDSRpcStubStr "ClientRpcStub" "WCONFD_SOCKET"
WConfd.exportedFunctions )
_ -> do
hPutStrLn stderr "Usage: hs2py --opcodes | --constants"
hPutStrLn stderr "Usage: hs2py --opcodes\
\| --constants\
\| --wconfd-rpc"
exitFailure
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment