diff options
-rw-r--r-- | data/com.mesonbuild.install.policy | 3 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 13 | ||||
-rw-r--r-- | mesonbuild/minstall.py (renamed from mesonbuild/scripts/meson_install.py) | 39 |
4 files changed, 40 insertions, 17 deletions
diff --git a/data/com.mesonbuild.install.policy b/data/com.mesonbuild.install.policy index 9a00de2..6fba47c 100644 --- a/data/com.mesonbuild.install.policy +++ b/data/com.mesonbuild.install.policy @@ -17,8 +17,7 @@ </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate> <annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/meson</annotate> - <annotate key="org.freedesktop.policykit.exec.argv2">--internal</annotate> - <annotate key="org.freedesktop.policykit.exec.argv3">install</annotate> + <annotate key="org.freedesktop.policykit.exec.argv2">install</annotate> </action> </policyconfig> diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 9d72225..05c2a78 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -683,7 +683,7 @@ int dummy; elem = NinjaBuildElement(self.all_outputs, 'meson-install', 'CUSTOM_COMMAND', 'PHONY') elem.add_dep('all') elem.add_item('DESC', 'Installing files.') - elem.add_item('COMMAND', self.environment.get_build_command() + ['--internal', 'install', install_data_file]) + elem.add_item('COMMAND', self.environment.get_build_command() + ['install', '--no-rebuild']) elem.add_item('pool', 'console') self.generate_depmf_install(d) self.generate_target_install(d) diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index e74fb36..c9acf25 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -20,7 +20,6 @@ import cProfile as profile from . import environment, interpreter, mesonlib from . import build -from . import mconf, mintro, mtest, rewriter, minit from . import mlog, coredata from .mesonlib import MesonException from .environment import detect_msys2_arch @@ -178,9 +177,6 @@ def run_script_command(args): elif cmdname == 'cleantrees': import mesonbuild.scripts.cleantrees as abc cmdfunc = abc.run - elif cmdname == 'install': - import mesonbuild.scripts.meson_install as abc - cmdfunc = abc.run elif cmdname == 'commandrunner': import mesonbuild.scripts.commandrunner as abc cmdfunc = abc.run @@ -270,23 +266,32 @@ def run(original_args, mainfile): args = remaining_args cmd_name = args[0] if cmd_name == 'test': + from . import mtest return mtest.run(remaining_args) elif cmd_name == 'setup': args = remaining_args # FALLTHROUGH like it's 1972. + elif cmd_name == 'install': + from . import minstall + return minstall.run(remaining_args) elif cmd_name == 'introspect': + from . import mintro return mintro.run(remaining_args) elif cmd_name == 'rewrite': + from . import rewriter return rewriter.run(remaining_args) elif cmd_name == 'configure': try: + from . import mconf return mconf.run(remaining_args) except MesonException as e: mlog.exception(e) sys.exit(1) elif cmd_name == 'wrap': + from .wrap import wraptool return wraptool.run(remaining_args) elif cmd_name == 'init': + from . import minit return minit.run(remaining_args) elif cmd_name == 'runpython': import runpy diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/minstall.py index 2c718b4..c5d99b5 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/minstall.py @@ -14,15 +14,25 @@ import sys, pickle, os, shutil, subprocess, gzip, errno import shlex +import argparse from glob import glob -from . import depfixer -from . import destdir_join -from ..mesonlib import is_windows, Popen_safe +from .scripts import depfixer +from .scripts import destdir_join +from .mesonlib import is_windows, Popen_safe +from .mtest import rebuild_all from __main__ import __file__ as main_file install_log_file = None selinux_updates = [] +def buildparser(): + parser = argparse.ArgumentParser(prog='meson install') + parser.add_argument('-C', default='.', dest='wd', + help='directory to cd into before running') + parser.add_argument('--no-rebuild', default=False, action='store_true', + help='Do not rebuild before installing.') + return parser + class DirMaker: def __init__(self): self.dirs = [] @@ -425,15 +435,24 @@ def install_targets(d): raise def run(args): - if len(args) != 1 and len(args) != 2: - print('Installer script for Meson. Do not run on your own, mmm\'kay?') - print('meson_install.py [install info file]') - datafilename = args[0] + global install_log_file + parser = buildparser() + opts = parser.parse_args(args) + datafilename = 'meson-private/install.dat' private_dir = os.path.dirname(datafilename) log_dir = os.path.join(private_dir, '../meson-logs') - if len(args) == 2: - os.chdir(args[1]) - do_install(log_dir, datafilename) + if not os.path.exists(os.path.join(opts.wd, datafilename)): + sys.exit('Install data not found. Run this command in build directory root.') + log_dir = os.path.join(private_dir, '../meson-logs') + if not opts.no_rebuild: + if not rebuild_all(opts.wd): + sys.exit(-1) + os.chdir(opts.wd) + with open(os.path.join(log_dir, 'install-log.txt'), 'w') as lf: + install_log_file = lf + append_to_log('# List of files installed by Meson') + append_to_log('# Does not contain files installed by custom scripts.') + do_install(log_dir, datafilename) install_log_file = None return 0 |