python3-cyberfusion-queue-support 1.5__tar.gz → 1.6__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.6}/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/pyproject.toml +1 -1
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/copy.py +37 -3
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/outcomes.py +14 -3
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/README.md +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/command.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_start.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
- {python3_cyberfusion_queue_support-1.5 → python3_cyberfusion_queue_support-1.6}/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.6
|
|
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,47 @@ 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) -> List[str]:
|
|
40
|
+
"""Get differences with destination file.
|
|
41
|
+
|
|
42
|
+
No differences are returned when contents is not string.
|
|
43
|
+
"""
|
|
44
|
+
changed_lines = []
|
|
45
|
+
|
|
46
|
+
contents = []
|
|
47
|
+
|
|
48
|
+
if os.path.isfile(self.destination):
|
|
49
|
+
contents = open(self.destination).readlines()
|
|
50
|
+
|
|
51
|
+
source_contents = open(self.source).readlines()
|
|
52
|
+
|
|
53
|
+
for line in difflib.unified_diff(
|
|
54
|
+
contents,
|
|
55
|
+
source_contents,
|
|
56
|
+
fromfile=self.source,
|
|
57
|
+
tofile=self.destination,
|
|
58
|
+
lineterm="",
|
|
59
|
+
n=0,
|
|
60
|
+
):
|
|
61
|
+
changed_lines.append(line)
|
|
62
|
+
|
|
63
|
+
return changed_lines
|
|
64
|
+
|
|
38
65
|
@property
|
|
39
66
|
def outcomes(self) -> List[CopyItemCopyOutcome]:
|
|
40
67
|
"""Get outcomes of item."""
|
|
41
68
|
outcomes = []
|
|
42
69
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
70
|
+
changed_lines = self._get_changed_lines()
|
|
71
|
+
|
|
72
|
+
if not os.path.exists(self.destination) or changed_lines:
|
|
73
|
+
outcomes.append(
|
|
74
|
+
CopyItemCopyOutcome(
|
|
75
|
+
source=self.source,
|
|
76
|
+
destination=self.destination,
|
|
77
|
+
changed_lines=changed_lines,
|
|
78
|
+
)
|
|
79
|
+
)
|
|
46
80
|
|
|
47
81
|
return outcomes
|
|
48
82
|
|
|
@@ -9,21 +9,32 @@ 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: list[str]
|
|
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
|
+
changed_lines = "\n".join(self.changed_lines)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
f"Copy {self.source} to {self.destination}.\nChanged_lines:\n{changed_lines}"
|
|
26
|
+
)
|
|
20
27
|
|
|
21
28
|
def __eq__(self, other: object) -> bool:
|
|
22
29
|
"""Get equality based on attributes."""
|
|
23
30
|
if not isinstance(other, CopyItemCopyOutcome):
|
|
24
31
|
return False
|
|
25
32
|
|
|
26
|
-
return
|
|
33
|
+
return (
|
|
34
|
+
other.source == self.source
|
|
35
|
+
and other.destination == self.destination
|
|
36
|
+
and other.changed_lines == self.changed_lines
|
|
37
|
+
)
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
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.6
|
|
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
|