Install the Node distribution from pants support binaries.

    :returns: The Node distribution bin path.
    :rtype: string
559171
def _install_node(self):
    
    node_package_path = self.select()
    # Todo: https://github.com/pantsbuild/pants/issues/4431
    # This line depends on repacked node distribution.
    # Should change it from 'node/bin' to 'dist/bin'
    node_bin_path = os.path.join(node_package_path, 'node', 'bin')
    if not is_readable_dir(node_bin_path):
      # The binary was pulled from nodejs and not our S3, in which
      # case it's installed under a different directory.
      return os.path.join(node_package_path, os.listdir(node_package_path)[0], 'bin')
    return node_bin_path
1348134
def kibana_install(self):
        
        with cd('/tmp'):
            if not exists('kibana.deb'):
                sudo('wget {0} -O kibana.deb'.format(
                    bigdata_conf.kibana_download_url
                ))

            sudo('dpkg -i kibana.deb')
            sudo('apt-get install -y')
326161
def main(mode):
    
    # see:
    # https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi
    version = subprocess.check_output(['python', 'setup.py', '--version']).decode().strip()

    twine_repo = os.getenv('TWINE_REPOSITORY_URL') or os.getenv('TWINE_REPOSITORY')
    print('tagging and releasing %r as a %s release to %s as Twine user %s' % (
        version,
        mode.name,
        twine_repo,
        os.getenv('TWINE_USERNAME')
    ))

    print('python - preparing environment')
    subprocess.check_call(['apk', 'update'])
    subprocess.check_call(['apk', 'add', 'git'])
    # Pin twine to 1.11 due to https://github.com/pypa/twine/issues/404
    subprocess.check_call(['pip', 'install', 'twine<1.12'])
    url = subprocess.check_output(['git', 'remote', 'get-url', 'origin'])
    new_url = git_url_ssh_to_https(url.decode())
    subprocess.check_call(['git', 'remote', 'set-url', 'origin', new_url])
    branch_spec = 'origin/%s' % os.getenv('CIRCLE_BRANCH')
    subprocess.check_call(['git', 'branch', '--set-upstream-to', branch_spec])
    subprocess.check_call(['git', 'fetch', '--tags', '--force'])

    # tags
    subprocess.check_call(['git', 'tag', '-a', version, '-m', 'release %s' % version])
    subprocess.check_call(['git', 'tag', '-f', 'latest'])
    if mode == release_target_map['prod']:
        print('git - pushing %s tags' % mode.name)
        subprocess.check_call(['git', 'push', '-f', 'origin', '--tags'])

    print('git - add changes')
    subprocess.check_call(['git', 'add', 'src/mbed_cloud/_version.py'])
    subprocess.check_call(['git', 'add', 'CHANGELOG.rst'])
    subprocess.check_call(['git', 'add', 'docs/news/*'])
    message = ':checkered_flag: :newspaper: releasing version %s\n[skip ci]' % version
    subprocess.check_call(['git', 'commit', '-m', message])

    if mode == release_target_map['prod']:
        print('git - pushing %s changelog commit' % mode.name)
        subprocess.check_call(['git', 'push', 'origin'])

    print('pypi - uploading')
    subprocess.check_call(['python', '-m', 'twine', 'upload', mode.bundle])
    print('pypi - uploading successful')
