mirror of
https://github.com/docker/compose.git
synced 2025-07-25 22:54:54 +02:00
Merge pull request #6205 from docker/2473-windows-long-paths
Force consistent behavior around long paths on Windows builds
This commit is contained in:
commit
0fb6cd1139
@ -22,6 +22,7 @@ NANOCPUS_SCALE = 1000000000
|
|||||||
PARALLEL_LIMIT = 64
|
PARALLEL_LIMIT = 64
|
||||||
|
|
||||||
SECRETS_PATH = '/run/secrets'
|
SECRETS_PATH = '/run/secrets'
|
||||||
|
WINDOWS_LONGPATH_PREFIX = '\\\\?\\'
|
||||||
|
|
||||||
COMPOSEFILE_V1 = ComposeVersion('1')
|
COMPOSEFILE_V1 = ComposeVersion('1')
|
||||||
COMPOSEFILE_V2_0 = ComposeVersion('2.0')
|
COMPOSEFILE_V2_0 = ComposeVersion('2.0')
|
||||||
|
@ -43,6 +43,7 @@ from .const import LABEL_SERVICE
|
|||||||
from .const import LABEL_SLUG
|
from .const import LABEL_SLUG
|
||||||
from .const import LABEL_VERSION
|
from .const import LABEL_VERSION
|
||||||
from .const import NANOCPUS_SCALE
|
from .const import NANOCPUS_SCALE
|
||||||
|
from .const import WINDOWS_LONGPATH_PREFIX
|
||||||
from .container import Container
|
from .container import Container
|
||||||
from .errors import HealthCheckFailed
|
from .errors import HealthCheckFailed
|
||||||
from .errors import NoHealthCheckConfigured
|
from .errors import NoHealthCheckConfigured
|
||||||
@ -1048,12 +1049,7 @@ class Service(object):
|
|||||||
for k, v in self._parse_proxy_config().items():
|
for k, v in self._parse_proxy_config().items():
|
||||||
build_args.setdefault(k, v)
|
build_args.setdefault(k, v)
|
||||||
|
|
||||||
# python2 os.stat() doesn't support unicode on some UNIX, so we
|
path = rewrite_build_path(build_opts.get('context'))
|
||||||
# encode it to a bytestring to be safe
|
|
||||||
path = build_opts.get('context')
|
|
||||||
if not six.PY3 and not IS_WINDOWS_PLATFORM:
|
|
||||||
path = path.encode('utf8')
|
|
||||||
|
|
||||||
if self.platform and version_lt(self.client.api_version, '1.35'):
|
if self.platform and version_lt(self.client.api_version, '1.35'):
|
||||||
raise OperationFailedError(
|
raise OperationFailedError(
|
||||||
'Impossible to perform platform-targeted builds for API version < 1.35'
|
'Impossible to perform platform-targeted builds for API version < 1.35'
|
||||||
@ -1662,3 +1658,15 @@ def convert_blkio_config(blkio_config):
|
|||||||
arr.append(dict([(k.capitalize(), v) for k, v in item.items()]))
|
arr.append(dict([(k.capitalize(), v) for k, v in item.items()]))
|
||||||
result[field] = arr
|
result[field] = arr
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def rewrite_build_path(path):
|
||||||
|
# python2 os.stat() doesn't support unicode on some UNIX, so we
|
||||||
|
# encode it to a bytestring to be safe
|
||||||
|
if not six.PY3 and not IS_WINDOWS_PLATFORM:
|
||||||
|
path = path.encode('utf8')
|
||||||
|
|
||||||
|
if IS_WINDOWS_PLATFORM and not path.startswith(WINDOWS_LONGPATH_PREFIX):
|
||||||
|
path = WINDOWS_LONGPATH_PREFIX + os.path.normpath(path)
|
||||||
|
|
||||||
|
return path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user