From a390094bd05980012feadf0861d63c49a8f1a75e Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 16 May 2018 06:20:24 +0000 Subject: [PATCH] crit: enable python2 or python3 based crit With this last commit of the crit with python3 series it is possible to either use python2 or python3 with CRIU. Now the basic build system functionality (make and make install) are python2/python3 aware. zdtm.py and criu-coredump are still python2, but as they are not part of 'make install' those parts have not yet been ported from python2 to python3. Signed-off-by: Adrian Reber Signed-off-by: Andrei Vagin --- .gitignore | 1 + Makefile | 17 +++++++++++++---- crit/Makefile | 13 +++++++++++++ crit/crit-python2 | 6 ++++++ crit/crit-python3 | 6 ++++++ crit/crit => lib/py/cli.py | 1 - 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 crit/Makefile create mode 100755 crit/crit-python2 create mode 100755 crit/crit-python3 rename crit/crit => lib/py/cli.py (99%) diff --git a/.gitignore b/.gitignore index 048668905..c231104af 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ images/google/protobuf/*.c images/google/protobuf/*.h .gitid criu/criu +crit/crit criu/arch/*/sys-exec-tbl*.c # x86 syscalls-table is not generated !criu/arch/x86/sys-exec-tbl.c diff --git a/Makefile b/Makefile index 558963914..947449562 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ HOSTCFLAGS += $(WARNINGS) $(DEFINES) -iquote include/ export CFLAGS USERCLFAGS HOSTCFLAGS # Default target -all: criu lib +all: criu lib crit .PHONY: all # @@ -228,14 +228,22 @@ criu: $(criu-deps) $(Q) $(MAKE) $(build)=criu all .PHONY: criu +crit/Makefile: ; +crit/%: criu .FORCE + $(Q) $(MAKE) $(build)=crit $@ +crit: criu + $(Q) $(MAKE) $(build)=crit all +.PHONY: crit + + # -# Libraries next once criu it ready +# Libraries next once crit it ready # (we might generate headers and such # when building criu itself). lib/Makefile: ; -lib/%: criu .FORCE +lib/%: crit .FORCE $(Q) $(MAKE) $(build)=lib $@ -lib: criu +lib: crit $(Q) $(MAKE) $(build)=lib all .PHONY: lib @@ -247,6 +255,7 @@ clean mrproper: $(Q) $(MAKE) $(build)=compel $@ $(Q) $(MAKE) $(build)=compel/plugins $@ $(Q) $(MAKE) $(build)=lib $@ + $(Q) $(MAKE) $(build)=crit $@ .PHONY: clean mrproper clean-top: diff --git a/crit/Makefile b/crit/Makefile new file mode 100644 index 000000000..988b481b6 --- /dev/null +++ b/crit/Makefile @@ -0,0 +1,13 @@ + +all-y += crit + +crit/crit: crit/crit-$(PYTHON) + $(Q) cp $^ $@ +crit: crit/crit +.PHONY: crit + +clean-crit: + $(Q) $(RM) crit/crit +.PHONY: clean-crit +clean: clean-crit +mrproper: clean diff --git a/crit/crit-python2 b/crit/crit-python2 new file mode 100755 index 000000000..b0b7d3c3a --- /dev/null +++ b/crit/crit-python2 @@ -0,0 +1,6 @@ +#!/usr/bin/env python2 + +from pycriu import cli + +if __name__ == '__main__': + cli.main() diff --git a/crit/crit-python3 b/crit/crit-python3 new file mode 100755 index 000000000..80467cba7 --- /dev/null +++ b/crit/crit-python3 @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +from pycriu import cli + +if __name__ == '__main__': + cli.main() diff --git a/crit/crit b/lib/py/cli.py similarity index 99% rename from crit/crit rename to lib/py/cli.py index 6adccc9f2..12597dbfb 100755 --- a/crit/crit +++ b/lib/py/cli.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import print_function import argparse import sys