Perform build_cmake before doing the 'normal' stuff
434383
def run(self):
        

        for extension in self.extensions:

            if extension.name == "bpy":

                self.build_cmake(extension)

        super().run()
1083479
def build_cpp(build_context, target, compiler_config, workspace_dir):
    """"""
    rmtree(workspace_dir)
    binary = join(*split(target.name))
    objects = link_cpp_artifacts(build_context, target, workspace_dir, True)
    buildenv_workspace = build_context.conf.host_to_buildenv_path(
        workspace_dir)
    objects.extend(compile_cc(
        build_context, compiler_config, target.props.in_buildenv,
        get_source_files(target, build_context), workspace_dir,
        buildenv_workspace, target.props.cmd_env))
    bin_file = join(buildenv_workspace, binary)
    link_cmd = (
        [compiler_config.linker, '-o', bin_file] +
        objects + compiler_config.link_flags)
    build_context.run_in_buildenv(
        target.props.in_buildenv, link_cmd, target.props.cmd_env)
    target.artifacts.add(AT.binary, relpath(join(workspace_dir, binary),
                         build_context.conf.project_root), binary)
1299816
def compile
      begin
        FileUtils.mkdir_p(app_home_dir)
      rescue Errno::EACCES => e
        Pkgr.logger.warn "Can't create #{app_home_dir.inspect}, which may be needed by some buildpacks."
      end
      FileUtils.mkdir_p(compile_cache_dir)
      FileUtils.mkdir_p(compile_env_dir)

      if buildpacks_for_app.size > 0
        run_hook config.before_hook

        buildpacks_for_app.each do |buildpack|
          puts "-----> #{buildpack.banner} app"
          buildpack.compile(source_dir, compile_cache_dir, compile_env_dir)
          buildpack.release(source_dir)
        end

        run_hook config.after_hook
      else
        raise Errors::UnknownAppType, "Can't find a buildpack for your app"
      end
    end
930812
def do_print(filename):
    """"""
    with open(filename) as cmake_file:
        body = ast.parse(cmake_file.read())

        word_print = _print_details(lambda n: "{0} {1}".format(n.type,
                                                               n.contents))
        ast_visitor.recurse(body,
                            while_stmnt=_print_details(),
                            foreach=_print_details(),
                            function_def=_print_details(),
                            macro_def=_print_details(),
                            if_block=_print_details(),
                            if_stmnt=_print_details(),
                            elseif_stmnt=_print_details(),
                            else_stmnt=_print_details(),
                            function_call=_print_details(lambda n: n.name),
                            word=word_print)
630605
def run(self):
        """"""
        self._make_lib_file_symbolic_links()
        self._copy_each_include_files_to_include_dir()
        self._make_dep_lib_file_sym_links_and_copy_include_files()
        self.setup_py.add_patchs_to_build_without_pkg_config(
            self.rpm.lib_dir, self.rpm.include_dir
        )
        self.setup_py.apply_and_save()
        self._build_and_install()
1078563
def build(self):
        """"""
        for cmd in self.build_cmds:
            log.info('building command: {}'.format(cmd))
            full_cmd = 'cd {}; {}'.format(self.analyses_path, cmd)
            log.debug('full command: {}'.format(full_cmd))
            subprocess.call(full_cmd, shell=True)
            log.info('build done')
959050
def configure_cmake(self):
        
        cmake = CMake(self)
        cmake.definitions["FLATBUFFERS_BUILD_TESTS"] = False
        cmake.definitions["FLATBUFFERS_BUILD_SHAREDLIB"] = self.options.shared
        cmake.definitions["FLATBUFFERS_BUILD_FLATLIB"] = not self.options.shared
        cmake.configure()
        return cmake
769094
def run_build(self, compiler=GCC, inputs=None, output=None):
        
        logger.info("Running build steps ...")
        self.run_configure(mandatory=False)
        self.run_make(mandatory=False)
        self.run_compiler(compiler=compiler,
                          inputs=inputs,
                          output=output)
796065
async function build() {
  await run(clean);
  await run(copy);
  await run(bundle);

  if (process.argv.includes('--static')) {
    await run(render);
  }

  if (process.argv.includes('--docker')) {
    cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], {
      stdio: 'inherit',
    });
  }
}
317535
def pref_init():
    """"""

    # make sure we have a ~/.cdk dir
    if not isdir(PREFS_DIR):
        mkdir(PREFS_DIR)
    # make sure we have a default prefs file
    if not isfile(PREFS_FILE):
        copy(join(LOCATION, "custom", "prefs"), PREFS_DIR)