1282864
def build_install(self):
        
        slackbuilds = self.dependencies + self.master_packages
        installs, upgraded, = [], []
        if not os.path.exists(self.build_folder):
            os.makedirs(self.build_folder)
        if not os.path.exists(self._SOURCES):
            os.makedirs(self._SOURCES)
        os.chdir(self.build_folder)
        for prgnam in slackbuilds:
            if (self.meta.not_downgrade == "on" and
                    self.not_downgrade(prgnam) is True):
                continue
            pkg = "-".join(prgnam.split("-")[:-1])
            installed = "".join(find_package(prgnam, self.meta.pkg_path))
            src_link = SBoGrep(pkg).source().split()
            if (installed and "--download-only" not in self.flag and
                    "--rebuild" not in self.flag):
                self.msg.template(78)
                self.msg.pkg_found(prgnam)
                self.msg.template(78)
            elif self.unst[0] in src_link or self.unst[1] in src_link:
                self.msg.template(78)
                print("| Package {0} {1}{2}{3}".format(
                    prgnam, self.meta.color["RED"], "".join(src_link),
                    self.meta.color["ENDC"]))
                self.msg.template(78)
            else:
                sbo_url = sbo_search_pkg(pkg)
                sbo_link = SBoLink(sbo_url).tar_gz()
                script = sbo_link.split("/")[-1]
                if self.meta.sbosrcarch in ["on", "ON"]:
                    src_link = self.sbosrcarsh(prgnam, sbo_link, src_link)
                Download(self.build_folder, sbo_link.split(),
                         repo="sbo").start()
                Download(self._SOURCES, src_link, repo="sbo").start()
                if "--download-only" in self.flag:
                    continue
                sources = self.filenames(src_link)
                BuildPackage(script, sources, self.build_folder,
                             auto=False).build()
                binary = slack_package(prgnam)
                if os.path.isfile("".join(binary)):
                    if GetFromInstalled(pkg).name() == pkg:
                        print("[ {0}Upgrading{1} ] --> {2}".format(
                            self.meta.color["YELLOW"],
                            self.meta.color["ENDC"], prgnam))
                        upgraded.append(prgnam)
                    else:
                        print("[ {0}Installing{1} ] --> {2}".format(
                            self.meta.color["GREEN"],
                            self.meta.color["ENDC"], prgnam))
                        installs.append(prgnam)
                    if ("--rebuild" in self.flag and
                            GetFromInstalled(pkg).name() == pkg):
                        PackageManager(binary).upgrade(flag="--reinstall")
                    else:
                        PackageManager(binary).upgrade(flag="--install-new")
        return installs, upgraded
846514
def node(self, source, args=(), env={}):
        

        return self._exec(self.node_bin, source, args=args, env=env)
1229340
def __get_git_bin():
    
    git = 'git'
    alternatives = [
        '/usr/bin/git'
    ]
    for alt in alternatives:
        if os.path.exists(alt):
            git = alt
            break
    return git
220531
def _install_p4v_linux(self, url):
        
        lib.extract_targz(url,
                          self.directory.install_directory(self.feature_name),
                          remove_common_prefix=True)
        bin_path = os.path.join(self.directory.install_directory(self.feature_name), 'bin')
        if os.path.exists(bin_path):
            for f in os.listdir(bin_path):
                self.directory.symlink_to_bin(f, os.path.join(bin_path, f))
        return True
1120632
def bin_path(self, release=None):
        """"""
        if release:
            for r in self.releases:
                if release in r:
                    return self.releases[r]
            raise MongoOrchestrationError("No such release '%s' in %r"
                                          % (release, self.releases))
        if self.default_release:
            return self.releases[self.default_release]
        if self.releases:
            return list(self.releases.values())[0]
        return ''
61271
def _set_packages(self, node):
        '''
        
        '''
        pkgs = etree.SubElement(node, 'packages')
        for pkg_name, pkg_version in sorted(self._data.software.get('packages', {}).items()):
            pkg = etree.SubElement(pkgs, 'package')
            pkg.set('name', pkg_name)

        # Add collections (SUSE)
        if self.__grains__.get('os_family', '') == 'Suse':
            for ptn_id, ptn_data in self._data.software.get('patterns', {}).items():
                if ptn_data.get('installed'):
                    ptn = etree.SubElement(pkgs, 'namedCollection')
                    ptn.set('name', ptn_id)

        return pkgs
