Move MesonException from coredata to mesonlib.

pull/438/head
Hemmo Nieminen 9 years ago
parent 5764bee2f4
commit 336904b553
  1. 2
      mesonbuild/backend/backends.py
  2. 3
      mesonbuild/backend/ninjabackend.py
  3. 2
      mesonbuild/backend/vs2010backend.py
  4. 2
      mesonbuild/backend/xcodebackend.py
  5. 8
      mesonbuild/build.py
  6. 2
      mesonbuild/compilers.py
  7. 5
      mesonbuild/coredata.py
  8. 2
      mesonbuild/dependencies.py
  9. 8
      mesonbuild/environment.py
  10. 6
      mesonbuild/interpreter.py
  11. 2
      mesonbuild/mconf.py
  12. 4
      mesonbuild/mesonlib.py
  13. 4
      mesonbuild/mesonmain.py
  14. 2
      mesonbuild/modules/gnome.py
  15. 12
      mesonbuild/modules/pkgconfig.py
  16. 2
      mesonbuild/modules/qt4.py
  17. 2
      mesonbuild/modules/qt5.py
  18. 2
      mesonbuild/modules/windows.py
  19. 2
      mesonbuild/mparser.py
  20. 5
      mesonbuild/optinterpreter.py

@ -18,7 +18,7 @@ from .. import dependencies
from .. import mesonlib
import json
import subprocess
from ..coredata import MesonException
from ..mesonlib import MesonException
class InstallData():
def __init__(self, source_dir, build_dir, prefix):

@ -18,10 +18,9 @@ from .. import build
from .. import mlog
from .. import dependencies
from .. import compilers
from ..mesonlib import File
from ..mesonlib import File, MesonException
from .backends import InstallData
from ..build import InvalidArguments
from ..coredata import MesonException
import os, sys, pickle, re
import subprocess, shutil

@ -24,7 +24,7 @@ from .. import dependencies
from .. import mlog
import xml.etree.ElementTree as ET
import xml.dom.minidom
from ..coredata import MesonException
from ..mesonlib import MesonException
from ..environment import Environment
class RegenInfo():

@ -17,7 +17,7 @@ from .. import build
from .. import mesonlib
import uuid, os, sys
from ..coredata import MesonException
from ..mesonlib import MesonException
class XCodeBackend(backends.Backend):
def __init__(self, build):

