python3-cyberfusion-queue-support 1.1.1.2__tar.gz → 1.1.4__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 (30) hide show
  1. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/PKG-INFO +4 -11
  2. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/README.md +0 -6
  3. python3_cyberfusion_queue_support-1.1.4/pyproject.toml +18 -0
  4. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/__init__.py +1 -3
  5. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/interfaces.py +1 -1
  6. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/chmod.py +4 -13
  7. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/chown.py +17 -27
  8. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/command.py +17 -23
  9. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/copy.py +6 -15
  10. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/mkdir.py +4 -9
  11. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/move.py +6 -15
  12. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +4 -12
  13. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +5 -14
  14. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +4 -11
  15. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +4 -10
  16. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +4 -10
  17. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +4 -11
  18. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/unlink.py +4 -9
  19. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/outcomes.py +6 -12
  20. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +4 -11
  21. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +0 -1
  22. python3-cyberfusion-queue-support-1.1.1.2/pyproject.toml +0 -21
  23. python3-cyberfusion-queue-support-1.1.1.2/setup.py +0 -28
  24. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/setup.cfg +0 -0
  25. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
  26. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
  27. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/utilities.py +0 -0
  28. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
  29. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
  30. {python3-cyberfusion-queue-support-1.1.1.2 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-cyberfusion-queue-support
3
- Version: 1.1.1.2
3
+ Version: 1.1.4
4
4
  Summary: Library to queue actions.
5
- Home-page: https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
6
- Author: Cyberfusion
7
- Author-email: support@cyberfusion.io
8
- Platform: linux
5
+ Author-email: Cyberfusion <support@cyberfusion.io>
6
+ Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
9
7
  Description-Content-Type: text/markdown
8
+ Requires-Dist: python3-cyberfusion-systemd-support~=1.0
10
9
 
11
10
  # python3-cyberfusion-queue-support
12
11
 
@@ -20,12 +19,6 @@ Run the following command to install the package from PyPI:
20
19
 
21
20
  pip3 install python3-cyberfusion-queue-support
22
21
 
23
- ## Generic
24
-
25
- Run the following command to create a source distribution:
26
-
27
- python3 setup.py sdist
28
-
29
22
  ## Debian
30
23
 
31
24
  Run the following commands to build a Debian package:
@@ -10,12 +10,6 @@ Run the following command to install the package from PyPI:
10
10
 
11
11
  pip3 install python3-cyberfusion-queue-support
12
12
 
13
- ## Generic
14
-
15
- Run the following command to create a source distribution:
16
-
17
- python3 setup.py sdist
18
-
19
13
  ## Debian
20
14
 
21
15
  Run the following commands to build a Debian package:
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "python3-cyberfusion-queue-support"
7
+ version = "1.1.4"
8
+ description = "Library to queue actions."
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Cyberfusion", email = "support@cyberfusion.io" },
12
+ ]
13
+ dependencies = [
14
+ "python3-cyberfusion-systemd-support~=1.0",
15
+ ]
16
+
17
+ [project.urls]
18
+ "Source" = "https://github.com/CyberfusionIO/python3-cyberfusion-queue-support"
@@ -22,9 +22,7 @@ class Queue:
22
22
  if item not in self.items:
23
23
  self.items.append(item)
24
24
 
25
- logger.info(
26
- "Added item to queue (reference: '%s')", item.reference
27
- )
25
+ logger.info("Added item to queue (reference: '%s')", item.reference)
28
26
  else:
29
27
  # If item already in queue, move to last place
30
28
 
@@ -24,7 +24,7 @@ class ItemInterface(metaclass=ABCMeta):
24
24
  @property
25
25
  @abstractmethod
26
26
  def outcomes(self) -> List[OutcomeInterface]: # pragma: no cover
27
- """Get outcomes of calling self.fulfill."""
27
+ """Get outcomes of item."""
28
28
  pass
29
29
 
30
30
  @abstractmethod
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import ChmodItemModeChangeOutcome
11
10
  from cyberfusion.QueueSupport.utilities import get_decimal_permissions
@@ -34,8 +33,8 @@ class ChmodItem(_Item):
34
33
  raise PathIsSymlinkError(self.path)
35
34
 
36
35
  @property
37
- def outcomes(self) -> List[OutcomeInterface]:
38
- """Get outcomes of calling self.fulfill."""
36
+ def outcomes(self) -> List[ChmodItemModeChangeOutcome]:
37
+ """Get outcomes of item."""
39
38
  outcomes = []
