mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add setup.py
This commit is contained in:
parent
b64d0346b0
commit
cf2f5215c8
7 changed files with 79 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
__pycache__
|
__pycache__
|
||||||
|
/build
|
||||||
|
/dist
|
||||||
|
*.egg-info
|
||||||
|
|
3
gtk-blueprint-tool.pc
Normal file
3
gtk-blueprint-tool.pc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Name: gtk-blueprint-tool
|
||||||
|
Description: Markup compiler for GTK user interface definitions
|
||||||
|
Version: 2021.1
|
3
gtk-blueprint-tool.pc.in
Normal file
3
gtk-blueprint-tool.pc.in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Name: gtk-blueprint-tool
|
||||||
|
Description: Markup compiler for GTK user interface definitions
|
||||||
|
Version: @VERSION@
|
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
from gtkblueprinttool.main import BlueprintApp
|
from gtkblueprinttool import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
BlueprintApp().main()
|
main()
|
||||||
|
|
0
gtkblueprinttool/__init__.py
Normal file
0
gtkblueprinttool/__init__.py
Normal file
|
@ -25,6 +25,9 @@ from .pipeline import Pipeline
|
||||||
from . import parser, tokenizer
|
from . import parser, tokenizer
|
||||||
|
|
||||||
|
|
||||||
|
VERSION = "0.1.0"
|
||||||
|
|
||||||
|
|
||||||
class BlueprintApp:
|
class BlueprintApp:
|
||||||
def main(self):
|
def main(self):
|
||||||
self.parser = argparse.ArgumentParser()
|
self.parser = argparse.ArgumentParser()
|
||||||
|
@ -66,3 +69,7 @@ class BlueprintApp:
|
||||||
except PrintableError as e:
|
except PrintableError as e:
|
||||||
e.pretty_print(opts.input.name, data)
|
e.pretty_print(opts.input.name, data)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
BlueprintApp().main()
|
||||||
|
|
61
setup.py
Normal file
61
setup.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 GNOME Foundation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
|
||||||
|
|
||||||
|
# Adapted from the gi-docgen source code by James Westman <james@jwestman.net>
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from gtkblueprinttool import main
|
||||||
|
|
||||||
|
from distutils.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('gtk-blueprint-tool.pc.in', 'r') as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
new_line = line.strip().replace('@VERSION@', main.VERSION)
|
||||||
|
lines.append(new_line)
|
||||||
|
with open('gtk-blueprint-tool.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': ['gtk-blueprint-tool=gtkblueprinttool.main:main'],
|
||||||
|
}
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
'gtkblueprinttool',
|
||||||
|
]
|
||||||
|
|
||||||
|
data_files = [
|
||||||
|
('share/pkgconfig', ['gtk-blueprint-tool.pc']),
|
||||||
|
]
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
setup(
|
||||||
|
cmdclass={
|
||||||
|
'build_py': BuildCommand,
|
||||||
|
},
|
||||||
|
name='gtk-blueprint-tool',
|
||||||
|
version=main.VERSION,
|
||||||
|
license='GPL-3.0-or-later',
|
||||||
|
long_description=readme_md(),
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
|
include_package_data=True,
|
||||||
|
packages=packages,
|
||||||
|
entry_points=entries,
|
||||||
|
data_files=data_files,
|
||||||
|
)
|
Loading…
Add table
Add a link
Reference in a new issue