python3-cyberfusion-queue-support 1.5__tar.gz → 1.7.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.
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/pyproject.toml +1 -1
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/copy.py +51 -3
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/outcomes.py +17 -3
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/README.md +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/command.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_start.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.7.0}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Library to queue actions.
|
|
5
5
|
Author-email: Cyberfusion <support@cyberfusion.io>
|
|
6
6
|
Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Item."""
|
|
2
2
|
|
|
3
|
+
import difflib
|
|
3
4
|
import logging
|
|
4
5
|
import os
|
|
5
6
|
import shutil
|
|
@@ -35,14 +36,61 @@ class CopyItem(_Item):
|
|
|
35
36
|
if os.path.islink(self.destination):
|
|
36
37
|
raise PathIsSymlinkError(self.destination)
|
|
37
38
|
|
|
39
|
+
def _get_changed_lines(self) -> Optional[List[str]]:
|
|
40
|
+
"""Get differences with destination file.
|
|
41
|
+
|
|
42
|
+
Returns None if the changed_lines could not be determined, for example
|
|
43
|
+
if the destination file is encrypted.
|
|
44
|
+
"""
|
|
45
|
+
changed_lines = []
|
|
46
|
+
|
|
47
|
+
destination_contents = []
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
source_contents = open(self.source).readlines()
|
|
51
|
+
except UnicodeDecodeError:
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
if os.path.isfile(self.destination):
|
|
55
|
+
try:
|
|
56
|
+
destination_contents = open(self.destination).readlines()
|
|
57
|
+
except UnicodeDecodeError:
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
for line in difflib.unified_diff(
|
|
61
|
+
destination_contents,
|
|
62
|
+
source_contents,
|
|
63
|
+
fromfile=self.source,
|
|
64
|
+
tofile=self.destination,
|
|
65
|
+
lineterm="",
|
|
66
|
+
n=0,
|
|
67
|
+
):
|
|
68
|
+
changed_lines.append(line)
|
|
69
|
+
|
|
70
|
+
return changed_lines
|
|
71
|
+
|
|
38
72
|
@property
|
|
39
73
|
def outcomes(self) -> List[CopyItemCopyOutcome]:
|
|
40
74
|
"""Get outcomes of item."""
|
|
41
75
|
outcomes = []
|
|
42
76
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
77
|
+
changed_lines = self._get_changed_lines()
|
|
78
|
+
|
|
79
|
+
if not os.path.exists(self.destination):
|
|
80
|
+
copy = True
|
|
81
|
+
elif changed_lines is None:
|
|
82
|
+
copy = True
|
|
83
|
+
else:
|
|
84
|
+
copy = bool(changed_lines)
|
|
85
|
+
|
|
86
|
+
if copy:
|
|
87
|
+
outcomes.append(
|
|
88
|
+
CopyItemCopyOutcome(
|
|
89
|
+
source=self.source,
|
|
90
|
+
destination=self.destination,
|
|
91
|
+
changed_lines=changed_lines,
|
|
92
|
+
)
|
|
93
|
+
)
|
|
46
94
|
|
|
47
95
|
return outcomes
|
|
48
96
|
|
|
@@ -9,21 +9,35 @@ from cyberfusion.SystemdSupport.units import Unit
|
|
|
9
9
|
class CopyItemCopyOutcome(OutcomeInterface):
|
|
10
10
|
"""Represents outcome."""
|
|
11
11
|
|
|
12
|
-
def __init__(
|
|
12
|
+
def __init__(
|
|
13
|
+
self, *, source: str, destination: str, changed_lines: Optional[list[str]] = None
|
|
14
|
+
) -> None:
|
|
13
15
|
"""Set attributes."""
|
|
14
16
|
self.source = source
|
|
15
17
|
self.destination = destination
|
|
18
|
+
self.changed_lines = changed_lines
|
|
16
19
|
|
|
17
20
|
def __str__(self) -> str:
|
|
18
21
|
"""Get human-readable string."""
|
|
19
|
-
|
|
22
|
+
if self.changed_lines:
|
|
23
|
+
changed_lines = "\nChanged lines:\n" + "\n".join(self.changed_lines)
|
|
24
|
+
else:
|
|
25
|
+
changed_lines = ""
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
f"Copy {self.source} to {self.destination}.{changed_lines}"
|
|
29
|
+
)
|
|
20
30
|
|
|
21
31
|
def __eq__(self, other: object) -> bool:
|
|
22
32
|
"""Get equality based on attributes."""
|
|
23
33
|
if not isinstance(other, CopyItemCopyOutcome):
|
|
24
34
|
return False
|
|
25
35
|
|
|
26
|
-
return
|
|
36
|
+
return (
|
|
37
|
+
other.source == self.source
|
|
38
|
+
and other.destination == self.destination
|
|
39
|
+
and other.changed_lines == self.changed_lines
|
|
40
|
+
)
|
|
27
41
|
|
|
28
42
|
|
|
29
43
|
class MoveItemMoveOutcome(OutcomeInterface):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Library to queue actions.
|
|
5
5
|
Author-email: Cyberfusion <support@cyberfusion.io>
|
|
6
6
|
Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
|
|
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
|