build_extension.

        :raises BuildFailed: cythonize impossible
516239
def build_extension(self, ext):
        
        try:
            build_ext.build_ext.build_extension(self, ext)
        except (
            distutils.errors.CCompilerError,
            distutils.errors.DistutilsExecError,
            distutils.errors.DistutilsPlatformError,
            ValueError,
        ):
            raise BuildFailed()
707211
def maybe_cythonize_extensions(top_path, config):
    """"""
    is_release = os.path.exists(os.path.join(top_path, 'PKG-INFO'))

    if is_release:
        build_from_c_and_cpp_files(config.ext_modules)
    else:
        message = ('Please install cython with a version >= {0} in order '
                   'to build a scikit-survival development version.').format(
                       CYTHON_MIN_VERSION)
        try:
            import Cython
            if LooseVersion(Cython.__version__) < CYTHON_MIN_VERSION:
                message += ' Your version of Cython was {0}.'.format(
                    Cython.__version__)
                raise ValueError(message)
            from Cython.Build import cythonize
        except ImportError as exc:
            exc.args += (message,)
            raise

        # http://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#cythonize-arguments
        directives = {'language_level': '3'}
        cy_cov = os.environ.get('CYTHON_COVERAGE', False)
        if cy_cov:
            directives['linetrace'] = True
            macros = [('CYTHON_TRACE', '1'), ('CYTHON_TRACE_NOGIL', '1')]
        else:
            macros = []

        config.ext_modules = cythonize(
            config.ext_modules,
            compiler_directives=directives)

        for e in config.ext_modules:
            e.define_macros.extend(macros)
687399
def build_single(mode):
    """"""
    if mode == 'force':
        amode = ['-a']
    else:
        amode = []
    if executable.endswith('uwsgi'):
        # hack, might fail in some environments!
        _executable = executable[:-5] + 'python'
    else:
        _executable = executable
    p = subprocess.Popen([_executable, '-m', 'nikola', 'build'] + amode,
                         stderr=subprocess.PIPE)
    p.wait()
    rl = p.stderr.readlines()
    try:
        out = ''.join(rl)
    except TypeError:
        out = ''.join(l.decode('utf-8') for l in rl)
    return (p.returncode == 0), out
991697
def build(self):
        
        if not self.build_cmds:
            LOGGER.debug('No build commands were found, skipping build step')

        with LogTask('Building {} disk {}'.format(self.name, self.disk_path)):
            for command in self.build_cmds:
                with LogTask('Running command {}'.format(command.name)):
                    LOGGER.debug(command.cmd)
                    result = utils.run_command(command.cmd)
                    if result:
                        raise BuildException(result.err)
1141006
def build(filenames, uri, cl_args, link_args, x64, native):
    
    logging.info(_('This is source file building mode.'))
    logging.debug(_('filenames: %s'), filenames)
    logging.debug(_('uri: %s'), uri)
    logging.debug(_('cl_args: %s'), cl_args)
    logging.debug(_('link_args: %s'), link_args)
    logging.debug(_('native: %s'), native)
    logging.debug(_('x64: %s'), x64)

    if is_windows():
        pass
        # ret = msbuild(uri, native, list(filenames), x64=x64,
        #               cl_args=cl_args, link_args=link_args)
    else:
        builder = LinuxBuilder()
        ret = builder.build(filenames, x64, 'src', 'out')
    sys.exit(ret)
691669
def build(self, construct):
        
        if lib.EnvBuild(self._env, construct.encode()) != 1:
            raise CLIPSError(self._env)
1252535
def buildschema(_cls=None, **kwargs):
    
    if _cls is None:
        return lambda _cls: buildschema(_cls=_cls, **kwargs)

    result = build(_cls, **kwargs)

    return result
1088228
def build(self, filenames, cl_args=None, link_args=None,
              x64=False, out_dir=''):
        
        if not cl_args:
            cl_args = []
        if not link_args:
            link_args = []
        msvc, lib = self.vc.get_bin_and_lib(x64)
        lib = self.make_lib(lib)
        if out_dir:
            cl_args.append('/Fo:' + out_dir + '\\')
        include = self.make_inc(self.vc.inc + self.sdk.inc)
        cl_args.extend(include + filenames)
        try:
            msvc.run_cl('/c', *cl_args)
        except CalledProcessError as error:
            logging.error(_('failed to compile: %s'), filenames)
            logging.error(_('cl.exe returned:\n%s'), error.output)
            return False
        link_args.extend(lib + self.make_objs(filenames, out_dir))
        try:
            msvc.run_link(*link_args)
        except CalledProcessError as error:
            logging.error(_('failed to link: %s'), filenames)
            logging.error(_('link.exe returned:\n%s'), error.output)
            return False
        return True
