aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/mesonmain.py8
-rwxr-xr-xrun_meson_command_tests.py26
-rw-r--r--setup.py8
3 files changed, 21 insertions, 21 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 011ac14..68a2ddb 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -232,15 +232,17 @@ def run_script_command(args):
return cmdfunc(cmdargs)
def set_meson_command(mainfile):
- if mainfile.endswith('.exe'):
+ # On UNIX-like systems `meson` is a Python script
+ # On Windows `meson` and `meson.exe` are wrapper exes
+ if not mainfile.endswith('.py'):
mesonlib.meson_command = [mainfile]
elif os.path.isabs(mainfile) and mainfile.endswith('mesonmain.py'):
# Can't actually run meson with an absolute path to mesonmain.py, it must be run as -m mesonbuild.mesonmain
mesonlib.meson_command = mesonlib.python_command + ['-m', 'mesonbuild.mesonmain']
else:
+ # Either run uninstalled, or full path to meson-script.py
mesonlib.meson_command = mesonlib.python_command + [mainfile]
- # This won't go into the log file because it's not initialized yet, and we
- # need this value for unit tests.
+ # We print this value for unit tests.
if 'MESON_COMMAND_TESTS' in os.environ:
mlog.log('meson_command is {!r}'.format(mesonlib.meson_command))
diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py
index cd220de..f38b89a 100755
--- a/run_meson_command_tests.py
+++ b/run_meson_command_tests.py
@@ -135,25 +135,15 @@ class CommandTests(unittest.TestCase):
self.assertTrue(bindir.is_dir())
# Run `meson`
os.chdir('/')
- if is_windows():
- resolved_meson_command = python_command + [str(bindir / 'meson.py')]
- else:
- resolved_meson_command = python_command + [str(bindir / 'meson')]
- # The python configuration on appveyor does not register .py as
- # a valid extension, so we cannot run `meson` on Windows.
- builddir = str(self.tmpdir / 'build1')
- meson_setup = ['meson', 'setup']
- meson_command = meson_setup + self.meson_args
- stdo = self._run(meson_command + [self.testdir, builddir])
- self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
+ resolved_meson_command = [str(bindir / 'meson')]
+ builddir = str(self.tmpdir / 'build1')
+ meson_setup = ['meson', 'setup']
+ meson_command = meson_setup + self.meson_args
+ stdo = self._run(meson_command + [self.testdir, builddir])
+ self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
# Run `/path/to/meson`
builddir = str(self.tmpdir / 'build2')
- if is_windows():
- # Cannot run .py directly because of the appveyor configuration,
- # and the script is named meson.py, not meson
- meson_setup = python_command + [str(bindir / 'meson.py'), 'setup']
- else:
- meson_setup = [str(bindir / 'meson'), 'setup']
+ meson_setup = [str(bindir / 'meson'), 'setup']
meson_command = meson_setup + self.meson_args
stdo = self._run(meson_command + [self.testdir, builddir])
self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
@@ -168,7 +158,7 @@ class CommandTests(unittest.TestCase):
# Next part requires a shell
return
# `meson` is a wrapper to `meson.real`
- resolved_meson_command = python_command + [str(bindir / 'meson.real')]
+ resolved_meson_command = [str(bindir / 'meson.real')]
builddir = str(self.tmpdir / 'build4')
(bindir / 'meson').rename(bindir / 'meson.real')
wrapper = (bindir / 'meson')
diff --git a/setup.py b/setup.py
index 8c267a3..d8a614b 100644
--- a/setup.py
+++ b/setup.py
@@ -56,6 +56,13 @@ class install_scripts(orig):
self.copy_file(in_built, outfile)
self.outfiles.append(outfile)
+entries = {}
+if sys.platform == 'win32':
+ # This will create Scripts/meson.exe and Scripts/meson-script.py
+ # Can't use this on all platforms because distutils doesn't support
+ # entry_points in setup()
+ entries = {'console_scripts': ['meson=mesonbuild.mesonmain:main']}
+
setup(name='meson',
version=version,
description='A high performance build system',
@@ -73,6 +80,7 @@ setup(name='meson',
'mesonbuild.wrap'],
scripts=['meson.py'],
cmdclass={'install_scripts': install_scripts},
+ entry_points=entries,
data_files=[('share/man/man1', ['man/meson.1']),
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])],
classifiers=['Development Status :: 5 - Production/Stable',