288506
def get_required_dists(dists, dist):
    
    if dist not in dists:
        raise DistlibException('given distribution %r is not a member '
                               'of the list' % dist.name)
    graph = make_graph(dists)

    req = []  # required distributions
    todo = graph.adjacency_list[dist]  # list of nodes we should inspect

    while todo:
        d = todo.pop()[0]
        req.append(d)
        for pred in graph.adjacency_list[d]:
            if pred not in req:
                todo.append(pred)

    return req
433855
def package(options):
    
    import pkg_resources
    import tarfile
    import geonode

    version = geonode.get_version()
    # Use GeoNode's version for the package name.
    pkgname = 'GeoNode-%s-all' % version

    # Create the output directory.
    out_pkg = path(pkgname)
    out_pkg_tar = path("%s.tar.gz" % pkgname)

    # Create a distribution in zip format for the geonode python package.
    dist_dir = path('dist')
    dist_dir.rmtree()
    sh('python setup.py sdist --formats=zip')

    with pushd('package'):

        #Delete old tar files in that directory
        for f in glob.glob('GeoNode*.tar.gz'):
            old_package = path(f)
            if old_package != out_pkg_tar:
                old_package.remove()

        if out_pkg_tar.exists():
            info('There is already a package for version %s' % version)
            return

        # Clean anything that is in the oupout package tree.
        out_pkg.rmtree()
        out_pkg.makedirs()

        support_folder = path('support')
        install_file = path('install.sh')

        # And copy the default files from the package folder.
        justcopy(support_folder, out_pkg / 'support')
        justcopy(install_file, out_pkg)

        geonode_dist = path('..') / 'dist' / 'GeoNode-%s.zip' % version
        justcopy(geonode_dist, out_pkg)

        rogue_dist = path('../..') / 'dist' / 'geoshape-0.1.zip'
        justcopy(rogue_dist, out_pkg)

        # Create a tar file with all files in the output package folder.
        tar = tarfile.open(out_pkg_tar, "w:gz")
        for file in out_pkg.walkfiles():
            tar.add(file)

        # Add the README with the license and important links to documentation.
        tar.add('README', arcname=('%s/README.md' % out_pkg))
        tar.close()

        # Remove all the files in the temporary output package directory.
        out_pkg.rmtree()

    # Report the info about the new package.
    info("%s created" % out_pkg_tar.abspath())
960254
def patch(cls):
        
        orig = distutils.core.Distribution
        distutils.core.Distribution = cls
        try:
            yield
        finally:
            distutils.core.Distribution = orig
915378
def root(self):
        
        node = self
        while node.package is not None:
            node = node.package
        return node
470534
def setup_tree(ctx, verbose=None, root=None, tree_dir=None, modules_dir=None):
    '''  '''
    print('Setting up the tree')
    ctx.run('python bin/setup_tree.py -t {0} -r {1} -m {2}'.format(tree_dir, root, modules_dir))
523854
def get_distributions(self):
        

        pkg_resources = self.safe_import("pkg_resources")
        libdirs = self.base_paths["libdirs"].split(os.pathsep)
        dists = (pkg_resources.find_distributions(libdir) for libdir in libdirs)
        for dist in itertools.chain.from_iterable(dists):
            yield dist
269946
def build(self):
        

        self._cmd_parser.add_argument(
            'install',
            type=str,
            default=None,
            nargs="+",
            help=(""),
        )

        self._cmd_parser.add_argument(
            '-l',
            '--location',
            default=None,
            help=("Specify the installation location. ")
        )

        return super(Cmd, self).build()
110106
def get_install_paths(name):
    
    paths = {}

    i = get_install_command(name)

    for key in install.SCHEME_KEYS:
        paths[key] = getattr(i, 'install_' + key)

    # pip uses a similar path as an alternative to the system's (read-only)
    # include directory:
    if hasattr(sys, 'real_prefix'):  # virtualenv
        paths['headers'] = os.path.join(sys.prefix,
                                        'include',
                                        'site',
                                        'python' + sys.version[:3],
                                        name)

    return paths