python3-cyberfusion-file-support 1.5__tar.gz → 1.6.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.
Files changed (12) hide show
  1. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/PKG-INFO +1 -1
  2. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/pyproject.toml +1 -1
  3. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/cyberfusion/FileSupport/__init__.py +22 -9
  4. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/python3_cyberfusion_file_support.egg-info/PKG-INFO +1 -1
  5. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/README.md +0 -0
  6. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/setup.cfg +0 -0
  7. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/cyberfusion/FileSupport/encryption.py +0 -0
  8. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/cyberfusion/FileSupport/exceptions.py +0 -0
  9. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/python3_cyberfusion_file_support.egg-info/SOURCES.txt +0 -0
  10. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/python3_cyberfusion_file_support.egg-info/dependency_links.txt +0 -0
  11. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/python3_cyberfusion_file_support.egg-info/requires.txt +0 -0
  12. {python3_cyberfusion_file_support-1.5 → python3_cyberfusion_file_support-1.6.0}/src/python3_cyberfusion_file_support.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-cyberfusion-file-support
3
- Version: 1.5
3
+ Version: 1.6.0
4
4
  Summary: Library for idempotent writing to files.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-file-support
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-cyberfusion-file-support"
7
- version = "1.5"
7
+ version = "1.6.0"
8
8
  description = "Library for idempotent writing to files."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -123,18 +123,35 @@ class DestinationFileReplacement:
123
123
  with open(path, open_mode) as f:
124
124
  f.write(contents)
125
125
 
126
+ @property
127
+ def _copy_item(self) -> CopyItem:
128
+ """Get copy item."""
129
+ return CopyItem(
130
+ source=self.tmp_path,
131
+ destination=self.destination_file.path,
132
+ reference=self.reference,
133
+ )
134
+
135
+ @property
136
+ def changed(self) -> bool:
137
+ """Check if the destination file content has changed."""
138
+ if self.encryption_properties:
139
+ decrypted_contents = self.destination_file.decrypt()
140
+
141
+ return decrypted_contents != self.contents
142
+
143
+ return bool(self._copy_item.outcomes)
144
+
126
145
  def add_to_queue(self) -> None:
127
146
  """Add items for replacement to queue."""
128
147
  add_copy_item = True
129
148
 
130
- decrypted_contents = self.destination_file.decrypt()
131
-
132
149
  # If encrypted, only add CopyItem when unencrypted contents changed.
133
150
  # CopyItem does not account for encryption, so without this check the
134
151
  # file would always be copied.
135
152
 
136
- if decrypted_contents:
137
- add_copy_item = decrypted_contents != self.contents
153
+ if self.encryption_properties:
154
+ add_copy_item = self.changed
138
155
 
139
156
  # Copy and unlink instead of move. MoveItem copies metadata (which
140
157
  # means mode etc. of destination file is incorrect, as set to the tmp
@@ -143,11 +160,7 @@ class DestinationFileReplacement:
143
160
  # is unchanged.
144
161
 
145
162
  if add_copy_item:
146
- copy_item = CopyItem(
147
- source=self.tmp_path,
148
- destination=self.destination_file.path,
149
- reference=self.reference,
150
- )
163
+ copy_item = self._copy_item
151
164
 
152
165
  self.queue.add(copy_item)
153
166
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-cyberfusion-file-support
3
- Version: 1.5
3
+ Version: 1.6.0
4
4
  Summary: Library for idempotent writing to files.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-file-support