-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
78 lines (62 loc) · 1.88 KB
/
setup.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
# SPDX-FileCopyrightText: 2021 GNOME Foundation
# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
import sys
if sys.version_info < (3, 6, 0):
raise SystemExit('ERROR: GI-DocGen requires Python 3.6.0')
from gidocgen.core import version
from setuptools.command.build_py import build_py as _build_py
from setuptools import setup
class BuildCommand(_build_py):
def generate_pkgconfig_file(self):
lines = []
with open('gi-docgen.pc.in', 'r') as f:
for line in f.readlines():
new_line = line.strip().replace('@VERSION@', version)
lines.append(new_line)
with open('gi-docgen.pc', 'w') as f:
f.write('\n'.join(lines))
def run(self):
self.generate_pkgconfig_file()
return super().run()
def readme_md():
'''Return the contents of the README.md file'''
return open('README.md').read()
entries = {
'console_scripts': ['gi-docgen=gidocgen.gidocmain:main'],
}
packages = [
'gidocgen',
'gidocgen.gir',
]
package_data = {
'gidocgen': [
"templates/basic/basic.toml",
"templates/basic/*.css",
"templates/basic/*.html",
"templates/basic/*.js",
"templates/basic/*.png",
"templates/basic/*.woff2",
"templates/basic/*.woff",
"py.typed",
],
}
data_files = [
('share/pkgconfig', ['gi-docgen.pc']),
('share/man/man1', ['docs/gi-docgen.1']),
]
if __name__ == '__main__':
setup(
cmdclass={
'build_py': BuildCommand,
},
name='gi-docgen',
version=version,
license='GPL-3.0-or-later AND Apache-2.0 AND CC0-1.0',
long_description=readme_md(),
long_description_content_type='text/markdown',
include_package_data=True,
packages=packages,
package_data=package_data,
entry_points=entries,
data_files=data_files,
)