--- crit/Makefile | 12 +----------- lib/Makefile | 12 +----------- scripts/crit-setup.py | 28 ++++++++++++++++++++++++++++ scripts/pycriu-setup.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 22 deletions(-) --- a/crit/Makefile +++ b/crit/Makefile @@ -10,18 +10,8 @@ ${VERSION_FILE}: $(Q) echo "__version__ = '${CRIU_VERSION}'" > $@ install: ${VERSION_FILE} -ifeq ($(PYTHON_EXTERNALLY_MANAGED),1) -ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0) - $(E) " SKIP INSTALL crit: Externally managed python environment (See PEP 668 for more information)" - $(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make install" -else $(E) " INSTALL " crit - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit -endif -else - $(E) " INSTALL " crit - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit -endif + $(Q) $(PYTHON) scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) .PHONY: install uninstall: --- a/lib/Makefile +++ b/lib/Makefile @@ -57,18 +57,8 @@ install: lib-c lib-a lib-py lib/c/criu.p $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig $(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc $(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig -ifeq ($(PYTHON_EXTERNALLY_MANAGED),1) -ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0) - $(E) " SKIP INSTALL pycriu: Externally managed python environment (See PEP 668 for more information)" - $(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make install" -else $(E) " INSTALL " pycriu - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./lib -endif -else - $(E) " INSTALL " pycriu - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./lib -endif + $(Q) $(PYTHON) scripts/pycriu-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) .PHONY: install uninstall: --- /dev/null +++ b/scripts/crit-setup.py @@ -0,0 +1,28 @@ +import os +from distutils.core import setup + +def get_version(): + version = '0.0.1' + env = os.environ + if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env: + version = '{}.{}'.format( + env['CRIU_VERSION_MAJOR'], + env['CRIU_VERSION_MINOR'] + ) + if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']: + version += '.' + env['CRIU_VERSION_SUBLEVEL'] + return version + + +setup( + name='crit', + version=get_version(), + description='CRiu Image Tool', + author='CRIU team', + author_email='criu@openvz.org', + license='GPLv2', + url='https://github.com/checkpoint-restore/criu', + package_dir={'crit': 'crit/crit'}, + packages=["crit"], + install_requires=[], +) --- /dev/null +++ b/scripts/pycriu-setup.py @@ -0,0 +1,28 @@ +import os +from distutils.core import setup + +def get_version(): + version = '0.0.1' + env = os.environ + if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env: + version = '{}.{}'.format( + env['CRIU_VERSION_MAJOR'], + env['CRIU_VERSION_MINOR'] + ) + if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']: + version += '.' + env['CRIU_VERSION_SUBLEVEL'] + return version + + +setup( + name='pycriu', + version=get_version(), + description='CRiu Image Tool', + author='CRIU team', + author_email='criu@openvz.org', + license='GPLv2', + url='https://github.com/checkpoint-restore/criu', + package_dir={'pycriu': 'lib/pycriu'}, + packages=["pycriu", "pycriu.images"], + install_requires=[], +)