471040
def build_arch(self, arch):
        ''''''
        super(PythonRecipe, self).build_arch(arch)
        self.install_python_package(arch)
288370
def build_arch(self, arch):
        '''
        '''
        Recipe.build_arch(self, arch)
        self.build_cython_components(arch)
        self.install_python_package(arch)
509835
def create_python_bundle(self, dirn, arch):
        
        # Todo: find a better way to find the build libs folder
        modules_build_dir = join(
            self.get_build_dir(arch.arch),
            'android-build',
            'build',
            'lib.linux{}-{}-{}'.format(
                '2' if self.version[0] == '2' else '',
                arch.command_prefix.split('-')[0],
                self.major_minor_version_string
            ))

        # Compile to *.pyc/*.pyo the python modules
        self.compile_python_files(modules_build_dir)
        # Compile to *.pyc/*.pyo the standard python library
        self.compile_python_files(join(self.get_build_dir(arch.arch), 'Lib'))
        # Compile to *.pyc/*.pyo the other python packages (site-packages)
        self.compile_python_files(self.ctx.get_python_install_dir())

        # Bundle compiled python modules to a folder
        modules_dir = join(dirn, 'modules')
        c_ext = self.compiled_extension
        ensure_dir(modules_dir)
        module_filens = (glob.glob(join(modules_build_dir, '*.so')) +
                         glob.glob(join(modules_build_dir, '*' + c_ext)))
        info("Copy {} files into the bundle".format(len(module_filens)))
        for filen in module_filens:
            info(" - copy {}".format(filen))
            copy2(filen, modules_dir)

        # zip up the standard library
        stdlib_zip = join(dirn, 'stdlib.zip')
        with current_directory(join(self.get_build_dir(arch.arch), 'Lib')):
            stdlib_filens = list(walk_valid_filens(
                '.', self.stdlib_dir_blacklist, self.stdlib_filen_blacklist))
            info("Zip {} files into the bundle".format(len(stdlib_filens)))
            shprint(sh.zip, stdlib_zip, *stdlib_filens)

        # copy the site-packages into place
        ensure_dir(join(dirn, 'site-packages'))
        ensure_dir(self.ctx.get_python_install_dir())
        # TODO: Improve the API around walking and copying the files
        with current_directory(self.ctx.get_python_install_dir()):
            filens = list(walk_valid_filens(
                '.', self.site_packages_dir_blacklist,
                self.site_packages_filen_blacklist))
            info("Copy {} files into the site-packages".format(len(filens)))
            for filen in filens:
                info(" - copy {}".format(filen))
                ensure_dir(join(dirn, 'site-packages', dirname(filen)))
                copy2(filen, join(dirn, 'site-packages', filen))

        # copy the python .so files into place
        python_build_dir = join(self.get_build_dir(arch.arch),
                                'android-build')
        python_lib_name = 'libpython' + self.major_minor_version_string
        if self.major_minor_version_string[0] == '3':
            python_lib_name += 'm'
        shprint(sh.cp, join(python_build_dir, python_lib_name + '.so'),
                join(self.ctx.dist_dir, self.ctx.dist_name, 'libs', arch.arch))

        info('Renaming .so files to reflect cross-compile')
        self.reduce_object_file_names(join(dirn, 'site-packages'))

        return join(dirn, 'site-packages')
532439
def build_arch(self, arch):
        
        self.ctx.hostpython = '/usr/bin/false'
        # creates the sub buildir (used by other recipes)
        # https://github.com/kivy/python-for-android/issues/1154
        sub_build_dir = join(self.get_build_dir(), 'build')
        shprint(sh.mkdir, '-p', sub_build_dir)
        python3crystax = self.get_recipe('python3crystax', self.ctx)
        system_python = sh.which("python" + python3crystax.version)
        if system_python is None:
            raise OSError(
                ('Trying to use python3crystax=={} but this Python version '
                 'is not installed locally.').format(python3crystax.version))
        link_dest = join(self.get_build_dir(), 'hostpython')
        shprint(sh.ln, '-sf', system_python, link_dest)
