#
# spec file for package python-docker-py
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define upstream_name docker-py
Name:           python-docker-py
Version:        1.5.0
Release:        1.1
Summary:        Docker API Client
License:        Apache-2.0
Group:          System/Management
Url:            https://pypi.python.org/pypi/docker-py
Source0:        https://pypi.python.org/packages/source/d/%{upstream_name}/%{upstream_name}-%{version}.tar.gz

# openSUSE-Patch hide_py_pckgmgmt.patch
Patch0:         hide_py_pckgmgmt.patch
Patch1:         dockpyTest_pathAdd.patch
Requires:       python-requests >= 2.5.2
Requires:       python-six >= 1.4.0
Requires:       python-websocket-client >= 0.32.0
BuildRequires:  fdupes
BuildRequires:  python-coverage
BuildRequires:  python-mock
BuildRequires:  python-requests
BuildRequires:  python-setuptools
BuildRequires:  python-six
BuildRequires:  python-websocket-client
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
A docker API client in Python

%package test
Summary:        Unit tests
Group:          Development/Languages/Python
Requires:       %{name} == %{version}
Requires:       python-coverage
Requires:       python-mock >= 1.0.1
Requires:       python-requests >= 2.5.2
Requires:       python-setuptools
Requires:       python-six >= 1.4.0
Requires:       python-websocket-client >= 0.32.0

%description test
Unit tests for docker-py

%prep
%setup -q -n %{upstream_name}-%{version}
%patch0 -p1
%patch1

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
cp -r tests %{buildroot}/%{python_sitelib}/docker
%fdupes %{buildroot}

%check
#python tests/test.py