844107
def build(self):
        
        packages = self.packages()
        if packages:
            for pkg in packages:
                if not os.path.exists(self.meta.build_path):
                    os.mkdir(self.meta.build_path)
                if not os.path.exists(self._SOURCES):
                    os.mkdir(self._SOURCES)
                sbo_url = sbo_search_pkg(pkg)
                sbo_dwn = SBoLink(sbo_url).tar_gz()
                source_dwn = SBoGrep(pkg).source().split()
                sources = []
                os.chdir(self.meta.build_path)
                script = sbo_dwn.split("/")[-1]
                Download(self.meta.build_path, sbo_dwn.split(),
                         repo="sbo").start()
                for src in source_dwn:
                    Download(self._SOURCES, src.split(), repo="sbo").start()
                    sources.append(src.split("/")[-1])
                BuildPackage(script, sources, self.meta.build_path,
                             auto=False).build()
        else:
            print("\nPackages not found in the queue for building\n")
            raise SystemExit(1)
394838
def pre_run(self, outline=False, dump=False, *args, **kwargs):
        """"""
        if should_ensure_cfn_bucket(outline, dump):
            self.ensure_cfn_bucket()
        hooks = self.context.config.pre_build
        handle_hooks(
            "pre_build",
            hooks,
            self.provider,
            self.context,
            dump,
            outline
        )
1019293
def main():
    """"""

    # Prepare and run cmdline-parser.
    cmdlineParser = argparse.ArgumentParser(
                    description="Fixes the input files used for pre-processing of Boost.MPL headers.")
    cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
                               help="Be a little bit more verbose.")
    cmdlineParser.add_argument("--check-only", dest='checkonly', action='store_true',
                               help="Only checks if fixing is required.")
    cmdlineParser.add_argument(dest='sourceDir', metavar="<source-dir>",
                               type=to_existing_absolute_path,
                               help="The source-directory of Boost.")
    args = cmdlineParser.parse_args()

    # Some verbose debug output.
    if args.verbose:
        print "Arguments extracted from command-line:"
        print "  verbose           = ", args.verbose
        print "  check-only        = ", args.checkonly
        print "  source directory  = ", args.sourceDir

    # The directories for header- and source files of Boost.MPL.    
    # NOTE: Assuming 'args.sourceDir' is the source-directory of the entire boost project.
    headerDir = os.path.join( args.sourceDir, "boost", "mpl" )
    sourceDir = os.path.join( args.sourceDir, "libs", "mpl", "preprocessed" )
    # Check that the header/source-directories exist.
    if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ):
        # Maybe 'args.sourceDir' is not the source-directory of the entire boost project
        # but instead of the Boost.MPL git-directory, only?
        headerDir = os.path.join( args.sourceDir, "include", "boost", "mpl" )
        sourceDir = os.path.join( args.sourceDir, "preprocessed" )
        if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ):
            cmdlineParser.print_usage()
            print "error: Cannot find Boost.MPL header/source files in given Boost source-directory!"
            sys.exit(0)

    # Some verbose debug output.
    if args.verbose:
        print "Chosen header-directory: ", headerDir
        print "Chosen source-directory: ", sourceDir

    if args.checkonly:
        # Check input files for generating pre-processed headers.
        result = check_input_files(headerDir, sourceDir, verbose = args.verbose)
        if result:
            print "Fixing the input-files used for pre-processing of Boost.MPL headers IS required."
        else:
            print "Fixing the input-files used for pre-processing of Boost.MPL headers is NOT required."
    else:
        # Fix input files for generating pre-processed headers.
        fix_input_files(headerDir, sourceDir, verbose = args.verbose)
