mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Use meson instead of setup.py
This project will usually be used as a subproject, so it needs a meson file, and I'd like to not support two different buildsystems.
This commit is contained in:
parent
848d5d5049
commit
419faf0362
5 changed files with 30 additions and 67 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ __pycache__
|
|||
/build
|
||||
/dist
|
||||
*.egg-info
|
||||
gtk-blueprint-tool.pc
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
test:
|
||||
script:
|
||||
- dnf install -y python3-pip
|
||||
- python3 -m unittest
|
||||
- pip3 install --user .
|
||||
- dnf install -y meson
|
||||
- meson _build
|
||||
- ninja -C _build
|
||||
- ninja -C _build test
|
||||
- ninja -C _build install
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
Name: gtk-blueprint-tool
|
||||
Description: Markup compiler for GTK user interface definitions
|
||||
Version: 2021.1
|
24
meson.build
Normal file
24
meson.build
Normal file
|
@ -0,0 +1,24 @@
|
|||
project('gtk-blueprint-tool',
|
||||
version: '0.1.0',
|
||||
)
|
||||
|
||||
prefix = get_option('prefix')
|
||||
libdir = join_paths(prefix, get_option('libdir'))
|
||||
|
||||
py = import('python').find_installation('python3')
|
||||
|
||||
configure_file(
|
||||
input: 'gtk-blueprint-tool.pc.in',
|
||||
output: 'gtk-blueprint-tool.pc',
|
||||
configuration: { 'VERSION': meson.project_version() },
|
||||
install: not meson.is_subproject(),
|
||||
install_dir: join_paths(libdir, 'pkgconfig'),
|
||||
)
|
||||
|
||||
meson.override_find_program('gtk-blueprint-tool', find_program('gtk-blueprint-tool.py'))
|
||||
|
||||
if not meson.is_subproject()
|
||||
install_subdir('gtkblueprinttool', install_dir: py.get_install_dir())
|
||||
endif
|
||||
|
||||
test('tests', py, args: ['-m', 'unittest'])
|
61
setup.py
61
setup.py
|
@ -1,61 +0,0 @@
|
|||
# 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