40
39
 
41
40
  if not os.path.exists(self.path):
@@ -59,16 +58,8 @@ class ChmodItem(_Item):
59
58
 
60
59
  def fulfill(self) -> None:
61
60
  """Fulfill outcomes."""
62
- mode_change_outcomes = [
63
- x
64
- for x in self.outcomes
65
- if isinstance(x, ChmodItemModeChangeOutcome)
66
- ]
67
-
68
- if mode_change_outcomes:
69
- os.chmod(
70
- mode_change_outcomes[0].path, mode_change_outcomes[0].new_mode
71
- )
61
+ for outcome in self.outcomes:
62
+ os.chmod(outcome.path, outcome.new_mode)
72
63
 
73
64
  def __eq__(self, other: object) -> bool:
74
65
  """Get equality based on attributes."""
@@ -9,7 +9,6 @@ from pwd import getpwuid
9
9
  from typing import List, Optional
10
10
 
11
11
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
12
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
13
12
  from cyberfusion.QueueSupport.items import _Item
14
13
  from cyberfusion.QueueSupport.outcomes import (
15
14
  ChownItemGroupChangeOutcome,
@@ -52,8 +51,10 @@ class ChownItem(_Item):
52
51
  raise PathIsSymlinkError(self.path)
53
52
 
54
53
  @property
55
- def outcomes(self) -> List[OutcomeInterface]:
56
- """Get outcomes of calling self.fulfill."""
54
+ def outcomes(
55
+ self,
56
+ ) -> List[ChownItemOwnerChangeOutcome | ChownItemGroupChangeOutcome]:
57
+ """Get outcomes of item."""
57
58
  outcomes = []
58
59
 
59
60
  if not os.path.exists(self.path):
@@ -107,30 +108,19 @@ class ChownItem(_Item):
107
108
 
108
109
  def fulfill(self) -> None:
109
110
  """Fulfill outcomes."""
110
- owner_name_change_outcomes = [
111
- x
112
- for x in self.outcomes
113
- if isinstance(x, ChownItemOwnerChangeOutcome)
114
- ]
115
- group_name_change_outcomes = [
116
- x
117
- for x in self.outcomes
118
- if isinstance(x, ChownItemGroupChangeOutcome)
119
- ]
120
-
121
- if owner_name_change_outcomes:
122
- os.chown(
123
- owner_name_change_outcomes[0].path,
124
- uid=get_uid(owner_name_change_outcomes[0].new_owner_name),
125
- gid=-1,
126
- )
127
-
128
- if group_name_change_outcomes:
129
- os.chown(
130
- group_name_change_outcomes[0].path,
131
- uid=-1,
132
- gid=get_gid(group_name_change_outcomes[0].new_group_name),
133
- )
111
+ for outcome in self.outcomes:
112
+ if isinstance(outcome, ChownItemOwnerChangeOutcome):
113
+ os.chown(
114
+ outcome.path,
115
+ uid=get_uid(outcome.new_owner_name),
116
+ gid=-1,
117
+ )
118
+ else:
119
+ os.chown(
120
+ outcome.path,
121
+ uid=-1,
122
+ gid=get_gid(outcome.new_group_name),
123
+ )
134
124
 
135
125
  def __eq__(self, other: object) -> bool:
136
126
  """Get equality based on attributes."""
@@ -5,7 +5,6 @@ import subprocess
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import CommandQueueFulfillFailed
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import CommandItemRunOutcome
11
10
 
@@ -28,8 +27,8 @@ class CommandItem(_Item):
28
27
  self._hide_outcomes = hide_outcomes
29
28
 
30
29
  @property
31
- def outcomes(self) -> List[OutcomeInterface]:
32
- """Get outcomes of calling self.fulfill."""
30
+ def outcomes(self) -> List[CommandItemRunOutcome]:
31
+ """Get outcomes of item."""
33
32
  outcomes = []
34
33
 
35
34
  outcomes.append(CommandItemRunOutcome(command=self.command))
@@ -38,26 +37,21 @@ class CommandItem(_Item):
38
37
 
39
38
  def fulfill(self) -> None:
40
39
  """Fulfill outcomes."""
41
- run_outcomes = [
42
- x for x in self.outcomes if isinstance(x, CommandItemRunOutcome)
43
- ]
44
-
45
- command = run_outcomes[0].command
46
-
47
- try:
48
- output = subprocess.run(
49
- command,
50
- check=True,
51
- text=True,
52
- capture_output=True,
53
- )
54
-
55
- logger.info("Command stdout: %s", output.stdout)
56
- logger.info("Command stderr: %s", output.stderr)
57
- except subprocess.CalledProcessError as e:
58
- raise CommandQueueFulfillFailed(
59
- self, command=command, stdout=e.stdout, stderr=e.stderr
60
- ) from e
40
+ for outcome in self.outcomes:
41
+ try:
42
+ output = subprocess.run(
43
+ outcome.command,
44
+ check=True,
45
+ text=True,
46
+ capture_output=True,
47
+ )
48
+
49
+ logger.info("Command stdout: %s", output.stdout)
50
+ logger.info("Command stderr: %s", output.stderr)
51
+ except subprocess.CalledProcessError as e:
52
+ raise CommandQueueFulfillFailed(
53
+ self, command=outcome.command, stdout=e.stdout, stderr=e.stderr
54
+ ) from e
61
55
 
62
56
  def __eq__(self, other: object) -> bool:
63
57
  """Get equality based on attributes."""
@@ -6,7 +6,6 @@ import shutil
6
6
  from typing import List, Optional
7
7
 
8
8
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
9
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
10
9
  from cyberfusion.QueueSupport.items import _Item
11
10
  from cyberfusion.QueueSupport.outcomes import CopyItemCopyOutcome
12
11
 
@@ -37,32 +36,24 @@ class CopyItem(_Item):
37
36
  raise PathIsSymlinkError(self.destination)
38
37
 
39
38
  @property
40
- def outcomes(self) -> List[OutcomeInterface]:
41
- """Get outcomes of calling self.fulfill."""
39
+ def outcomes(self) -> List[CopyItemCopyOutcome]:
40
+ """Get outcomes of item."""
42
41
  outcomes = []
43
42
 
44
43
  outcomes.append(
45
- CopyItemCopyOutcome(
46
- source=self.source, destination=self.destination
47
- )
44
+ CopyItemCopyOutcome(source=self.source, destination=self.destination)
48
45
  )
49
46
 
50
47
  return outcomes
51
48
 
52
49
  def fulfill(self) -> None:
53
50
  """Fulfill outcomes."""
54
- copy_outcomes = [
55
- x for x in self.outcomes if isinstance(x, CopyItemCopyOutcome)
56
- ]
57
-
58
- shutil.copyfile(copy_outcomes[0].source, copy_outcomes[0].destination)
51
+ for outcome in self.outcomes:
52
+ shutil.copyfile(outcome.source, outcome.destination)
59
53
 
60
54
  def __eq__(self, other: object) -> bool:
61
55
  """Get equality based on attributes."""
62
56
  if not isinstance(other, CopyItem):
63
57
  return False
64
58
 
65
- return (
66
- other.source == self.source
67
- and other.destination == self.destination
68
- )
59
+ return other.source == self.source and other.destination == self.destination
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import MkdirItemCreateOutcome
11
10
 
@@ -31,8 +30,8 @@ class MkdirItem(_Item):
31
30
  raise PathIsSymlinkError(self.path)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[MkdirItemCreateOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if not os.path.isdir(self.path):
@@ -46,12 +45,8 @@ class MkdirItem(_Item):
46
45
 
47
46
  def fulfill(self) -> None:
48
47
  """Fulfill outcomes."""
49
- create_outcomes = [
50
- x for x in self.outcomes if isinstance(x, MkdirItemCreateOutcome)
51
- ]
52
-
53
- if create_outcomes:
54
- os.mkdir(create_outcomes[0].path)
48
+ for outcome in self.outcomes:
49
+ os.mkdir(outcome.path)
55
50
 
56
51
  def __eq__(self, other: object) -> bool:
57
52
  """Get equality based on attributes."""
@@ -6,7 +6,6 @@ import shutil
6
6
  from typing import List, Optional
7
7
 
8
8
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
9
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
10
9
  from cyberfusion.QueueSupport.items import _Item
11
10
  from cyberfusion.QueueSupport.outcomes import MoveItemMoveOutcome
12
11
 
@@ -37,32 +36,24 @@ class MoveItem(_Item):
37
36
  raise PathIsSymlinkError(self.destination)
38
37
 
39
38
  @property
40
- def outcomes(self) -> List[OutcomeInterface]:
41
- """Get outcomes of calling self.fulfill."""
39
+ def outcomes(self) -> List[MoveItemMoveOutcome]:
40
+ """Get outcomes of item."""
42
41
  outcomes = []
43
42
 
44
43
  outcomes.append(
45
- MoveItemMoveOutcome(
46
- source=self.source, destination=self.destination
47
- )
44
+ MoveItemMoveOutcome(source=self.source, destination=self.destination)
48
45
  )
49
46
 
50
47
  return outcomes
51
48
 
52
49
  def fulfill(self) -> None:
53
50
  """Fulfill outcomes."""
54
- move_outcomes = [
55
- x for x in self.outcomes if isinstance(x, MoveItemMoveOutcome)
56
- ]
57
-
58
- shutil.move(move_outcomes[0].source, move_outcomes[0].destination)
51
+ for outcome in self.outcomes:
52
+ shutil.move(outcome.source, outcome.destination)
59
53
 
60
54
  def __eq__(self, other: object) -> bool:
61
55
  """Get equality based on attributes."""
62
56
  if not isinstance(other, MoveItem):
63
57
  return False
64
58
 
65
- return (
66
- other.source == self.source
67
- and other.destination == self.destination
68
- )
59
+ return other.source == self.source and other.destination == self.destination
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdTmpFilesCreateItemCreateOutcome,
@@ -29,8 +28,8 @@ class SystemdTmpFilesCreateItem(_Item):
29
28
  self._hide_outcomes = hide_outcomes
30
29
 
31
30
  @property
32
- def outcomes(self) -> List[OutcomeInterface]:
33
- """Get outcomes of calling self.fulfill."""
31
+ def outcomes(self) -> List[SystemdTmpFilesCreateItemCreateOutcome]:
32
+ """Get outcomes of item."""
34
33
  outcomes = []
35
34
 
36
35
  outcomes.append(SystemdTmpFilesCreateItemCreateOutcome(path=self.path))
@@ -39,15 +38,8 @@ class SystemdTmpFilesCreateItem(_Item):
39
38
 
40
39
  def fulfill(self) -> None:
41
40
  """Fulfill outcomes."""
42
- systemd_tmp_files_create_outcomes = [
43
- x
44
- for x in self.outcomes
45
- if isinstance(x, SystemdTmpFilesCreateItemCreateOutcome)
46
- ]
47
-
48
- TmpFileConfigurationFile(
49
- systemd_tmp_files_create_outcomes[0].path
50
- ).create()
41
+ for outcome in self.outcomes:
42
+ TmpFileConfigurationFile(outcome.path).create()
51
43
 
52
44
  def __eq__(self, other: object) -> bool:
53
45
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitDisableItemDisableOutcome,
@@ -31,27 +30,19 @@ class SystemdUnitDisableItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitDisableItemDisableOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if self.unit.is_enabled:
39
- outcomes.append(
40
- SystemdUnitDisableItemDisableOutcome(unit=self.unit)
41
- )
38
+ outcomes.append(SystemdUnitDisableItemDisableOutcome(unit=self.unit))
42
39
 
43
40
  return outcomes
44
41
 
45
42
  def fulfill(self) -> None:
46
43
  """Fulfill outcomes."""
47
- systemd_unit_disable_outcomes = [
48
- x
49
- for x in self.outcomes
50
- if isinstance(x, SystemdUnitDisableItemDisableOutcome)
51
- ]
52
-
53
- if systemd_unit_disable_outcomes:
54
- systemd_unit_disable_outcomes[0].unit.disable()
44
+ for outcome in self.outcomes:
45
+ outcome.unit.disable()
55
46
 
56
47
  def __eq__(self, other: object) -> bool:
57
48
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitEnableItemEnableOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitEnableItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitEnableItemEnableOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if not self.unit.is_enabled:
@@ -42,14 +41,8 @@ class SystemdUnitEnableItem(_Item):
42
41
 
43
42
  def fulfill(self) -> None:
44
43
  """Fulfill outcomes."""
45
- systemd_unit_enable_outcomes = [
46
- x
47
- for x in self.outcomes
48
- if isinstance(x, SystemdUnitEnableItemEnableOutcome)
49
- ]
50
-
51
- if systemd_unit_enable_outcomes:
52
- systemd_unit_enable_outcomes[0].unit.enable()
44
+ for outcome in self.outcomes:
45
+ outcome.unit.enable()
53
46
 
54
47
  def __eq__(self, other: object) -> bool:
55
48
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitReloadItemReloadOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitReloadItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitReloadItemReloadOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  outcomes.append(SystemdUnitReloadItemReloadOutcome(unit=self.unit))
@@ -41,13 +40,8 @@ class SystemdUnitReloadItem(_Item):
41
40
 
42
41
  def fulfill(self) -> None:
43
42
  """Fulfill outcomes."""
44
- systemd_unit_reload_outcomes = [
45
- x
46
- for x in self.outcomes
47
- if isinstance(x, SystemdUnitReloadItemReloadOutcome)
48
- ]
49
-
50
- systemd_unit_reload_outcomes[0].unit.reload()
43
+ for outcome in self.outcomes:
44
+ outcome.unit.reload()
51
45
 
52
46
  def __eq__(self, other: object) -> bool:
53
47
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitRestartItemRestartOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitRestartItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitRestartItemRestartOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  outcomes.append(SystemdUnitRestartItemRestartOutcome(unit=self.unit))
@@ -41,13 +40,8 @@ class SystemdUnitRestartItem(_Item):
41
40
 
42
41
  def fulfill(self) -> None:
43
42
  """Fulfill outcomes."""
44
- systemd_unit_restart_outcomes = [
45
- x
46
- for x in self.outcomes
47
- if isinstance(x, SystemdUnitRestartItemRestartOutcome)
48
- ]
49
-
50
- systemd_unit_restart_outcomes[0].unit.restart()
43
+ for outcome in self.outcomes:
44
+ outcome.unit.restart()
51
45
 
52
46
  def __eq__(self, other: object) -> bool:
53
47
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import SystemdUnitStopItemStopOutcome
9
8
  from cyberfusion.SystemdSupport.units import Unit
@@ -29,8 +28,8 @@ class SystemdUnitStopItem(_Item):
29
28
  self.unit = Unit(self.name)
30
29
 
31
30
  @property
32
- def outcomes(self) -> List[OutcomeInterface]:
33
- """Get outcomes of calling self.fulfill."""
31
+ def outcomes(self) -> List[SystemdUnitStopItemStopOutcome]:
32
+ """Get outcomes of item."""
34
33
  outcomes = []
35
34
 
36
35
  if self.unit.is_active:
@@ -40,14 +39,8 @@ class SystemdUnitStopItem(_Item):
40
39
 
41
40
  def fulfill(self) -> None:
42
41
  """Fulfill outcomes."""
43
- systemd_unit_stop_outcomes = [
44
- x
45
- for x in self.outcomes
46
- if isinstance(x, SystemdUnitStopItemStopOutcome)
47
- ]
48
-
49
- if systemd_unit_stop_outcomes:
50
- systemd_unit_stop_outcomes[0].unit.stop()
42
+ for outcome in self.outcomes:
43
+ outcome.unit.stop()
51
44
 
52
45
  def __eq__(self, other: object) -> bool:
53
46
  """Get equality based on attributes."""
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import UnlinkItemUnlinkOutcome
11
10
 
@@ -31,8 +30,8 @@ class UnlinkItem(_Item):
31
30
  raise PathIsSymlinkError(self.path)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[UnlinkItemUnlinkOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if os.path.exists(self.path):
@@ -46,12 +45,8 @@ class UnlinkItem(_Item):
46
45
 
47
46
  def fulfill(self) -> None:
48
47
  """Fulfill outcomes."""
49
- unlink_outcomes = [
50
- x for x in self.outcomes if isinstance(x, UnlinkItemUnlinkOutcome)
51
- ]
52
-
53
- if unlink_outcomes:
54
- os.unlink(unlink_outcomes[0].path)
48
+ for outcome in self.outcomes:
49
+ os.unlink(outcome.path)
55
50
 
56
51
  def __eq__(self, other: object) -> bool:
57
52
  """Get equality based on attributes."""
@@ -23,10 +23,7 @@ class CopyItemCopyOutcome(OutcomeInterface):
23
23
  if not isinstance(other, CopyItemCopyOutcome):
24
24
  return False
25
25
 
26
- return (
27
- other.source == self.source
28
- and other.destination == self.destination
29
- )
26
+ return other.source == self.source and other.destination == self.destination
30
27
 
31
28
 
32
29
  class MoveItemMoveOutcome(OutcomeInterface):
@@ -46,10 +43,7 @@ class MoveItemMoveOutcome(OutcomeInterface):
46
43
  if not isinstance(other, MoveItemMoveOutcome):
47
44
  return False
48
45
 
49
- return (
50
- other.source == self.source
51
- and other.destination == self.destination
52
- )
46
+ return other.source == self.source and other.destination == self.destination
53
47
 
54
48
 
55
49
  class MkdirItemCreateOutcome(OutcomeInterface):
@@ -80,7 +74,9 @@ class SystemdTmpFilesCreateItemCreateOutcome(OutcomeInterface):
80
74
 
81
75
  def __str__(self) -> str:
82
76
  """Get human-readable string."""
83
- return f"Create tmp files according to tmp files configuration file at {self.path}"
77
+ return (
78
+ f"Create tmp files according to tmp files configuration file at {self.path}"
79
+ )
84
80
 
85
81
  def __eq__(self, other: object) -> bool:
86
82
  """Get equality based on attributes."""
@@ -131,9 +127,7 @@ class CommandItemRunOutcome(OutcomeInterface):
131
127
  class ChmodItemModeChangeOutcome(OutcomeInterface):
132
128
  """Represents outcome."""
133
129
 
134
- def __init__(
135
- self, *, path: str, old_mode: Optional[int], new_mode: int
136
- ) -> None:
130
+ def __init__(self, *, path: str, old_mode: Optional[int], new_mode: int) -> None:
137
131
  """Set attributes."""
138
132
  self.path = path
139
133
  self.old_mode = old_mode
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-cyberfusion-queue-support
3
- Version: 1.1.1.2
3
+ Version: 1.1.4
4
4
  Summary: Library to queue actions.
5
- Home-page: https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
6
- Author: Cyberfusion
7
- Author-email: support@cyberfusion.io
8
- Platform: linux
5
+ Author-email: Cyberfusion <support@cyberfusion.io>
6
+ Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
9
7
  Description-Content-Type: text/markdown
8
+ Requires-Dist: python3-cyberfusion-systemd-support~=1.0
10
9
 
11
10
  # python3-cyberfusion-queue-support
12
11
 
@@ -20,12 +19,6 @@ Run the following command to install the package from PyPI:
20
19
 
21
20
  pip3 install python3-cyberfusion-queue-support
22
21
 
23
- ## Generic
24
-
25
- Run the following command to create a source distribution:
26
-
27
- python3 setup.py sdist
28
-
29
22
  ## Debian
30
23
 
31
24
  Run the following commands to build a Debian package:
@@ -1,7 +1,6 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  setup.cfg
4
- setup.py
5
4
  src/cyberfusion/QueueSupport/__init__.py
6
5
  src/cyberfusion/QueueSupport/interfaces.py
7
6
  src/cyberfusion/QueueSupport/outcomes.py
@@ -1,21 +0,0 @@
1
- [tool.isort]
2
- profile = "black"
3
- line_length = 79
4
- known_first_party = ["cyberfusion"]
5
- default_section = "THIRDPARTY"
6
-
7
- [tool.black]
8
- line-length = 79
9
- exclude = '''
10
- (
11
- /(
12
- \.eggs # exclude a few common directories in the
13
- | \.git # root of the project
14
- | \.hg
15
- | \.mypy_cache
16
- | \.tox
17
- | \.venv
18
- | venv
19
- )/
20
- )
21
- '''
@@ -1,28 +0,0 @@
1
- """A setuptools based setup module."""
2
-
3
- from setuptools import setup
4
-
5
- with open("README.md", "r", encoding="utf-8") as fh:
6
- long_description = fh.read()
7
-
8
- setup(
9
- name="python3-cyberfusion-queue-support",
10
- version="1.1.1.2",
11
- description="Library to queue actions.",
12
- long_description=long_description,
13
- long_description_content_type="text/markdown",
14
- author="Cyberfusion",
15
- author_email="support@cyberfusion.io",
16
- url="https://github.com/CyberfusionIO/python3-cyberfusion-queue-support",
17
- platforms=["linux"],
18
- packages=[
19
- "cyberfusion.QueueSupport",
20
- "cyberfusion.QueueSupport.items",
21
- "cyberfusion.QueueSupport.exceptions",
22
- ],
23
- package_dir={"": "src"},
24
- data_files=[],
25
- install_requires=[
26
- "python3-cyberfusion-systemd-support~=1.0",
27
- ],
28
- )