-
Notifications
You must be signed in to change notification settings - Fork 0
/
packager.py
115 lines (54 loc) · 3 KB
/
packager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from generallibrary import NetworkDiagram
from generalpackager.api.localrepo.base.localrepo_target import _SharedTarget
from generalpackager.api.shared import _SharedAPI, _SharedName, _SharedPath
from generalpackager.other.packages import Packages
from generalpackager.packager_api import _PackagerAPIs
from generalpackager.packager_files import _PackagerFiles
from generalpackager.packager_github import _PackagerGitHub
from generalpackager.packager_markdown import _PackagerMarkdown
from generalpackager.packager_metadata import _PackagerMetadata
from generalpackager.packager_pypi import _PackagerPypi
from generalpackager.packager_relations import _PackagerRelations
from generalpackager.packager_workflow import _PackagerWorkflow
class Packager(NetworkDiagram,
_SharedAPI, _SharedName, _SharedTarget, _SharedPath,
_PackagerMarkdown, _PackagerGitHub, _PackagerFiles, _PackagerMetadata, _PackagerPypi, _PackagerWorkflow, _PackagerRelations, _PackagerAPIs):
""" Uses APIs to manage 'general' package.
Contains methods that require more than one API as well as methods specific for ManderaGeneral. """
author = 'Rickard "Mandera" Abraham'
email = "rickard.abraham@gmail.com"
license = "mit"
python = "3.8", "3.9" # Only supports basic definition with tuple of major.minor
os = "windows", "ubuntu" # , "macos"
git_exclude_lines = npm_ignore_lines = ".idea", "dist", ".git", "test/tests", ".coverage"
git_exclude_lines += "build", "*.egg-info", "__pycache__", "PKG-INFO", "setup.cfg"
npm_ignore_lines += "node_modules", ".parcel-cache"
Packages = Packages
def __init__(self, name=None, path=None, target=..., github_owner=None, pypi_owner=None):
""" Storing pars as is. Name and target have some custom properties. """
self._target = target
self._github_owner = github_owner
self._pypi_owner = pypi_owner
@staticmethod
def summary_packagers():
""" Packagers to hold summary of environment. """
return [
Packager(name="Mandera", github_owner="Mandera"),
Packager(name=".github", github_owner="ManderaGeneral"),
]
def spawn_children(self):
""" :param generalpackager.Packager self: """
for packager in self.get_dependants(only_general=True):
if packager.localrepo.metadata.enabled:
packager.set_parent(parent=self)
def spawn_parents(self):
""" :param generalpackager.Packager self: """
for packager in self.get_dependencies(only_general=True):
if packager.localrepo.metadata.enabled:
self.set_parent(parent=packager)
def __repr__(self):
info = [self.target]
if self.path is None:
info.append("No Path")
info = str(info).replace("'", "")
return f"<Packager {info}: {self.name}>"