cloud-files 5.6.1__tar.gz → 5.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud_files-5.6.1 → cloud_files-5.8.0}/ChangeLog +11 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/PKG-INFO +1 -1
- {cloud_files-5.6.1 → cloud_files-5.8.0}/automated_test.py +17 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/PKG-INFO +1 -1
- cloud_files-5.8.0/cloud_files.egg-info/pbr.json +1 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles_cli/cloudfiles_cli.py +45 -8
- cloud_files-5.6.1/cloud_files.egg-info/pbr.json +0 -1
- {cloud_files-5.6.1 → cloud_files-5.8.0}/.github/workflows/test-suite.yml +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/AUTHORS +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/LICENSE +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/MANIFEST.in +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/README.md +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/SOURCES.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/dependency_links.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/entry_points.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/not-zip-safe +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/requires.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloud_files.egg-info/top_level.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/__init__.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/cloudfiles.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/compression.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/connectionpools.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/exceptions.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/gcs.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/interfaces.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/lib.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/monitoring.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/paths.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/resumable_tools.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/scheduler.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/secrets.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/test.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/threaded_queue.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles/typing.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles_cli/LICENSE +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/cloudfiles_cli/__init__.py +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/requirements.txt +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/setup.cfg +0 -0
- {cloud_files-5.6.1 → cloud_files-5.8.0}/setup.py +0 -0
|
@@ -876,6 +876,14 @@ def test_cli_cp():
|
|
|
876
876
|
subprocess.run(f"cloudfiles cp {destdir}", shell=True)
|
|
877
877
|
assert not os.path.exists(destdir)
|
|
878
878
|
|
|
879
|
+
for i in range(N):
|
|
880
|
+
touch(os.path.join(srcdir, f"{i}jpg"))
|
|
881
|
+
|
|
882
|
+
mkdir(destdir)
|
|
883
|
+
subprocess.run(f"cloudfiles cp {srcdir}/*jpg {destdir}", shell=True)
|
|
884
|
+
assert len(os.listdir(destdir)) == N
|
|
885
|
+
shutil.rmtree(destdir)
|
|
886
|
+
|
|
879
887
|
try:
|
|
880
888
|
shutil.rmtree(srcdir)
|
|
881
889
|
except FileNotFoundError:
|
|
@@ -1033,6 +1041,15 @@ def test_cli_rm_shell():
|
|
|
1033
1041
|
subprocess.run(["cloudfiles", "rm", "./cloudfiles-deletable-test-file"])
|
|
1034
1042
|
assert not os.path.exists("./cloudfiles-deletable-test-file")
|
|
1035
1043
|
|
|
1044
|
+
mkfiles()
|
|
1045
|
+
for i in range(N):
|
|
1046
|
+
touch(os.path.join(test_dir, f"{i}.jpg"))
|
|
1047
|
+
|
|
1048
|
+
assert len(os.listdir(test_dir)) == N * 2
|
|
1049
|
+
subprocess.run(["cloudfiles", "rm", test_dir + "/*.jpg"])
|
|
1050
|
+
res = set([ str(_) for _ in range(N) ])
|
|
1051
|
+
assert set(os.listdir(test_dir)) == res
|
|
1052
|
+
|
|
1036
1053
|
try:
|
|
1037
1054
|
shutil.rmtree(test_dir)
|
|
1038
1055
|
except FileNotFoundError:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "9e3fa7f", "is_release": true}
|
|
@@ -97,7 +97,7 @@ def ls(shortpath, flat, expr, cloudpath, no_auth):
|
|
|
97
97
|
if no_auth and 's3://' not in cloudpath:
|
|
98
98
|
cloudpath = cloudfiles.paths.to_https_protocol(cloudpath)
|
|
99
99
|
|
|
100
|
-
_, flt, prefix = get_mfp(cloudpath, True)
|
|
100
|
+
_, flt, prefix, suffix = get_mfp(cloudpath, True)
|
|
101
101
|
epath = extract(cloudpath)
|
|
102
102
|
if len(epath.path) > 0:
|
|
103
103
|
if prefix == "" and flt == False:
|
|
@@ -128,6 +128,10 @@ def ls(shortpath, flat, expr, cloudpath, no_auth):
|
|
|
128
128
|
iterables = [ cf.list(prefix=prefix, flat=flat) ]
|
|
129
129
|
|
|
130
130
|
iterables = itertools.chain(*iterables)
|
|
131
|
+
|
|
132
|
+
if suffix:
|
|
133
|
+
iterables = ( x for x in iterables if x.endswith(suffix) )
|
|
134
|
+
|
|
131
135
|
for pathset in sip(iterables, 1000):
|
|
132
136
|
if not shortpath:
|
|
133
137
|
pathset = [ cloudpathjoin(cloudpath, pth) for pth in pathset ]
|
|
@@ -152,6 +156,7 @@ def exprgen(prefix, matches):
|
|
|
152
156
|
|
|
153
157
|
return finished_prefixes
|
|
154
158
|
|
|
159
|
+
SUFFIX_REGEXP = re.compile(r'\*([\w\d\-\._]+)$')
|
|
155
160
|
|
|
156
161
|
def get_mfp(path, recursive):
|
|
157
162
|
"""many,flat,prefix"""
|
|
@@ -159,6 +164,13 @@ def get_mfp(path, recursive):
|
|
|
159
164
|
flat = not recursive
|
|
160
165
|
many = recursive
|
|
161
166
|
prefix = ""
|
|
167
|
+
suffix = ""
|
|
168
|
+
|
|
169
|
+
matches = SUFFIX_REGEXP.search(path)
|
|
170
|
+
if matches is not None:
|
|
171
|
+
suffix = matches.groups()[0]
|
|
172
|
+
path = path.removesuffix(suffix)
|
|
173
|
+
|
|
162
174
|
if path[-2:] == "**":
|
|
163
175
|
many = True
|
|
164
176
|
flat = False
|
|
@@ -168,7 +180,20 @@ def get_mfp(path, recursive):
|
|
|
168
180
|
flat = True
|
|
169
181
|
prefix = os.path.basename(path[:-1])
|
|
170
182
|
|
|
171
|
-
return (many, flat, prefix)
|
|
183
|
+
return (many, flat, prefix, suffix)
|
|
184
|
+
|
|
185
|
+
@main.command("mkdir")
|
|
186
|
+
@click.argument("paths", nargs=-1)
|
|
187
|
+
def _mkdir(paths):
|
|
188
|
+
"""
|
|
189
|
+
Create paths on the local file system.
|
|
190
|
+
"""
|
|
191
|
+
for path in paths:
|
|
192
|
+
path = normalize_path(path)
|
|
193
|
+
protocol = get_protocol(path)
|
|
194
|
+
|
|
195
|
+
if protocol == "file":
|
|
196
|
+
mkdir(path.replace("file://", "", 1))
|
|
172
197
|
|
|
173
198
|
@main.command()
|
|
174
199
|
@click.argument("source", nargs=-1)
|
|
@@ -267,7 +292,7 @@ def _cp_single(
|
|
|
267
292
|
|
|
268
293
|
# The else clause here is to handle single file transfers
|
|
269
294
|
srcpath = nsrc if issrcdir else os.path.dirname(nsrc)
|
|
270
|
-
many, flat, prefix = get_mfp(nsrc, recursive)
|
|
295
|
+
many, flat, prefix, suffix = get_mfp(nsrc, recursive)
|
|
271
296
|
|
|
272
297
|
if issrcdir and not many:
|
|
273
298
|
print(f"cloudfiles: {source} is a directory (not copied).")
|
|
@@ -302,6 +327,9 @@ def _cp_single(
|
|
|
302
327
|
compression = False
|
|
303
328
|
|
|
304
329
|
if not isinstance(xferpaths, str):
|
|
330
|
+
if suffix:
|
|
331
|
+
xferpaths = ( x for x in xferpaths if x.endswith(suffix) )
|
|
332
|
+
|
|
305
333
|
if parallel == 1:
|
|
306
334
|
_cp(
|
|
307
335
|
srcpath, destpath, compression,
|
|
@@ -494,7 +522,7 @@ def _mv_single(
|
|
|
494
522
|
|
|
495
523
|
# The else clause here is to handle single file transfers
|
|
496
524
|
srcpath = nsrc if issrcdir else os.path.dirname(nsrc)
|
|
497
|
-
many, flat, prefix = get_mfp(nsrc, recursive)
|
|
525
|
+
many, flat, prefix, suffix = get_mfp(nsrc, recursive)
|
|
498
526
|
|
|
499
527
|
if issrcdir and not many:
|
|
500
528
|
print(f"cloudfiles: {source} is a directory (not copied).")
|
|
@@ -524,6 +552,9 @@ def _mv_single(
|
|
|
524
552
|
return
|
|
525
553
|
|
|
526
554
|
if not isinstance(xferpaths, str):
|
|
555
|
+
if suffix:
|
|
556
|
+
xferpaths = ( x for x in xferpaths if x.endswith(suffix) )
|
|
557
|
+
|
|
527
558
|
if parallel == 1:
|
|
528
559
|
_mv(srcpath, destpath, progress, block_size, part_bytes, no_sign_request, xferpaths)
|
|
529
560
|
return
|
|
@@ -570,6 +601,7 @@ def touch(
|
|
|
570
601
|
ctx, sources,
|
|
571
602
|
progress, no_sign_request,
|
|
572
603
|
):
|
|
604
|
+
"""Create file if it doesn't exist."""
|
|
573
605
|
sources = list(map(normalize_path, sources))
|
|
574
606
|
sources = [ src.replace("precomputed://", "") for src in sources ]
|
|
575
607
|
pbar = tqdm(total=len(sources), desc="Touch", disable=(not progress))
|
|
@@ -701,7 +733,7 @@ def rm(ctx, paths, recursive, progress, block_size):
|
|
|
701
733
|
singles = []
|
|
702
734
|
multiples = []
|
|
703
735
|
for path in paths:
|
|
704
|
-
many, flat, prefix = get_mfp(path, recursive)
|
|
736
|
+
many, flat, prefix, suffix = get_mfp(path, recursive)
|
|
705
737
|
if ispathdir(path) and not many:
|
|
706
738
|
print(f"cloudfiles: {path}: is a directory.")
|
|
707
739
|
return
|
|
@@ -742,13 +774,15 @@ def _rm_many(path, recursive, progress, parallel, block_size):
|
|
|
742
774
|
isdir = (ispathdir(path) or CloudFiles(npath).isdir())
|
|
743
775
|
recursive = recursive and isdir
|
|
744
776
|
|
|
745
|
-
many, flat, prefix = get_mfp(path, recursive)
|
|
777
|
+
many, flat, prefix, suffix = get_mfp(path, recursive)
|
|
746
778
|
|
|
747
779
|
cfpath = npath if isdir else os.path.dirname(npath)
|
|
748
780
|
xferpaths = os.path.basename(npath)
|
|
749
781
|
|
|
750
782
|
if many:
|
|
751
783
|
xferpaths = CloudFiles(cfpath).list(prefix=prefix, flat=flat)
|
|
784
|
+
if suffix:
|
|
785
|
+
xferpaths = ( x for x in xferpaths if x.endswith(suffix) )
|
|
752
786
|
|
|
753
787
|
if parallel == 1 or not many:
|
|
754
788
|
__rm(cfpath, progress, xferpaths)
|
|
@@ -825,10 +859,13 @@ def head(paths):
|
|
|
825
859
|
for path in paths:
|
|
826
860
|
npath = normalize_path(path)
|
|
827
861
|
npath = re.sub(r'\*+$', '', path)
|
|
828
|
-
many, flat, prefix = get_mfp(path, False)
|
|
862
|
+
many, flat, prefix, suffix = get_mfp(path, False)
|
|
829
863
|
if many:
|
|
830
864
|
cf = CloudFiles(npath)
|
|
831
|
-
|
|
865
|
+
lst = cf.list(prefix=prefix, flat=flat)
|
|
866
|
+
if suffix:
|
|
867
|
+
lst = ( x for x in lst if x.endswith(suffix) )
|
|
868
|
+
res = cf.head(lst)
|
|
832
869
|
results.update(res)
|
|
833
870
|
else:
|
|
834
871
|
cf = CloudFiles(os.path.dirname(npath))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "5554b92", "is_release": true}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|