%files
%defattr(-,root,root,-)
%doc LICENSE README.md
%dir %{python_sitelib}/*
%exclude %{python_sitelib}/docker/tests/
%{python_sitelib}/docker/*
%{python_sitelib}/*egg-info/*

%files test
%defattr(-,root,root,-)
%dir %{python_sitelib}/docker/tests
%{python_sitelib}/docker/tests/*

%changelog
* Wed Oct 21 2015 dmueller@suse.com
- update to 1.5.0:
  * Added support for the networking API introduced in Docker 1.9.0
  * Added support for the volumes API introduced in Docker 1.9.0
  * Added support for the group_add parameter in create_host_config.
  * Added support for the CPU CFS (cpu_quota and cpu_period) parameteres in create_host_config.
  * Added support for the archive API endpoint (Client.get_archive,  Client.put_archive).
  * Added support for ps_args parameter in Client.top.
  * Added utils.parse_env_file to support env-files. See docs for usage.
  * Added support for arbitrary log drivers
  * Added support for URL paths in the docker host URL (base_url)
  * Fixed a bug where exec_inspect would allow invocation when the API version was too low.
  * Fixed a bug where docker.utils.ports.split_port would break if an open range was provided.
  * Fixed a bug where invalid image IDs / container IDs could be provided to bypass or reroute request URLs
* Fri Aug 14 2015 jmassaguerpla@suse.com
- Get source tarball from pypi.python.org as in previuos versions
  and as it is in the spec file
* Mon Jul 27 2015 hvogel@suse.com
- Update to version 1.3.1. Detailed changelog:
  https://github.com/docker/docker-py/blob/master/docs/change_log.md#131
* Mon May  4 2015 benoit.monin@gmx.fr
- update to version 1.2.1:
  * Fixed a bug where the check_resource decorator would break with
    some argument-passing methods. (#573)
- additional changes from version 1.2.0:
  * Client.execute is being deprecated in favor of the more
    dev-friendly Client.exec_start and Client.exec_create. It will
    be removed in 1.3.0
  * Added exec_create, exec_start, exec_inspect and exec_resize to
    client, accurately mirroring the Exec API
  * Added auth_config param to Client.pull (allows to use one-off
    credentials for this pull request)
  * Added support for ipc_mode in host config.
  * Added support for the log_config param in host config.
  * Added support for the ulimit param in host config.
  * Added support for container resource limits in Client.build.
  * When a resource identifier (image or container ID) is passed to
    a Client method, we now check for None values to avoid crashing
    (now raises docker.errors.NullResource)
  * Added tools to parse port ranges inside the new
    docker.utils.ports package.
  * Added a version_info attribute to the docker package.
  * Fixed a bug in Client.port where absence of a certain key in
    the container's JSON would raise an error (now just returns
    None)
  * Fixed a bug with the trunc parameter in Client.containers
    having no effect (moved functionality to the client)
  * Several improvements have been made to the Client.import_image
    method.
  * Fixed pushing / pulling to v2 registries
  * Fixed a bug where passing a container dictionary to
    Client.commit would fail
  * Default API version has been bumped to 1.18 (Docker Engine
    1.6.0)
  * Several testing coverage improvements
  * Docs fixes and improvements
- point the source URL to pypi
- add a dependency between the test sub-package and
  python-docker-py
* Thu Apr  9 2015 fcastelli@suse.com
- Updated to 1.1.0
  * Features
  * Added `dockerfile` param support to `Client.build` (mirrors
    `docker build -f` behavior)
  * Added the ability to specify `'auto'` as `version` in `Client.__init__`,
    allowing the constructor to autodetect the daemon's API version.
  * Bugfixes
  * Fixed a bug where decoding a result stream using the `decode` parameter
    would break when using Python 3.x
  * Fixed a bug where some files in `.dockerignore` weren't being handled
    properly
  * Fixed `resolve_authconfig` issues by bringing it closer to Docker Engine's
    behavior. This should fix all issues encountered with private registry auth
  * Fixed an issue where passwords containing a colon weren't being handled
    properly.
  * Bumped `requests` version requirement, which should fix most of the SSL
    issues encountered recently.
  * Miscellaneous
  * Several integration test improvements.
  * Fixed some unclosed resources in unit tests.
  * Several docs improvements.
- Version 1.0.0
  * Features
  * Added new `Client.rename` method (`docker rename`)
  * Added now `Client.stats` method (`docker stats`)
  * Added `read_only` param support to `utils.create_host_config` and
    `Client.start` (`docker run --read-only`)
  * Added `pid_mode` param support to `utils.create_host_config` and
    `Client.start` (`docker run --pid='host'`)
  * Added `since`, `until` and `filters` params to `Client.events`.
  * Added `decode` parameter to `Client.stats` and `Client.events` to decode
    JSON objects on the fly (False by default).
- Bugfixes
  * Fixed a bug that caused `Client.build` to crash when the provided source was
    a remote source.
- Miscellaneous
  * Default API version has been bumped to 1.17 (Docker Engine 1.5.0)
  * `Client.timeout` is now a public attribute, and users are encouraged to use it
    when request timeouts need to be changed at runtime.
  * Added `Client.api_version` as a read-only property.
  * The `memswap_limit` argument in `Client.create_container` now accepts string
    type values similar to `mem_limit` ('6g', '120000k', etc.)
  * Improved documentation
- Version 0.7.2
  * Features
  * Added support for `mac_address` in `Client.create_container`
  * Bugfixes
  * Fixed a bug where streaming responses (`pull`, `push`, `logs`, etc.) were
    unreliable (#300)
  * Fixed a bug where resolve_authconfig wouldn't properly resolve configuration
    for private repositories (#468)
  * Fixed a bug where some errors wouldn't be properly constructed in
    `client.py`, leading to unhelpful exceptions bubbling up (#466)
  * Fixed a bug where `Client.build` would try to close context when externally
    provided (`custom_context == True`) (#458)
  * Fixed an issue in `create_host_config` where empty sequences wouldn't be
    interpreted properly (#462)
  * Miscellaneous
  * Added `resolve_authconfig` tests.
- Version 0.7.1
  * Bugfixes
  * `setup.py` now indicates a maximum version of requests to work around the
    boot2docker / `assert_hostname` bug.
  * Removed invalid exception when using the Registry Hub's FQDN when pulling.
  * Fixed an issue where early HTTP errors weren't handled properly in streaming
    responses.
  * Fixed a bug where sockets would close unexpectedly using Python 3.x
  * Various fixes for integration tests.
  * Miscellaneous
  * Small doc fixes
- Version 0.7.0
  * Breaking changes
  * Passing `dns` or `volumes_from` in `Client.start` with API version < 1.10
    will now raise an exception (previously only triggered a warning)
  * Features
  * Added support for `host_config` in `Client.create_container`
  * Added utility method `docker.utils.create_host_config` to help build a
    proper `HostConfig` dictionary.
  * Added support for the `pull` parameter in `Client.build`
  * Added support for the `forcerm` parameter in `Client.build`
  * Added support for `extra_hosts` in `Client.start`
  * Added support for a custom `timeout` in `Client.wait`
  * Added support for custom `.dockercfg` loading in `Client.login`
    (`dockercfg_path` argument)
  * Bugfixes
  * Fixed a bug where some output wouldn't be streamed properly in streaming
    chunked responses
  * Fixed a bug where the `devices` param didn't recognize the proper delimiter
  * `Client.login` now properly expands the `registry` URL if provided.
  * Fixed a bug where unicode characters in passed for `environment` in
    `create_container` would break.
  * Miscellaneous
  * Several unit tests and integration tests improvements.
  * `Client` constructor now enforces passing the `version` parameter as a
    string.
  * Build context files are now ordered by filename when creating the archive
    (for consistency with docker mainline behavior)
- Version 0.6.0
  * **This version introduces breaking changes!**
  * Breaking changes
  * The default SSL protocol is now the highest TLS v1.x (was SSL v2.3 before)
    (Poodle fix)
  * The `history` command now returns a dict instead of a raw JSON string.
  * Features
  * Added the `execute` command.
  * Added `pause` and `unpause` commands.
  * Added support fo the `cpuset` param in `create_container`
  * Added support for host devices (`devices` param in `start`)
  * Added support for the `tail` param in `logs`.
  * Added support for the `filters` param in `images` and `containers`
  * The `kwargs_from_env` method is now available in the `docker.utils`
    module. This should make it easier for boot2docker user to connect
    to their daemon.
  * Bugfixes
  * Fixed a bug where empty directories weren't correctly included when
    providing a context to `Client.build`.
  * Fixed a bug where UNIX socket connections weren't properly cleaned up,
    causing `ResourceWarning`s to appear in some cases.
  * Fixed a bug where docker-py would crash if the docker daemon was stopped
    while reading a streaming response
  * Fixed a bug with streaming responses in Python 3
  * `remove_image` now supports a dict containing an `Id` key as its `id`
    parameter (similar to other methods requiring a resource ID)
  * Documentation
  * Added new MkDocs documentation. Currently hosted on
    [ReadTheDocs](http://docker-py.readthedocs.org/en/latest/)
  * Miscellaneous
  * Added tests to sdist
  * Added a Makefile for running tests in Docker
  * Updated Dockerfile
* Wed Mar  4 2015 rjschwei@suse.com
- Use updated version in SLES 12 in support of bnc#915479
* Sun Feb  8 2015 rjschwei@suse.com
- Update to version 0.5.3  - Contains breaking changes
  * Fixed attaching when connecting to the daemon over a UNIX socket.
  * Fixed a bug where sockets were closed immediately when attaching over
    TLS.
  * Added a `assert_hostname` option to `TLSConfig` which can be used to
    disable verification of hostnames.
  * Fixed SSL not working due to an incorrect version comparison
  * Fixed streams not working on Windows
  * Added `insecure_registry` parameter in `Client.push` and `Client.pull`.
    + It defaults to False and code pushing to non-HTTPS private registries
    might break as a result.*
  * Added support for adding and dropping capabilities
  * Added support for restart policy
  * Added support for string values in `Client.create_container`'s `mem_limit`
  * Added support for `.dockerignore` file in `Client.build`
  * Fixed timeout behavior in `Client.stop`
  * `Client.create_container` provides better validation of the `volumes`
    parameter
  * Improved integration tests
- Enable run of some of the tests
  * add: dockpyTest_pathAdd.patch
- Create test subpackage
* Wed Aug  6 2014 fcastelli@suse.com
- Update to version 0.4.0:
  * This version introduces breaking changes!
  * The base_url parameter in the Client constructor should now allow most of
    the DOCKER_HOST environment values (except for the fd:// protocol)
    As a result, URLs that don't specify a port are now invalid (similar to
    the official client's behavior)
  * Added TLS support (see documentation)
  * Fixed an issue with Client.build streamed logs in Python 3
  * Added unit tests coverage
  * Various integration tests fixes
- Changes introduced by version 0.3.2:
  * Default API version is now 1.12 (support for docker 1.0)
  * Added new methods Client.get_image and Client.load_image (docker save and
    docker load)
  * Added new method Client.ping
  * Added new method Client.resize
  * Client.build can now be provided with a custom context using the
    custom_context parameter.
  * Added support for memswap_limit parameter in create_container
  * Added support for force parameter in remove_container
  * Added support for force and noprune parameters in remove_image
  * Added support for timestamps parameter in logs
  * Added support for dns_search parameter in start
  * Added support for network_mode parameter in start
  * Added support for size parameter in containers
  * Added support for volumes_from and dns parameters in start.
    As of API version >= 1.10, these parameters no longer belong to create_container
  * Client.logs now uses the logs endpoint when API version is sufficient
  * Fixed a bug in pull where the repo:tag notation wasn't interpreted properly
  * Fixed a bug in streaming methods with python 3 (unicode, bytes/str related)
  * Fixed a bug in Client.start where legacy notation for volumes wasn't supported anymore.
  * The client now raises DockerExceptions when appropriate. You can import
    DockerException (and its subclasses) from the docker.errors module to
    catch them if needed.
  * docker.APIError has been moved to the new docker.errors module as well.
  * Client.insert is deprecated in API version > 1.11
  * Improved integration tests should now run much faster.
  * There is now a single source of truth for the docker-py version number.
* Mon Jun 16 2014 rschweikert@suse.com
- Clean up spec file
* Fri Jun  6 2014 rschweikert@suse.com
- Include in SLE 12 (FATE #316168)
* Thu Jun  5 2014 rschweikert@suse.com
- Initial build