1147751
def build_cmake(self, extension: Extension):
        

        # We import the setup_requires modules here because if we import them
        # at the top this script will always fail as they won't be present

        from git import Repo as GitRepo
        from svn.remote import RemoteClient as SvnRepo

        self.announce("Preparing the build environment", level=3)

        blender_dir = os.path.join(BLENDERPY_DIR, "blender")

        build_dir = pathlib.Path(self.build_temp)

        extension_path = pathlib.Path(self.get_ext_fullpath(extension.name))

        os.makedirs(blender_dir, exist_ok=True)
        os.makedirs(str(build_dir), exist_ok=True)
        os.makedirs(str(extension_path.parent.absolute()), exist_ok=True)

        # Now that the necessary directories are created, ensure that OS 
        # specific steps are performed; a good example is checking on linux 
        # that the required build libraries are in place.

        os_build_args = []

        # Have to find the correct release tag to checkout here, as potentially
        # master may not be the correct one for this Python version. We use svn
        # to find whether or not master, or a specific tag supports the 
        # current python version

        if sys.platform == "win32": # Windows only steps

            import winreg

            vs_versions = []

            for version in [12, 14, 15]:

                try:

                    winreg.OpenKey(winreg.HKEY_CLASSES_ROOT,
                                   f"VisualStudio.DTE.{version}.0")

                except:

                    pass
                    
                else:

                    vs_versions.append(version)

            if not vs_versions:

                raise Exception("Windows users must have Visual Studio 2013 "
                                "or later installed")

            if max(vs_versions) == 15:

                os_build_args += ["-G", f"Visual Studio 15 2017"
                                        f"{' Win64' if BITS == 64 else ''}"]

            elif max(vs_versions) == 14:

                os_build_args += ["-G", f"Visual Studio 14 2015"
                                        f"{' Win64' if BITS == 64 else ''}"]

            elif max(vs_versions) == 12:

                os_build_args += ["-G", f"Visual Studio 12 2013"
                                        f"{' Win64' if BITS == 64 else ''}"]

            # TODO: Clean up here

            svn_lib_options += [f"win{64 if BITS == 64 else 'dows'}_vc{version}" 
                                for version in vs_versions]

            blender_svn_repo = SvnRepo(svn_url)

            os.makedirs(svn_dir, exist_ok=True)

            self.announce(f"Checking out svn libs from {svn_url}", level=3)

            try:
                
                blender_svn_repo.checkout(svn_dir)

            except Exception as e:

                self.warn("Windows users must have the svn executable "
                          "available from the command line")
                self.warn("Please install Tortoise SVN with \"command line "
                          "client tools\" as described here")
                self.warn("https://stackoverflow.com/questions/1625406/using-"
                          "tortoisesvn-via-the-command-line")
                raise e

        elif sys.platform == "linux": # Linux only steps

            # TODO: Test linux environment, issue #1

            pass

        elif sys.platform == "darwin": # MacOS only steps

            # TODO: Test MacOS environment, issue #2

            pass

        # Perform relatively common build steps

        # TODO: if blender desired version, then see if we can install that
        # Otherwise fail, if no desired version, find the latest version that
        # supports our python and install that

        git_repo = GitRepo(GIT_BASE_URL)
        svn_repo = SvnRepo(SVN_BASE_URL)

        if BLENDER_DESIRED_VERSION:

            match = BLENDER_VERSION_REGEX.match(BLENDER_DESIRED_VERSION)

            if match:

                # We have a blender version that conforms to the naming scheme
                # now to see if it actually exists in git and svn

                if match.group(0) in git_repo.tags:

                    # The version was tagged in the git repository
                    # now, format the version to match the svn versioning 
                    # scheme...

                    svn_version_tag = (f"blender-{match.group(1)}"
                                       f"{match.group(2) if not match.group(2).startswith("-rc")}-release")

                    svn_tag_repo = SvnRepo(os.path.join(SVN_BASE_URL, SVN_TAGS))

                    if svn_version_tag in svn_tag_repo.list():

                        # The version was released in svn and we found it
                        # Now, is it compatible with our OS and python version?

                    else:

                        raise Exception(f"{BLENDER_DESIRED_VERSION} was found "
                                        f"in the git repository but not the "
                                        f"svn repository.")

                else:

                    raise Exception(f"The provided version "
                                    f"{BLENDER_DESIRED_VERSION} does not "
                                    f"exist; please check "
                                    f"https://git.blender.org/gitweb/"
                                    f"gitweb.cgi/blender.git/tags for a list "
                                    f"of valid Blender releases")

            else:

                # The blender version did not conform to the naming scheme
                # fail and notify the user how to list the version

                raise Exception(f"The provided version "
                                f"{BLENDER_DESIRED_VERSION} did not match "
                                f"Blender's naming scheme. Please list your "
                                f"desired version as 'v' followed by a digit, "
                                f"followed by a period, followed by two "
                                f"digits and either 'a', 'b', 'c' or '-rc' "
                                f"(versions using '-rc' can optionally add "
                                f"a number which specifies which release "
                                f"candidate they want to install) such that "
                                f"the version looks like the following: "
                                f"v2.74-rc2")

        else:

            if sys.version_info >= (3, 6):

                # we can get from svn and git master branch

            else:

                # we must find a compatible version

        self.announce(f"Cloning Blender source from {BLENDER_GIT_REPO_URL}",
                      level=3)

        try:

            blender_git_repo = GitRepo(blender_dir)

        except:

            GitRepo.clone_from(BLENDER_GIT_REPO_URL, blender_dir)
            blender_git_repo = GitRepo(blender_dir)

        finally:
                
            blender_git_repo.heads.master.checkout()
            blender_git_repo.remotes.origin.pull()

        self.announce(f"Updating Blender git submodules", level=3)

        blender_git_repo.git.submodule('update', '--init', '--recursive')

        for submodule in blender_git_repo.submodules:
                
            submodule_repo = submodule.module()
            submodule_repo.heads.master.checkout()
            submodule_repo.remotes.origin.pull()

        self.announce("Configuring cmake project", level=3)

        self.spawn(['cmake', '-H'+blender_dir, '-B'+self.build_temp,
                    '-DWITH_PLAYER=OFF', '-DWITH_PYTHON_INSTALL=OFF',
                    '-DWITH_PYTHON_MODULE=ON', 
                    f"-DPYTHON_VERSION="
                    f"{sys.version_info[0]}.{sys.version_info[1]}"]
                    + os_build_args)
        
        self.announce("Building binaries", level=3)

        self.spawn(["cmake", "--build", self.build_temp, "--target", "INSTALL",
                    "--config", "Release"])

        # Build finished, now copy the files into the copy directory
        # The copy directory is the parent directory of the extension (.pyd)

        self.announce("Moving Blender python module", level=3)

        bin_dir = os.path.join(str(build_dir), 'bin', 'Release')
        self.distribution.bin_dir = bin_dir

        bpy_path = [os.path.join(bin_dir, _bpy) for _bpy in
                    os.listdir(bin_dir) if
                    os.path.isfile(os.path.join(bin_dir, _bpy)) and
                    os.path.splitext(_bpy)[0].startswith('bpy') and
                    os.path.splitext(_bpy)[1] in [".pyd", ".so"]][0]

        shutil.move(str(bpy_path), str(extension_path))
