aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/mesonmain.py10
-rw-r--r--mesonbuild/modules/python.py8
-rwxr-xr-xmsi/createmsi.py24
3 files changed, 33 insertions, 9 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 91a52b1..e7005e9 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -81,14 +81,18 @@ class CommandLineParser:
self.commands[i] = p
def add_runpython_arguments(self, parser):
+ parser.add_argument('-c', action='store_true', dest='eval_arg', default=False)
parser.add_argument('script_file')
parser.add_argument('script_args', nargs=argparse.REMAINDER)
def run_runpython_command(self, options):
import runpy
- sys.argv[1:] = options.script_args
- sys.path.insert(0, os.path.dirname(options.script_file))
- runpy.run_path(options.script_file, run_name='__main__')
+ if options.eval_arg:
+ exec(options.script_file)
+ else:
+ sys.argv[1:] = options.script_args
+ sys.path.insert(0, os.path.dirname(options.script_file))
+ runpy.run_path(options.script_file, run_name='__main__')
return 0
def add_help_arguments(self, parser):
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index bd69244..a0ebe0e 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -42,9 +42,8 @@ mod_kwargs -= set(['name_prefix', 'name_suffix'])
def run_command(python, command):
- _, stdout, _ = mesonlib.Popen_safe(python.get_command() + [
- '-c',
- command])
+ cmd = python.get_command() + ['-c', command]
+ _, stdout, _ = mesonlib.Popen_safe(cmd)
return stdout.strip()
@@ -265,8 +264,7 @@ class PythonDependency(ExternalDependency):
return super().get_pkgconfig_variable(variable_name, kwargs)
-INTROSPECT_COMMAND = '''
-import sysconfig
+INTROSPECT_COMMAND = '''import sysconfig
import json
import sys
diff --git a/msi/createmsi.py b/msi/createmsi.py
index a7a9c3c..4eb5111 100755
--- a/msi/createmsi.py
+++ b/msi/createmsi.py
@@ -84,6 +84,28 @@ class PackageGenerator:
modules = ['mesonbuild.' + modname + '.' + x for x in modules if not x.startswith('_')]
return modules
+ def get_more_modules(self):
+ # Python packagers want to minimal and only copy the things that
+ # they can see that are used. They are blind to many things.
+ return ['distutils.archive_util',
+ 'distutils.cmd',
+ 'distutils.config',
+ 'distutils.core',
+ 'distutils.debug',
+ 'distutils.dep_util',
+ 'distutils.dir_util',
+ 'distutils.dist',
+ 'distutils.errors',
+ 'distutils.extension',
+ 'distutils.fancy_getopt',
+ 'distutils.file_util',
+ 'distutils.spawn',
+ 'distutils.util',
+ 'distutils.version',
+ 'distutils.command.build_ext',
+ 'distutils.command.build',
+ ]
+
def build_dist(self):
for sdir in self.staging_dirs:
if os.path.exists(sdir):
@@ -91,7 +113,7 @@ class PackageGenerator:
main_stage, ninja_stage = self.staging_dirs
modules = self.get_all_modules_from_dir('mesonbuild/modules')
modules += self.get_all_modules_from_dir('mesonbuild/scripts')
- modules += ['distutils.version']
+ modules += self.get_more_modules()
modulestr = ','.join(modules)
python = shutil.which('python')
cxfreeze = os.path.join(os.path.dirname(python), "Scripts", "cxfreeze")