Skip to content

Commit d4bdd83

Browse files
authored
setuptools: move stuff to declarative cfg if possible [skip ci]
We're down to just declaring the data files in python now. setup.cfg can, uniquely, retrieve version info by trying to parse the AST for simple assignments (which we use) instead of importing the entire module.
1 parent 56a0e74 commit d4bdd83

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

setup.cfg

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[metadata]
2+
name = meson
3+
version = attr: mesonbuild.coredata.version
24
description = A high performance build system
35
author = Jussi Pakkanen
46
author_email = jpakkane@gmail.com
@@ -29,16 +31,24 @@ classifiers =
2931
long_description = Meson is a cross-platform build system designed to be both as fast and as user friendly as possible. It supports many languages and compilers, including GCC, Clang, PGI, Intel, and Visual Studio. Its build definitions are written in a simple non-Turing complete DSL.
3032

3133
[options]
34+
packages = find:
3235
python_requires = >= 3.6
3336
setup_requires =
3437
setuptools
3538

39+
[options.entry_points]
40+
console_scripts =
41+
meson = mesonbuild.mesonmain:main
42+
3643
[options.extras_require]
3744
progress =
3845
tqdm
3946

47+
[options.packages.find]
48+
include = mesonbuild, mesonbuild.*
49+
exclude = *.data
50+
4051
[tool:pytest]
4152
python_classes =
4253
python_files =
4354
run_unittests.py
44-

setup.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,12 @@
2020
raise SystemExit('ERROR: Tried to install Meson with an unsupported Python version: \n{}'
2121
'\nMeson requires Python 3.6.0 or greater'.format(sys.version))
2222

23-
from mesonbuild.coredata import version
24-
from setuptools import setup, find_packages
23+
from setuptools import setup
2524

26-
# On windows, will create Scripts/meson.exe and Scripts/meson-script.py
27-
# Other platforms will create bin/meson
28-
entries = {'console_scripts': ['meson=mesonbuild.mesonmain:main']}
2925
data_files = []
3026
if sys.platform != 'win32':
3127
# Only useful on UNIX-like systems
3228
data_files = [('share/man/man1', ['man/meson.1']),
3329
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]
3430

35-
setup(name='meson',
36-
version=version,
37-
packages=find_packages(
38-
include=['mesonbuild', 'mesonbuild.*'],
39-
exclude=['*.data']
40-
),
41-
entry_points=entries,
42-
data_files=data_files,)
31+
setup(data_files=data_files,)

0 commit comments

Comments
 (0)