diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-05-13 10:36:58 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-06 20:02:37 +0000 |
commit | f4d60acaa924b4735fc71b7a9c716fbea824c877 (patch) | |
tree | 76c568025844e6f39628666a80795979a632a148 | |
parent | 75e501ceb8888562b2749d20ba2c43374e5c9671 (diff) | |
download | meson-f4d60acaa924b4735fc71b7a9c716fbea824c877.zip meson-f4d60acaa924b4735fc71b7a9c716fbea824c877.tar.gz meson-f4d60acaa924b4735fc71b7a9c716fbea824c877.tar.bz2 |
Remove had_argument_for() it is not used anymore
This also means we don't need to keep original command line arguments
anymore.
-rw-r--r-- | mesonbuild/environment.py | 15 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 7 | ||||
-rwxr-xr-x | run_project_tests.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 26 |
4 files changed, 19 insertions, 33 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index a859bad..9b252a2 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -266,7 +266,7 @@ class Environment: private_dir = 'meson-private' log_dir = 'meson-logs' - def __init__(self, source_dir, build_dir, options, original_cmd_line_args): + def __init__(self, source_dir, build_dir, options): self.source_dir = source_dir self.build_dir = build_dir self.scratch_dir = os.path.join(build_dir, Environment.private_dir) @@ -289,7 +289,6 @@ class Environment: else: self.cross_info = None self.cmd_line_options = options - self.original_cmd_line_args = original_cmd_line_args # List of potential compilers. if mesonlib.is_windows(): @@ -374,18 +373,6 @@ class Environment: def is_library(self, fname): return is_library(fname) - def had_argument_for(self, option): - trial1 = coredata.get_builtin_option_cmdline_name(option) - trial2 = '-D' + option - previous_is_plaind = False - for i in self.original_cmd_line_args: - if i.startswith(trial1) or i.startswith(trial2): - return True - if previous_is_plaind and i.startswith(option): - return True - previous_is_plaind = i == '-D' - return False - @staticmethod def get_gnu_compiler_defines(compiler): """ diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 0d210c4..facd3a3 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -54,10 +54,9 @@ def wrapmodetype(string): class MesonApp: - def __init__(self, dir1, dir2, handshake, options, original_cmd_line_args): + def __init__(self, dir1, dir2, handshake, options): (self.source_dir, self.build_dir) = self.validate_dirs(dir1, dir2, handshake) self.options = options - self.original_cmd_line_args = original_cmd_line_args def has_build_file(self, dirname): fname = os.path.join(dirname, environment.build_filename) @@ -109,7 +108,7 @@ class MesonApp: env.coredata.pkgconf_envvar = curvar def generate(self): - env = environment.Environment(self.source_dir, self.build_dir, self.options, self.original_cmd_line_args) + env = environment.Environment(self.source_dir, self.build_dir, self.options) mlog.initialize(env.get_log_dir()) with mesonlib.BuildDirLock(self.build_dir): self._generate(env) @@ -334,7 +333,7 @@ def run(original_args, mainfile): else: dir2 = '.' try: - app = MesonApp(dir1, dir2, handshake, options, original_args) + app = MesonApp(dir1, dir2, handshake, options) except Exception as e: # Log directory does not exist, so just print # to stdout. diff --git a/run_project_tests.py b/run_project_tests.py index ad367b1..36ee986 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -412,7 +412,7 @@ def have_d_compiler(): def have_objc_compiler(): with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir: - env = environment.Environment(None, build_dir, get_fake_options('/'), []) + env = environment.Environment(None, build_dir, get_fake_options('/')) try: objc_comp = env.detect_objc_compiler(False) except mesonlib.MesonException: @@ -427,7 +427,7 @@ def have_objc_compiler(): def have_objcpp_compiler(): with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir: - env = environment.Environment(None, build_dir, get_fake_options('/'), []) + env = environment.Environment(None, build_dir, get_fake_options('/')) try: objcpp_comp = env.detect_objcpp_compiler(False) except mesonlib.MesonException: diff --git a/run_unittests.py b/run_unittests.py index 79799ea..715dbe2 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -900,7 +900,7 @@ class AllPlatformTests(BasePlatformTests): https://github.com/mesonbuild/meson/issues/1355 ''' testdir = os.path.join(self.common_test_dir, '3 static') - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) cc = env.detect_c_compiler(False) static_linker = env.detect_static_linker(cc) if is_windows(): @@ -1181,7 +1181,7 @@ class AllPlatformTests(BasePlatformTests): if not is_windows(): langs += [('objc', 'OBJC'), ('objcpp', 'OBJCXX')] testdir = os.path.join(self.unit_test_dir, '5 compiler detection') - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) for lang, evar in langs: # Detect with evar and do sanity checks on that if evar in os.environ: @@ -1283,7 +1283,7 @@ class AllPlatformTests(BasePlatformTests): def test_always_prefer_c_compiler_for_asm(self): testdir = os.path.join(self.common_test_dir, '141 c cpp and asm') # Skip if building with MSVC - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) if env.detect_c_compiler(False).get_id() == 'msvc': raise unittest.SkipTest('MSVC can\'t compile assembly') self.init(testdir) @@ -1541,7 +1541,7 @@ int main(int argc, char **argv) { self.assertPathExists(os.path.join(testdir, i)) def detect_prebuild_env(self): - env = Environment('', self.builddir, get_fake_options(self.prefix), []) + env = Environment('', self.builddir, get_fake_options(self.prefix)) cc = env.detect_c_compiler(False) stlinker = env.detect_static_linker(cc) if mesonbuild.mesonlib.is_windows(): @@ -1709,7 +1709,7 @@ int main(int argc, char **argv) { '--libdir=' + libdir]) # Find foo dependency os.environ['PKG_CONFIG_LIBDIR'] = self.privatedir - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) kwargs = {'required': True, 'silent': True} foo_dep = PkgConfigDependency('libfoo', env, kwargs) # Ensure link_args are properly quoted @@ -1976,7 +1976,7 @@ recommended as it can lead to undefined behaviour on some platforms''') testdirbase = os.path.join(self.unit_test_dir, '26 guessed linker dependencies') testdirlib = os.path.join(testdirbase, 'lib') extra_args = None - env = Environment(testdirlib, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdirlib, self.builddir, get_fake_options(self.prefix)) if env.detect_c_compiler(False).get_id() != 'msvc': # static libraries are not linkable with -l with msvc because meson installs them # as .a files which unix_args_to_native will not know as it expects libraries to use @@ -2123,7 +2123,7 @@ recommended as it can lead to undefined behaviour on some platforms''') with open('docs/markdown/Builtin-options.md') as f: md = f.read() self.assertIsNotNone(md) - env = Environment('.', self.builddir, get_fake_options(self.prefix), []) + env = Environment('.', self.builddir, get_fake_options(self.prefix)) # FIXME: Support other compilers cc = env.detect_c_compiler(False) cpp = env.detect_cpp_compiler(False) @@ -2293,7 +2293,7 @@ class FailureTests(BasePlatformTests): ''' Test that when we can't detect objc or objcpp, we fail gracefully. ''' - env = Environment('', self.builddir, get_fake_options(self.prefix), []) + env = Environment('', self.builddir, get_fake_options(self.prefix)) try: env.detect_objc_compiler(False) env.detect_objcpp_compiler(False) @@ -2403,7 +2403,7 @@ class WindowsTests(BasePlatformTests): ExternalLibraryHolder from build files. ''' testdir = os.path.join(self.platform_test_dir, '1 basic') - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) cc = env.detect_c_compiler(False) if cc.id != 'msvc': raise unittest.SkipTest('Not using MSVC') @@ -2416,7 +2416,7 @@ class WindowsTests(BasePlatformTests): testdir = os.path.join(self.platform_test_dir, '5 resources') # resource compiler depfile generation is not yet implemented for msvc - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) depfile_works = env.detect_c_compiler(False).get_id() != 'msvc' self.init(testdir) @@ -2505,7 +2505,7 @@ class LinuxlikeTests(BasePlatformTests): ''' testdir = os.path.join(self.common_test_dir, '51 pkgconfig-gen') self.init(testdir) - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) kwargs = {'required': True, 'silent': True} os.environ['PKG_CONFIG_LIBDIR'] = self.privatedir foo_dep = PkgConfigDependency('libfoo', env, kwargs) @@ -2755,7 +2755,7 @@ class LinuxlikeTests(BasePlatformTests): an ordinary test because it requires passing options to meson. ''' testdir = os.path.join(self.common_test_dir, '1 trivial') - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) cc = env.detect_c_compiler(False) self._test_stds_impl(testdir, cc, 'c') @@ -2765,7 +2765,7 @@ class LinuxlikeTests(BasePlatformTests): be an ordinary test because it requires passing options to meson. ''' testdir = os.path.join(self.common_test_dir, '2 cpp') - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + env = Environment(testdir, self.builddir, get_fake_options(self.prefix)) cpp = env.detect_cpp_compiler(False) self._test_stds_impl(testdir, cpp, 'cpp') |