Skip to content

Commit b5d9312

Browse files
committed
npipe support cleanup
Signed-off-by: Joffrey F <[email protected]>
1 parent 4a8832c commit b5d9312

File tree

9 files changed

+16
-45
lines changed

9 files changed

+16
-45
lines changed

docker/client.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
from . import constants
2727
from . import errors
2828
from .auth import auth
29-
from .unixconn import unixconn
29+
from .ssladapter import ssladapter
30+
from .tls import TLSConfig
31+
from .transport import UnixAdapter
32+
from .utils import utils, check_resource, update_headers, kwargs_from_env
3033
try:
31-
from .npipeconn import npipeconn
34+
from .transport import NpipeAdapter
3235
except ImportError:
3336
pass
34-
from .ssladapter import ssladapter
35-
from .utils import utils, check_resource, update_headers, kwargs_from_env
36-
from .tls import TLSConfig
3737

3838

3939
def from_env(**kwargs):
@@ -65,15 +65,20 @@ def __init__(self, base_url=None, version=None,
6565

6666
base_url = utils.parse_host(base_url, sys.platform, tls=bool(tls))
6767
if base_url.startswith('http+unix://'):
68-
self._custom_adapter = unixconn.UnixAdapter(base_url, timeout)
68+
self._custom_adapter = UnixAdapter(base_url, timeout)
6969
self.mount('http+docker://', self._custom_adapter)
7070
self.base_url = 'http+docker://localunixsocket'
7171
elif base_url.startswith('npipe://'):
7272
if not constants.IS_WINDOWS_PLATFORM:
7373
raise errors.DockerException(
7474
'The npipe:// protocol is only supported on Windows'
7575
)
76-
self._custom_adapter = npipeconn.NpipeAdapter(base_url, timeout)
76+
try:
77+
self._custom_adapter = NpipeAdapter(base_url, timeout)
78+
except NameError:
79+
raise errors.DockerException(
80+
'Install pypiwin32 package to enable npipe:// support'
81+
)
7782
self.mount('http+docker://', self._custom_adapter)
7883
self.base_url = 'http+docker://localnpipe'
7984
else:

docker/npipeconn/test_npipe_echoserv.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

docker/transport/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# flake8: noqa
2+
from .npipe import NpipeAdapter
3+
from .unixconn import UnixAdapter
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
description="Python client for Docker.",
3636
url='https://github.com/docker/docker-py/',
3737
packages=[
38-
'docker', 'docker.api', 'docker.auth', 'docker.unixconn',
38+
'docker', 'docker.api', 'docker.auth', 'docker.transport',
3939
'docker.utils', 'docker.utils.ports', 'docker.ssladapter'
4040
],
4141
install_requires=requirements,

0 commit comments

Comments
 (0)