-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsetup.py
More file actions
77 lines (58 loc) · 2.13 KB
/
Copy pathsetup.py
File metadata and controls
77 lines (58 loc) · 2.13 KB
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
import collections.abc
import os
import semver
import setuptools
import setuptools.discovery
own_dir = os.path.abspath(os.path.dirname(__file__))
BDBA_CLIENT_VERSION_FILE = os.path.join(own_dir, 'BDBA_CLIENT_VERSION')
ODG_CLIENT_VERSION_FILE = os.path.join(own_dir, 'ODG_CLIENT_VERSION')
def read_version(file: str) -> str:
with open(file) as f:
return f.read().strip()
def finalize_version() -> str:
with open(os.path.join(own_dir, 'VERSION')) as f:
return semver.finalize_version(f.read().strip())
def requirements() -> collections.abc.Iterable[str]:
yield f'bdba-client=={read_version(BDBA_CLIENT_VERSION_FILE)}'
yield f'odg-client=={read_version(ODG_CLIENT_VERSION_FILE)}'
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
yield line
def modules() -> collections.abc.Iterable[str]:
return setuptools.discovery.ModuleFinder.find('src')
def packages() -> collections.abc.Iterable[str]:
return (
package
for package in setuptools.discovery.PackageFinder.find('src')
if package
not in (
'bdba', # already part of `bdba-client`
'delivery', # already part of `odg-client`
'odg_client', # already part of `odg-client`
)
)
def package_data() -> dict[str, list[str]]:
return {
'features': ['*.yaml'],
'freshclam': ['freshclam.conf'],
'odg': ['*.yaml'],
'osinfo': ['*.yaml'],
'responsibles': ['*.yaml'],
'schema': ['*.yaml'],
'secret_mgmt': ['*.yaml'],
'swagger': ['*.yaml'],
}
setuptools.setup(
name='odg-core-libs',
version=os.environ.get('ODG_CORE_LIBS_VERSION', finalize_version()),
package_dir={'': 'src'},
py_modules=list(modules()),
packages=list(packages()),
package_data=package_data(),
install_requires=list(requirements()),
description='Mandatory system internals for the Open Delivery Gear',
url='https://github.com/open-component-model/open-delivery-gear',
)