From 9a18681ba62d1a297809c243607a7b3763131c36 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Mon, 16 Jul 2018 17:29:50 -0700 Subject: [WIP] Refactor and simplify python builds * pypodman namespaced in site-packages * version numbers pulled from requirements.txt * add python-podman spec file to install eggs Signed-off-by: Jhon Honce Closes: #1106 Approved by: rhatdan --- contrib/python/podman/Makefile | 16 +++++++++++++--- contrib/python/podman/README.md | 7 ++++--- contrib/python/podman/podman/__init__.py | 4 ++-- contrib/python/podman/podman/libs/errors.py | 4 ++-- contrib/python/podman/requirements.txt | 6 +++--- contrib/python/podman/setup.py | 14 ++++++-------- 6 files changed, 30 insertions(+), 21 deletions(-) (limited to 'contrib/python/podman') diff --git a/contrib/python/podman/Makefile b/contrib/python/podman/Makefile index ea40cccac..0a0804566 100644 --- a/contrib/python/podman/Makefile +++ b/contrib/python/podman/Makefile @@ -2,7 +2,11 @@ PYTHON ?= /usr/bin/python3 .PHONY: python-podman python-podman: - $(PYTHON) setup.py bdist + $(PYTHON) setup.py sdist bdist + +.PHONY: lint +lint: + $(PYTHON) -m pylint podman .PHONY: integration integration: @@ -10,12 +14,18 @@ integration: .PHONY: install install: - $(PYTHON) setup.py install --user + $(PYTHON) setup.py install + +.PHONY: clobber +clobber: uninstall clean + +.PHONY: uninstall +uninstall: + $(PYTHON) -m pip uninstall --yes podman ||: .PHONY: clean clean: $(PYTHON) setup.py clean --all - pip3 uninstall podman ||: rm -rf podman.egg-info dist find . -depth -name __pycache__ -exec rm -rf {} \; find . -depth -name \*.pyc -exec rm -f {} \; diff --git a/contrib/python/podman/README.md b/contrib/python/podman/README.md index fad03fd27..ec4a0480b 100644 --- a/contrib/python/podman/README.md +++ b/contrib/python/podman/README.md @@ -6,11 +6,12 @@ See [libpod](https://github.com/projectatomic/libpod) ## Releases -To build the podman egg: +To build the podman egg and install as user: ```sh -cd ~/libpod/contrib/python -python3 setup.py clean -a && python3 setup.py bdist +cd ~/libpod/contrib/python/podman +python3 setup.py clean -a && python3 setup.py sdist bdist +python3 setup.py install --user ``` ## Code snippets/examples: diff --git a/contrib/python/podman/podman/__init__.py b/contrib/python/podman/podman/__init__.py index 5a0356311..ec4775178 100644 --- a/contrib/python/podman/podman/__init__.py +++ b/contrib/python/podman/podman/__init__.py @@ -4,7 +4,7 @@ import pkg_resources from .client import Client from .libs import datetime_format, datetime_parse from .libs.errors import (ContainerNotFound, ErrorOccurred, ImageNotFound, - RuntimeError) + PodmanError) try: __version__ = pkg_resources.get_distribution('podman').version @@ -18,5 +18,5 @@ __all__ = [ 'datetime_parse', 'ErrorOccurred', 'ImageNotFound', - 'RuntimeError', + 'PodmanError', ] diff --git a/contrib/python/podman/podman/libs/errors.py b/contrib/python/podman/podman/libs/errors.py index b98210481..3d2300e39 100644 --- a/contrib/python/podman/podman/libs/errors.py +++ b/contrib/python/podman/podman/libs/errors.py @@ -43,7 +43,7 @@ class ErrorOccurred(VarlinkErrorProxy): pass -class RuntimeError(VarlinkErrorProxy): +class PodmanError(VarlinkErrorProxy): """Raised when Client fails to connect to runtime.""" pass @@ -53,7 +53,7 @@ error_map = { 'io.projectatomic.podman.ContainerNotFound': ContainerNotFound, 'io.projectatomic.podman.ErrorOccurred': ErrorOccurred, 'io.projectatomic.podman.ImageNotFound': ImageNotFound, - 'io.projectatomic.podman.RuntimeError': RuntimeError, + 'io.projectatomic.podman.RuntimeError': PodmanError, } diff --git a/contrib/python/podman/requirements.txt b/contrib/python/podman/requirements.txt index d294af3c7..5a936e7d5 100644 --- a/contrib/python/podman/requirements.txt +++ b/contrib/python/podman/requirements.txt @@ -1,3 +1,3 @@ -varlink>=26.1.0 -setuptools>=39.2.0 -python-dateutil>=2.7.3 +python-dateutil +setuptools>=39 +varlink diff --git a/contrib/python/podman/setup.py b/contrib/python/podman/setup.py index c9db30199..a342c05fd 100644 --- a/contrib/python/podman/setup.py +++ b/contrib/python/podman/setup.py @@ -15,24 +15,22 @@ with open(os.path.join(root, 'requirements.txt')) as r: setup( name='podman', version=os.environ.get('PODMAN_VERSION', '0.0.0'), - description='A client for communicating with a Podman server', - long_description=readme, + description='A library for communicating with a Podman server', author='Jhon Honce', author_email='jhonce@redhat.com', - url='http://github.com/projectatomic/libpod', license='Apache Software License', - python_requires='>=3', + long_description=readme, include_package_data=True, install_requires=requirements, packages=find_packages(exclude=['test']), + python_requires='>=3', zip_safe=True, + url='http://github.com/projectatomic/libpod', keywords='varlink libpod podman', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', - 'Topic :: Software Development', 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.4', + 'Topic :: Software Development', ]) -# Not supported -# long_description_content_type='text/markdown', -- cgit v1.2.3-54-g00ecf