1263167
def finalize_options(self):
        
        self.cwd = os.path.abspath(os.path.dirname(__file__))
        self.build_dirs = [
            os.path.join(self.cwd, 'build'),
            os.path.join(self.cwd, 'htmlcov'),
            os.path.join(self.cwd, 'dist'),
            os.path.join(self.cwd, 'pylink_square.egg-info')
        ]
        self.build_artifacts = ['.pyc', '.o', '.elf', '.bin']
795551
def dpkg_buildpackage(*args,**kwargs):
    cwd=kwargs.pop('cwd',None)
    if len(kwargs)!=0:
        raise ValueError('only kwarg can be "cwd"')
    ""
    args = ['/usr/bin/dpkg-buildpackage']+list(args)
    process_command(args, cwd=cwd)
455394
def gen_cmake_command(config):
    
    from autocmake.extract import extract_list

    s = []
    s.append("\n\ndef gen_cmake_command(options, arguments):")
    s.append('    """')
    s.append("    Generate CMake command based on options and arguments.")
    s.append('    """')
    s.append("    command = []")

    for env in config['export']:
        s.append('    command.append({0})'.format(env))

    s.append("    command.append(arguments['--cmake-executable'])")

    for definition in config['define']:
        s.append('    command.append({0})'.format(definition))

    s.append("    command.append('-DCMAKE_BUILD_TYPE={0}'.format(arguments['--type']))")
    s.append("    command.append('-G\"{0}\"'.format(arguments['--generator']))")
    s.append("    if arguments['--cmake-options'] != \"''\":")
    s.append("        command.append(arguments['--cmake-options'])")
    s.append("    if arguments['--prefix']:")
    s.append("        command.append('-DCMAKE_INSTALL_PREFIX=\"{0}\"'.format(arguments['--prefix']))")

    s.append("\n    return ' '.join(command)")

    return '\n'.join(s)