pos3 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl

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.
pos3/__init__.py CHANGED
@@ -142,6 +142,17 @@ def _s3_paths_conflict(left: str, right: str) -> bool:
142
142
  return left_norm.startswith(right_norm + "/") or right_norm.startswith(left_norm + "/")
143
143
 
144
144
 
145
+ def _make_s3_key(prefix: str, info: FileInfo) -> str:
146
+ """Build the canonical S3 key from a prefix and FileInfo, including trailing '/' for directories."""
147
+ if info.relative_path:
148
+ key = prefix + "/" + info.relative_path if prefix else info.relative_path
149
+ else:
150
+ key = prefix
151
+ if info.is_dir and not key.endswith("/"):
152
+ key += "/"
153
+ return key
154
+
155
+
145
156
  def _process_futures(futures, operation: str) -> None:
146
157
  for future in futures:
147
158
  try:
@@ -618,12 +629,12 @@ class _Mirror:
618
629
  )
619
630
 
620
631
  for info in to_copy:
621
- s3_key = prefix + ("/" + info.relative_path if info.relative_path else "")
632
+ s3_key = _make_s3_key(prefix, info)
622
633
  to_put.append((info, local_path, bucket, s3_key, profile))
623
634
  total_bytes += info.size
624
635
 
625
636
  for info in to_delete if delete else []:
626
- s3_key = prefix + ("/" + info.relative_path if info.relative_path else "")
637
+ s3_key = _make_s3_key(prefix, info)
627
638
  to_remove.append((bucket, s3_key, profile))
628
639
 
629
640
  if to_put:
@@ -679,7 +690,7 @@ class _Mirror:
679
690
  total_bytes = 0
680
691
 
681
692
  for info in to_copy:
682
- s3_key = prefix + ("/" + info.relative_path if info.relative_path else "")
693
+ s3_key = _make_s3_key(prefix, info)
683
694
  to_put.append((info, bucket, s3_key, local_path))
684
695
  total_bytes += info.size
685
696
 
@@ -782,7 +793,6 @@ class _Mirror:
782
793
  try:
783
794
  client = self._get_client(profile)
784
795
  if info.is_dir:
785
- key += "/" if not key.endswith("/") else ""
786
796
  client.put_object(Bucket=bucket, Key=key, Body=b"")
787
797
  else:
788
798
  file_path = local_path / info.relative_path if info.relative_path else local_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pos3
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: S3 Simple Sync - Make using S3 as simple as using local files
5
5
  Author-email: Positronic Robotics <hi@positronic.ro>
6
6
  License: Apache-2.0
@@ -0,0 +1,6 @@
1
+ pos3/__init__.py,sha256=clPuf7Qs8GTi8wWxPNEDXMmjxGkYd8on-fYGUPQx5ls,37934
2
+ pos3-0.2.2.dist-info/licenses/LICENSE,sha256=e815_YqPTxHS3WrNI7dotEuLkgHFAgsf9avLhDYBj9s,11354
3
+ pos3-0.2.2.dist-info/METADATA,sha256=ZlcQCpVWamNY-of0jnGibWlgVzS-Bh6ONTQeYxDP1Xo,8637
4
+ pos3-0.2.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
5
+ pos3-0.2.2.dist-info/top_level.txt,sha256=JWOpXHz1F6cbH0nfanGWLaozt8RJFRmv5H3eKkxz7e8,5
6
+ pos3-0.2.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- pos3/__init__.py,sha256=PUaRocvB4EnSoX2boF5VcQ6OCREhySCr0DSIOsgo3l0,37730
2
- pos3-0.2.1.dist-info/licenses/LICENSE,sha256=e815_YqPTxHS3WrNI7dotEuLkgHFAgsf9avLhDYBj9s,11354
3
- pos3-0.2.1.dist-info/METADATA,sha256=Cmm9JAGaEZF5RkYJEnOR1LDQqWy26HevlD3IRYlVz_s,8637
4
- pos3-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- pos3-0.2.1.dist-info/top_level.txt,sha256=JWOpXHz1F6cbH0nfanGWLaozt8RJFRmv5H3eKkxz7e8,5
6
- pos3-0.2.1.dist-info/RECORD,,