File: setup.py

package info (click to toggle)
gi-docgen 2023.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,992 kB
  • sloc: python: 7,897; javascript: 592; makefile: 25
file content (36 lines) | stat: -rw-r--r-- 915 bytes parent folder | download
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
# 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()


if __name__ == '__main__':
    setup(
        cmdclass={
            'build_py': BuildCommand,
        },
    )