@ -17,7 +17,7 @@ from . import environment
from . import dependencies
from . import mlog
import copy, os
from .mesonlib import File, flatten
from .mesonlib import File, flatten, MesonException
known_basic_kwargs = {'install' : True,
'c_pch' : True,
@ -71,7 +71,7 @@ We are fully aware that these are not really usable or pleasant ways to do
this but it's the best we can do given the way shell quoting works.
'''
class InvalidArguments(coredata.MesonException):
class InvalidArguments(MesonException):
pass
class Build:
@ -299,10 +299,10 @@ class BuildTarget():
srclist = [srclist]
for src in srclist:
if not isinstance(src, str):
raise coredata.MesonException('Extraction arguments must be strings.')
raise MesonException('Extraction arguments must be strings.')
src = File(False, self.subdir, src)
if src not in self.sources:
raise coredata.MesonException('Tried to extract unknown source %s.' % src)
raise MesonException('Tried to extract unknown source %s.' % src)
obj_src.append(src)
return ExtractedObjects(self, obj_src)

@ -16,7 +16,7 @@ import subprocess, os.path
import tempfile
from .import mesonlib
from . import mlog
from .coredata import MesonException
from .mesonlib import MesonException
from . import coredata
"""This file contains the data files of all compilers Meson knows

@ -13,6 +13,7 @@
# limitations under the License.
import pickle, os, uuid
from .mesonlib import MesonException
version = '0.31.0.dev1'
@ -39,10 +40,6 @@ builtin_options = {'buildtype': True,
'default_library': True,
}
class MesonException(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class UserOption:
def __init__(self, name, description, choices):
super().__init__()

@ -22,7 +22,7 @@
import re
import os, stat, glob, subprocess, shutil
import sysconfig
from . coredata import MesonException
from . mesonlib import MesonException
from . import mlog
from . import mesonlib

@ -19,7 +19,7 @@ import configparser
build_filename = 'meson.build'
class EnvironmentException(coredata.MesonException):
class EnvironmentException(mesonlib.MesonException):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -657,11 +657,11 @@ class CrossBuildInfo():
if 'target_machine' in self.config:
return
if not 'host_machine' in self.config:
raise coredata.MesonException('Cross info file must have either host or a target machine.')
raise mesonlib.MesonException('Cross info file must have either host or a target machine.')
if not 'properties' in self.config:
raise coredata.MesonException('Cross file is missing "properties".')
raise mesonlib.MesonException('Cross file is missing "properties".')
if not 'binaries' in self.config:
raise coredata.MesonException('Cross file is missing "binaries".')
raise mesonlib.MesonException('Cross file is missing "binaries".')
def ok_type(self, i):
return isinstance(i, str) or isinstance(i, int) or isinstance(i, bool)

@ -28,7 +28,7 @@ from functools import wraps
import importlib
class InterpreterException(coredata.MesonException):
class InterpreterException(mesonlib.MesonException):
pass
class InvalidCode(InterpreterException):
@ -932,7 +932,7 @@ class Interpreter():
assert(isinstance(code, str))
try:
self.ast = mparser.Parser(code).parse()
except coredata.MesonException as me:
except mesonlib.MesonException as me:
me.file = environment.build_filename
raise me
self.sanity_check_ast()
@ -1801,7 +1801,7 @@ class Interpreter():
assert(isinstance(code, str))
try:
codeblock = mparser.Parser(code).parse()
except coredata.MesonException as me:
except mesonlib.MesonException as me:
me.file = buildfilename
raise me
self.evaluate_codeblock(codeblock)

@ -26,7 +26,7 @@ parser.add_argument('-D', action='append', default=[], dest='sets',
help='Set an option to the given value.')
parser.add_argument('directory', nargs='*')
class ConfException(coredata.MesonException):
class ConfException(mesonlib.MesonException):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

@ -18,7 +18,9 @@ import platform, subprocess, operator, os, shutil, re, sys
from glob import glob
from .coredata import MesonException
class MesonException(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class File:
def __init__(self, is_built, subdir, fname):

@ -21,8 +21,8 @@ from . import environment, interpreter, mesonlib
from . import build
import platform
from . import mlog, coredata
from .coredata import MesonException, build_types, layouts, warning_levels, libtypelist
from .mesonlib import MesonException
from .coredata import build_types, layouts, warning_levels, libtypelist
backendlist = ['ninja', 'vs2010', 'xcode']

@ -18,7 +18,7 @@ functionality such as gobject-introspection and gresources.'''
from .. import build
import os, sys
import subprocess
from ..coredata import MesonException
from ..mesonlib import MesonException
from .. import mlog
from .. import mesonlib

@ -55,7 +55,7 @@ class PkgConfigModule:
def generate(self, state, args, kwargs):
if len(args) > 0:
raise coredata.MesonException('Pkgconfig_gen takes no positional arguments.')
raise mesonlib.MesonException('Pkgconfig_gen takes no positional arguments.')
libs = kwargs.get('libraries', [])
if not isinstance(libs, list):
libs = [libs]
@ -64,22 +64,22 @@ class PkgConfigModule:
if hasattr(l, 'held_object'):
l = l.held_object
if not (isinstance(l, build.SharedLibrary) or isinstance(l, build.StaticLibrary)):
raise coredata.MesonException('Library argument not a library object.')
raise mesonlib.MesonException('Library argument not a library object.')
processed_libs.append(l)
libs = processed_libs
subdirs = mesonlib.stringlistify(kwargs.get('subdirs', ['.']))
version = kwargs.get('version', '')
if not isinstance(version, str):
raise coredata.MesonException('Version must be a string.')
raise mesonlib.MesonException('Version must be a string.')
name = kwargs.get('name', None)
if not isinstance(name, str):
raise coredata.MesonException('Name not specified.')
raise mesonlib.MesonException('Name not specified.')
filebase = kwargs.get('filebase', name)
if not isinstance(filebase, str):
raise coredata.MesonException('Filebase must be a string.')
raise mesonlib.MesonException('Filebase must be a string.')
description = kwargs.get('description', None)
if not isinstance(description, str):
raise coredata.MesonException('Description is not a string.')
raise mesonlib.MesonException('Description is not a string.')
pub_reqs = mesonlib.stringlistify(kwargs.get('requires', []))
priv_reqs = mesonlib.stringlistify(kwargs.get('requires_private', []))
priv_libs = mesonlib.stringlistify(kwargs.get('libraries_private', []))

@ -15,7 +15,7 @@
from .. import dependencies, mlog
import os, subprocess
from .. import build
from ..coredata import MesonException
from ..mesonlib import MesonException
import xml.etree.ElementTree as ET
class Qt4Module():

@ -15,7 +15,7 @@
from .. import dependencies, mlog
import os, subprocess
from .. import build
from ..coredata import MesonException
from ..mesonlib import MesonException
import xml.etree.ElementTree as ET
class Qt5Module():

@ -13,7 +13,7 @@
# limitations under the License.
from .. import mesonlib, dependencies, build
from ..coredata import MesonException
from ..mesonlib import MesonException
import os
class WindowsModule:

@ -13,7 +13,7 @@
# limitations under the License.
import re
from .coredata import MesonException
from .mesonlib import MesonException
class ParseException(MesonException):
def __init__(self, text, lineno, colno):

@ -14,6 +14,7 @@
from . import mparser
from . import coredata
from . import mesonlib
import os, re
forbidden_option_names = coredata.builtin_options
@ -37,7 +38,7 @@ def is_invalid_name(name):
return True
return False
class OptionException(coredata.MesonException):
class OptionException(mesonlib.MesonException):
pass
optname_regex = re.compile('[^a-zA-Z0-9_-]')
@ -77,7 +78,7 @@ class OptionInterpreter:
def process(self, option_file):
try:
ast = mparser.Parser(open(option_file, 'r', encoding='utf8').read()).parse()
except coredata.MesonException as me:
except mesonlib.MesonException as me:
me.file = option_file
raise me
if not isinstance(ast, mparser.CodeBlockNode):

Loading…
Cancel
Save