Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
9c2b4e12
Kaydet (Commit)
9c2b4e12
authored
Mar 14, 2018
tarafından
Joffrey F
Kaydeden (comit)
Joffrey F
Mar 20, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use same split rules for Dockerfile as other include/exclude patterns
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
4c263ee2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
build.py
docker/utils/build.py
+5
-2
utils_test.py
tests/unit/utils_test.py
+5
-0
No files found.
docker/utils/build.py
Dosyayı görüntüle @
9c2b4e12
...
@@ -31,18 +31,21 @@ def exclude_paths(root, patterns, dockerfile=None):
...
@@ -31,18 +31,21 @@ def exclude_paths(root, patterns, dockerfile=None):
if
dockerfile
is
None
:
if
dockerfile
is
None
:
dockerfile
=
'Dockerfile'
dockerfile
=
'Dockerfile'
def
split_path
(
p
):
return
[
pt
for
pt
in
re
.
split
(
_SEP
,
p
)
if
pt
and
pt
!=
'.'
]
def
normalize
(
p
):
def
normalize
(
p
):
# Leading and trailing slashes are not relevant. Yes,
# Leading and trailing slashes are not relevant. Yes,
# "foo.py/" must exclude the "foo.py" regular file. "."
# "foo.py/" must exclude the "foo.py" regular file. "."
# components are not relevant either, even if the whole
# components are not relevant either, even if the whole
# pattern is only ".", as the Docker reference states: "For
# pattern is only ".", as the Docker reference states: "For
# historical reasons, the pattern . is ignored."
# historical reasons, the pattern . is ignored."
split
=
[
pt
for
pt
in
re
.
split
(
_SEP
,
p
)
if
pt
and
pt
!=
'.'
]
# ".." component must be cleared with the potential previous
# ".." component must be cleared with the potential previous
# component, regardless of whether it exists: "A preprocessing
# component, regardless of whether it exists: "A preprocessing
# step [...] eliminates . and .. elements using Go's
# step [...] eliminates . and .. elements using Go's
# filepath.".
# filepath.".
i
=
0
i
=
0
split
=
split_path
(
p
)
while
i
<
len
(
split
):
while
i
<
len
(
split
):
if
split
[
i
]
==
'..'
:
if
split
[
i
]
==
'..'
:
del
split
[
i
]
del
split
[
i
]
...
@@ -62,7 +65,7 @@ def exclude_paths(root, patterns, dockerfile=None):
...
@@ -62,7 +65,7 @@ def exclude_paths(root, patterns, dockerfile=None):
# Exclude empty patterns such as "." or the empty string.
# Exclude empty patterns such as "." or the empty string.
filter
(
lambda
p
:
p
[
1
],
patterns
),
filter
(
lambda
p
:
p
[
1
],
patterns
),
# Always include the Dockerfile and .dockerignore
# Always include the Dockerfile and .dockerignore
[(
True
,
dockerfile
.
split
(
'/'
)),
(
True
,
[
'.dockerignore'
])]))))
[(
True
,
split_path
(
dockerfile
)),
(
True
,
[
'.dockerignore'
])]))))
return
set
(
walk
(
root
,
patterns
))
return
set
(
walk
(
root
,
patterns
))
...
...
tests/unit/utils_test.py
Dosyayı görüntüle @
9c2b4e12
...
@@ -698,6 +698,11 @@ class ExcludePathsTest(unittest.TestCase):
...
@@ -698,6 +698,11 @@ class ExcludePathsTest(unittest.TestCase):
[
'*'
],
dockerfile
=
'foo/Dockerfile3'
[
'*'
],
dockerfile
=
'foo/Dockerfile3'
)
==
convert_paths
(
set
([
'foo/Dockerfile3'
,
'.dockerignore'
]))
)
==
convert_paths
(
set
([
'foo/Dockerfile3'
,
'.dockerignore'
]))
# https://github.com/docker/docker-py/issues/1956
assert
self
.
exclude
(
[
'*'
],
dockerfile
=
'./foo/Dockerfile3'
)
==
convert_paths
(
set
([
'foo/Dockerfile3'
,
'.dockerignore'
]))
def
test_exclude_dockerfile_child
(
self
):
def
test_exclude_dockerfile_child
(
self
):
includes
=
self
.
exclude
([
'foo/'
],
dockerfile
=
'foo/Dockerfile3'
)
includes
=
self
.
exclude
([
'foo/'
],
dockerfile
=
'foo/Dockerfile3'
)
assert
convert_path
(
'foo/Dockerfile3'
)
in
includes
assert
convert_path
(
'foo/Dockerfile3'
)
in
includes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment