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
d798afca
Kaydet (Commit)
d798afca
authored
Tem 03, 2017
tarafından
Jakub Goszczurny
Kaydeden (comit)
Joffrey F
Agu 01, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Generating regexp from .dockerignore file in a similar way as docker-ce.
Signed-off-by:
Jakub Goszczurny
<
szczurmys@o2.pl
>
üst
c2925a38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
fnmatch.py
docker/utils/fnmatch.py
+19
-8
utils_test.py
tests/unit/utils_test.py
+25
-0
No files found.
docker/utils/fnmatch.py
Dosyayı görüntüle @
d798afca
...
...
@@ -65,19 +65,32 @@ def translate(pat):
There is no way to quote meta-characters.
"""
recursive_mode
=
False
i
,
n
=
0
,
len
(
pat
)
res
=
''
res
=
'
^
'
while
i
<
n
:
c
=
pat
[
i
]
i
=
i
+
1
if
c
==
'*'
:
if
i
<
n
and
pat
[
i
]
==
'*'
:
recursive_mode
=
True
# is some flavor of "**"
i
=
i
+
1
res
=
res
+
'.*'
# Treat **/ as ** so eat the "/"
if
pat
[
i
]
==
'/'
:
i
=
i
+
1
if
i
>=
n
:
# is "**EOF" - to align with .gitignore just accept all
res
=
res
+
'.*'
else
:
# is "**"
# Note that this allows for any # of /'s (even 0) because
# the .* will eat everything, even /'s
res
=
res
+
'(.*/)?'
else
:
# is "*" so map it to anything but "/"
res
=
res
+
'[^/]*'
elif
c
==
'?'
:
res
=
res
+
'.'
# "?" is any char except "/"
res
=
res
+
'[^/]'
elif
c
==
'['
:
j
=
i
if
j
<
n
and
pat
[
j
]
==
'!'
:
...
...
@@ -96,8 +109,6 @@ def translate(pat):
elif
stuff
[
0
]
==
'^'
:
stuff
=
'
\\
'
+
stuff
res
=
'
%
s[
%
s]'
%
(
res
,
stuff
)
elif
recursive_mode
and
c
==
'/'
:
res
=
res
+
re
.
escape
(
c
)
+
'?'
else
:
res
=
res
+
re
.
escape
(
c
)
return
res
+
'
\
Z(?ms)
'
return
res
+
'
$
'
tests/unit/utils_test.py
Dosyayı görüntüle @
d798afca
...
...
@@ -639,6 +639,14 @@ class ExcludePathsTest(unittest.TestCase):
'foo'
,
'foo/bar'
,
'bar'
,
'target'
,
'target/subdir'
,
'subdir'
,
'subdir/target'
,
'subdir/target/subdir'
,
'subdir/subdir2'
,
'subdir/subdir2/target'
,
'subdir/subdir2/target/subdir'
]
files
=
[
...
...
@@ -654,6 +662,14 @@ class ExcludePathsTest(unittest.TestCase):
'foo/bar/a.py'
,
'bar/a.py'
,
'foo/Dockerfile3'
,
'target/file.txt'
,
'target/subdir/file.txt'
,
'subdir/file.txt'
,
'subdir/target/file.txt'
,
'subdir/target/subdir/file.txt'
,
'subdir/subdir2/file.txt'
,
'subdir/subdir2/target/file.txt'
,
'subdir/subdir2/target/subdir/file.txt'
,
]
all_paths
=
set
(
dirs
+
files
)
...
...
@@ -844,6 +860,15 @@ class ExcludePathsTest(unittest.TestCase):
self
.
all_paths
-
set
([
'foo/bar'
,
'foo/bar/a.py'
])
)
def
test_single_and_double_wildcard
(
self
):
assert
self
.
exclude
([
'**/target/*/*'
])
==
convert_paths
(
self
.
all_paths
-
set
(
[
'target/subdir/file.txt'
,
'subdir/target/subdir/file.txt'
,
'subdir/subdir2/target/subdir/file.txt'
]
)
)
class
TarTest
(
unittest
.
TestCase
):
def
test_tar_with_excludes
(
self
):
...
...
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