-
Notifications
You must be signed in to change notification settings - Fork 29
/
setup.gha.py
157 lines (132 loc) · 4.03 KB
/
setup.gha.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
'''
minimal (but likely growing) subset of `gardener-cicd-libs` package for usage w/ GitHubActions.
This package takes special care to avoid dependencies specific towards Concourse-Pipeline-Template
or related infrastructure (e.g. `concourse`, `ccc`, `model` packages), and also omits dependencies
against some "heavy" packages, such as hyperscaler-SDKs, which are referenced by `gardener-cicd-libs`
for historical reasons.
Caveat: as this package has overlaps w/ `gardener-cicd-libs`, it is not adviseable to create mixed
installations (containing both `gardener-gha-libs` and `gardener-cicd-libs`).
'''
import setuptools
import os
own_dir = os.path.abspath(os.path.dirname(__file__))
def version():
with open(os.path.join(own_dir, 'ci', 'VERSION')) as f:
return f.read().strip()
def requirements():
yield 'gardener-oci'
yield 'gardener-ocm'
# omit packages not needed for minimal subset of cc-utils / gardener-cicd-libs
omit_package_names = (
'Mako',
'Sphinx',
'aliyun-python-sdk-core',
'aliyun-python-sdk-ecs',
'aliyun-python-sdk-ram',
'brypt',
'boto3',
'cachetools',
'cryptography',
'dockerfile-parse',
'docutils',
'elasticsearch',
'google-api-core',
'google-api-python-client',
'google-auth',
'google-cloud-storage',
'google-crc32',
'kubernetes',
'msal',
'openstacksdk',
'oss2',
'pycryptodome',
'pylama',
'pylint',
'python-gitlab',
'python-keystoneclient',
'python-magic',
'python-swiftclient',
'pytimeparse',
'ruamel.yaml',
'slackclient',
'sphinx_rtd_theme',
'sseclient-py',
'urllib3',
)
with open(os.path.join(own_dir, 'requirements.txt')) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
skip = False
for omit in omit_package_names:
if line.lower().startswith(omit.lower()):
print(f'skipping: {line=}')
skip = True
break
if skip:
continue
yield line
def modules():
module_names = [
os.path.basename(os.path.splitext(module)[0]) for module in
os.scandir(path=own_dir)
if module.is_file() and module.name.endswith('.py')
]
# avoid modules that would introduce undesired dependencies
omit_modules = (
'ctx',
'dockerutil',
'http_requests',
'mailutil',
'makoutil',
'signingserver',
)
for name in omit_modules:
module_names.remove(name)
# avoid including other setup-scripts
module_names.remove('setup')
module_names.remove('setup.gha')
module_names.remove('setup.oci')
module_names.remove('setup.ocm')
module_names.remove('setup.whd')
return module_names
def packages():
package_names = setuptools.find_packages(exclude=['setup'])
# avoid packages that would introduce undesired dependencies
omit_packages = (
'ccc',
'cfg_mgmt',
'checkmarx',
'concourse',
'container',
'ctt',
'delivery',
'dso',
'mail',
'model',
'slackclient',
'whd',
)
for package in omit_packages:
package_names.remove(package)
# skip packages installed by other distribution-packages
package_names.remove('oci')
package_names.remove('ocm')
return package_names
setuptools.setup(
name='gardener-gha-libs',
version=version(),
description='Gardener CI/CD Libraries for GitHubActions',
long_description='Gardener CI/CD Libraries for GitHubActions',
long_description_content_type='text/markdown',
python_requires='>=3.12',
py_modules=modules(),
packages=packages(),
package_data={
'ci': ['VERSION'],
},
install_requires=list(requirements()),
entry_points={
},
)