1361111
def run_build_cli():
    
    args = parse_args()

    if args.verbose:
        log_level = logging.DEBUG
    else:
        log_level = logging.INFO
    logging.basicConfig(
        level=log_level,
        format='%(asctime)s %(levelname)s %(name)s: %(message)s')

    logger = logging.getLogger(__name__)

    logger.info('build-stack-docs version {0}'.format(__version__))

    return_code = build_stack_docs(args.root_project_dir)
    if return_code == 0:
        logger.info('build-stack-docs succeeded')
        sys.exit(0)
    else:
        logger.error('Sphinx errored: code {0:d}'.format(return_code))
        sys.exit(1)
665360
def build(self, format='qcow2', path='/tmp'):
        '''
        
        '''
        if kiwi is None:
            msg = 'Unable to build the image due to the missing dependencies: Kiwi module is not available.'
            log.error(msg)
            raise CommandExecutionError(msg)

        raise CommandExecutionError("Build is not yet implemented")
352792
def build_mode(arg_namespace):
    """"""
    custom_temps = arg_namespace.template or []
    temp_paths = [rel_to_cwd('templates', temp) for temp in custom_temps]

    try:
        builder.build(templates=temp_paths,
                      schemes=arg_namespace.scheme,
                      base_output_dir=arg_namespace.output)
    except (LookupError, PermissionError) as exception:
        if isinstance(exception, LookupError):
            print('Necessary resources for building not found in current '
                  'working directory.')
        if isinstance(exception, PermissionError):
            print("No write permission for output directory.")
518464
def build(self, context, variant, build_path, install_path, install=False,
              build_type=BuildType.local):
        
        ret = {}

        if self.write_build_scripts:
            # write out the script that places the user in a build env, where
            # they can run bez directly themselves.
            build_env_script = os.path.join(build_path, "build-env")
            create_forwarding_script(build_env_script,
                                     module=("build_system", "custom"),
                                     func_name="_FWD__spawn_build_shell",
                                     working_dir=self.working_dir,
                                     build_path=build_path,
                                     variant_index=variant.index,
                                     install=install,
                                     install_path=install_path)

            ret["success"] = True
            ret["build_env_script"] = build_env_script
            return ret

        # get build command
        command = self.package.build_command

        # False just means no build command
        if command is False:
            ret["success"] = True
            return ret

        def expand(txt):
            root = self.package.root
            install_ = "install" if install else ''
            return txt.format(root=root, install=install_).strip()

        if isinstance(command, basestring):
            if self.build_args:
                command = command + ' ' + ' '.join(map(quote, self.build_args))

            command = expand(command)
            cmd_str = command
        else:  # list
            command = command + self.build_args
            command = map(expand, command)
            cmd_str = ' '.join(map(quote, command))

        if self.verbose:
            pr = Printer(sys.stdout)
            pr("Running build command: %s" % cmd_str, heading)

        # run the build command
        def _callback(executor):
            self._add_build_actions(executor,
                                    context=context,
                                    package=self.package,
                                    variant=variant,
                                    build_type=build_type,
                                    install=install,
                                    build_path=build_path,
                                    install_path=install_path)

            if self.opts:
                # write args defined in ./parse_build_args.py out as env vars
                extra_args = getattr(self.opts.parser, "_rezbuild_extra_args", [])

                for key, value in vars(self.opts).iteritems():
                    if key in extra_args:
                        varname = "__PARSE_ARG_%s" % key.upper()

                        # do some value conversions
                        if isinstance(value, bool):
                            value = 1 if value else 0
                        elif isinstance(value, (list, tuple)):
                            value = map(str, value)
                            value = map(quote, value)
                            value = ' '.join(value)

                        executor.env[varname] = value

        retcode, _, _ = context.execute_shell(command=command,
                                              block=True,
                                              cwd=build_path,
                                              actions_callback=_callback)
        ret["success"] = (not retcode)
        return ret
130718
def build(pattern=None, path='.'):
    
    path = abspath(path)
    c = Clay(path)
    c.build(pattern)