Ejemplo n.º 1
0
 def has_function(self, funcname: str, prefix: str, env: 'Environment', *,
                  extra_args: T.Optional[T.List[str]] = None,
                  dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
     raise MesonException('Fortran does not have "has_function" capability.\n'
                          'It is better to test if a Fortran capability is working like:\n\n'
                          "meson.get_compiler('fortran').links('block; end block; end program')\n\n"
                          'that example is to see if the compiler has Fortran 2008 Block element.')
Ejemplo n.º 2
0
def run(options):
    options.wd = os.path.abspath(options.wd)
    buildfile = Path(options.wd) / 'meson-private' / 'build.dat'
    if not buildfile.is_file():
        raise MesonException(
            f'Directory {options.wd!r} does not seem to be a Meson build directory.'
        )
    b = build.load(options.wd)
    # This import must be load delayed, otherwise it will get the default
    # value of None.
    from mesonbuild.mesonlib import get_meson_command
    src_root = b.environment.source_dir
    bld_root = b.environment.build_dir
    priv_dir = os.path.join(bld_root, 'meson-private')
    dist_sub = os.path.join(bld_root, 'meson-dist')

    dist_name = b.project_name + '-' + b.project_version

    archives = determine_archives_to_generate(options)

    subprojects = {}
    extra_meson_args = []
    if options.include_subprojects:
        subproject_dir = os.path.join(src_root, b.subproject_dir)
        for sub in b.subprojects:
            directory = wrap.get_directory(subproject_dir, sub)
            subprojects[sub] = os.path.join(b.subproject_dir, directory)
        extra_meson_args.append('-Dwrap_mode=nodownload')

    if is_git(src_root):
        names = create_dist_git(dist_name, archives, src_root, bld_root,
                                dist_sub, b.dist_scripts, subprojects)
    elif is_hg(src_root):
        if subprojects:
            print(
                '--include-subprojects option currently not supported with Mercurial'
            )
            return 1
        names = create_dist_hg(dist_name, archives, src_root, bld_root,
                               dist_sub, b.dist_scripts)
    else:
        print('Dist currently only works with Git or Mercurial repos')
        return 1
    if names is None:
        return 1
    rc = 0
    if not options.no_tests:
        # Check only one.
        rc = check_dist(names[0], get_meson_command(), extra_meson_args,
                        bld_root, priv_dir)
    if rc == 0:
        for name in names:
            create_hash(name)
            print('Created', name)
    return rc
Ejemplo n.º 3
0
 def has_function(self,
                  funcname,
                  prefix,
                  env,
                  *,
                  extra_args=None,
                  dependencies=None):
     raise MesonException(
         'Fortran does not have "has_function" capability.\n'
         'It is better to test if a Fortran capability is working like:\n\n'
         "meson.get_compiler('fortran').links('block; end block; end program')\n\n"
         'that example is to see if the compiler has Fortran 2008 Block element.'
     )
Ejemplo n.º 4
0
def gtkdoc_run_check(cmd, cwd):
    p = subprocess.Popen(cmd,
                         cwd=cwd,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    (stde, stdo) = p.communicate()
    if p.returncode != 0:
        err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)]
        if stde:
            err_msg.append(stde.decode(errors='ignore'))
        if stdo:
            err_msg.append(stdo.decode(errors='ignore'))
        raise MesonException('\n'.join(err_msg))
Ejemplo n.º 5
0
def run(options):
    options.wd = os.path.abspath(options.wd)
    buildfile = Path(options.wd) / 'meson-private' / 'build.dat'
    if not buildfile.is_file():
        raise MesonException(
            'Directory {!r} does not seem to be a Meson build directory.'.
            format(options.wd))
    b = build.load(options.wd)
    # This import must be load delayed, otherwise it will get the default
    # value of None.
    from mesonbuild.mesonlib import meson_command
    src_root = b.environment.source_dir
    bld_root = b.environment.build_dir
    priv_dir = os.path.join(bld_root, 'meson-private')
    dist_sub = os.path.join(bld_root, 'meson-dist')

    dist_name = b.project_name + '-' + b.project_version

    archives = determine_archives_to_generate(options)

    _git = os.path.join(src_root, '.git')
    if os.path.isdir(_git) or os.path.isfile(_git):
        names = create_dist_git(dist_name, archives, src_root, bld_root,
                                dist_sub, b.dist_scripts)
    elif os.path.isdir(os.path.join(src_root, '.hg')):
        names = create_dist_hg(dist_name, archives, src_root, bld_root,
                               dist_sub, b.dist_scripts)
    else:
        print('Dist currently only works with Git or Mercurial repos')
        return 1
    if names is None:
        return 1
    # Check only one.
    rc = check_dist(names[0], meson_command, bld_root, priv_dir)
    if rc == 0:
        for name in names:
            create_hash(name)
    return rc
Ejemplo n.º 6
0
 def handle_error(self):
     if self.skip_errors:
         return None
     raise MesonException('Rewriting the meson.build failed')