Create an installer. fetch_path is anything that Downlow can understand.
 Install path is the final directory
 Fetch the file at fetch_path with and stage into a tmp directory.
 Returns the staged directory of fetched file(s).
182453
def fetch
      logger.debug "Fetching #{fetch_path}"
      @fetched_path = Downlow.get(fetch_path, tmp_path, :tmp_dir => tmp_root)
      logger.debug "Fetched #{@fetched_path}"
      @fetched_path
    end
726126
def install(self, xmlpath):
        
        #Before we can install it, we need to make sure that none of the existing
        #installed paths point to the same repo.
        from os import path
        fullpath = path.abspath(path.expanduser(xmlpath))
        if path.isfile(fullpath):
            repo = RepositorySettings(self, fullpath)
            if repo.name.lower() not in self.repositories:
                self.installed.append(fullpath)
                self._save_installed()
                self.archive[repo.name.lower()] = {}
                self._save_archive()
                
                self.repositories[repo.name.lower()] = repo
        else:
            warn("The file {} does not exist; install aborted.".format(fullpath))
6681
def get(self, path, local_path):
        
        normpath = os.path.normpath(local_path)
        folder = os.path.dirname(normpath)
        if folder and not os.path.exists(folder):
            os.makedirs(folder)

        tmp_local_path = local_path + '-luigi-tmp-%09d' % random.randrange(0, 1e10)

        # download file
        self._connect()

        if self.sftp:
            self._sftp_get(path, tmp_local_path)
        else:
            self._ftp_get(path, tmp_local_path)

        self._close()

        os.rename(tmp_local_path, local_path)
59424
def _get_install_config():
    
    try:
        data_dir = _get_data_dir()
    except ValueError:
        return None
    config_dir = utils.safe_makedir(os.path.join(data_dir, "config"))
    return os.path.join(config_dir, "install-params.yaml")
862085
def download(self, dirpath):
        
        if os.path.isfile(self.lpath) and os.path.getsize(self.lpath) > 0:
            return
        print('Downloading %s -> %s' % (self.path, self.lpath))
        if dry_run:
            return
        self.arts.s3_bucket.download_file(self.path, self.lpath)
936557
def download(self, target_relpath, download_in_toto_metadata=True):
        '''
        
        '''
        return self.__get_target(target_relpath, download_in_toto_metadata=download_in_toto_metadata)
844474
def abspath(*path):
    """"""
    setup_dir = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(setup_dir, *path)
632331
def get_build_path(self):
        
        target_path = path.join(settings.BUILD_DIR, self.get_url().lstrip('/'))
        if not self.fs.exists(target_path):
            logger.debug("Creating {}".format(target_path))
            self.fs.makedirs(target_path)
        return os.path.join(target_path, 'index.html')
496381
def create_path(path):
    
    import os
    if not os.path.exists(path):
        os.makedirs(path)
1052257
def fetch(self):
        
        #Default type to download
        source = True
        directory = "."

        if self.options.file_type == "svn":
            version = "dev"
            svn_uri = get_download_uri(self.project_name, \
                    "dev", True)
            if svn_uri:
                directory = self.project_name + "_svn"
                return self.fetch_svn(svn_uri, directory)
            else:
                self.logger.error(\
                    "ERROR: No subversion repository found for %s" % \
                    self.project_name)
                return 1
        elif self.options.file_type == "source":
            source = True
        elif self.options.file_type == "egg":
            source = False

        uri = get_download_uri(self.project_name, self.version, source)
        if uri:
            return self.fetch_uri(directory, uri)
        else:
            self.logger.error("No %s URI found for package: %s " % \
                    (self.options.file_type, self.project_name))
            return 1
1322781
def logging_file_install(path):
    
    if path is None:
        path = configuration_get_default_folder() / LOGGING_DEFAULTNAME

    if not path.parent.exists():
        log.error('File logger installation FAILED!')
        log.error('The directory of the log file does not exist.')
        return

    formatter = logging.Formatter(LOGGING_FORMAT)
    logger = logging.getLogger()

    logger.removeHandler(LOGGING_HANDLERS['file'])

    logFileHandler = logging.handlers.RotatingFileHandler(filename=str(path),
                                                          mode='a',
                                                          maxBytes=LOGGING_MAXBYTES,
                                                          backupCount=LOGGING_BACKUPCOUNT)
    logFileHandler.setLevel(logging.DEBUG)
    logFileHandler.setFormatter(formatter)

    LOGGING_HANDLERS['file'] = logFileHandler

    logger.addHandler(logFileHandler)
127728
def tmp_file_path(self):
        
        return os.path.normpath(os.path.join(
            TMP_DIR,
            self.filename
        ))
1218823
def finder_for_path(path):
    
    result = None
    # calls any path hooks, gets importer into cache
    pkgutil.get_importer(path)
    loader = sys.path_importer_cache.get(path)
    finder = _finder_registry.get(type(loader))
    if finder:
        module = _dummy_module
        module.__file__ = os.path.join(path, '')
        module.__loader__ = loader
        result = finder(module)
    return result
1164453
def install
      fail if source_path.nil?
      fail if install_path.nil?
      FileUtils.mkdir_p install_path
      Palimpsest::Utils.copy_directory source_path, install_path
    end
651766
def install_req_from_line(
    name,  # type: str
    comes_from=None,  # type: Optional[Union[str, InstallRequirement]]
    use_pep517=None,  # type: Optional[bool]
    isolated=False,  # type: bool
    options=None,  # type: Optional[Dict[str, Any]]
    wheel_cache=None,  # type: Optional[WheelCache]
    constraint=False  # type: bool
):
    # type: (...) -> InstallRequirement
    
    if is_url(name):
        marker_sep = '; '
    else:
        marker_sep = ';'
    if marker_sep in name:
        name, markers_as_string = name.split(marker_sep, 1)
        markers_as_string = markers_as_string.strip()
        if not markers_as_string:
            markers = None
        else:
            markers = Marker(markers_as_string)
    else:
        markers = None
    name = name.strip()
    req_as_string = None
    path = os.path.normpath(os.path.abspath(name))
    link = None
    extras_as_string = None

    if is_url(name):
        link = Link(name)
    else:
        p, extras_as_string = _strip_extras(path)
        looks_like_dir = os.path.isdir(p) and (
            os.path.sep in name or
            (os.path.altsep is not None and os.path.altsep in name) or
            name.startswith('.')
        )
        if looks_like_dir:
            if not is_installable_dir(p):
                raise InstallationError(
                    "Directory %r is not installable. Neither 'setup.py' "
                    "nor 'pyproject.toml' found." % name
                )
            link = Link(path_to_url(p))
        elif is_archive_file(p):
            if not os.path.isfile(p):
                logger.warning(
                    'Requirement %r looks like a filename, but the '
                    'file does not exist',
                    name
                )
            link = Link(path_to_url(p))

    # it's a local file, dir, or url
    if link:
        # Handle relative file URLs
        if link.scheme == 'file' and re.search(r'\.\./', link.url):
            link = Link(
                path_to_url(os.path.normpath(os.path.abspath(link.path))))
        # wheel file
        if link.is_wheel:
            wheel = Wheel(link.filename)  # can raise InvalidWheelFilename
            req_as_string = "%s==%s" % (wheel.name, wheel.version)
        else:
            # set the req to the egg fragment.  when it's not there, this
            # will become an 'unnamed' requirement
            req_as_string = link.egg_fragment

    # a requirement specifier
    else:
        req_as_string = name

    if extras_as_string:
        extras = Requirement("placeholder" + extras_as_string.lower()).extras
    else:
        extras = ()
    if req_as_string is not None:
        try:
            req = Requirement(req_as_string)
        except InvalidRequirement:
            if os.path.sep in req_as_string:
                add_msg = "It looks like a path."
                add_msg += deduce_helpful_msg(req_as_string)
            elif ('=' in req_as_string and
                  not any(op in req_as_string for op in operators)):
                add_msg = "= is not a valid operator. Did you mean == ?"
            else:
                add_msg = ""
            raise InstallationError(
                "Invalid requirement: '%s'\n%s" % (req_as_string, add_msg)
            )
    else:
        req = None

    return InstallRequirement(
        req, comes_from, link=link, markers=markers,
        use_pep517=use_pep517, isolated=isolated,
        options=options if options else {},
        wheel_cache=wheel_cache,
        constraint=constraint,
        extras=extras,
    )
869391
def find_lib_path():
    
    curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
    # make pythonpack hack: copy this directory one level upper for setup.py
    dll_path = [curr_path, os.path.join(curr_path, '../../wrapper/'),
                os.path.join(curr_path, './wrapper/')]
    if os.name == 'nt':
        if platform.architecture()[0] == '64bit':
            dll_path.append(os.path.join(curr_path, '../../windows/x64/Release/'))
            # hack for pip installation when copy all parent source directory here
            dll_path.append(os.path.join(curr_path, './windows/x64/Release/'))
        else:
            dll_path.append(os.path.join(curr_path, '../../windows/Release/'))
            # hack for pip installation when copy all parent source directory here
            dll_path.append(os.path.join(curr_path, './windows/Release/'))
    if os.name == 'nt':
        dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path]
    else:
        dll_path = [os.path.join(p, 'libxgboostwrapper.so') for p in dll_path]
    lib_path = [p for p in dll_path if os.path.exists(p) and os.path.isfile(p)]
    #From github issues, most of installation errors come from machines w/o compilers
    if len(lib_path) == 0 and not os.environ.get('XGBOOST_BUILD_DOC', False):
        raise XGBoostLibraryNotFound(
            'Cannot find XGBoost Libarary in the candicate path, ' +
            'did you install compilers and run build.sh in root path?\n'
            'List of candidates:\n' + ('\n'.join(dll_path)))
    return lib_path
61199
def is_installable_dir(path):
    # type: (str) -> bool
    
    if not os.path.isdir(path):
        return False
    setup_py = os.path.join(path, 'setup.py')
    if os.path.isfile(setup_py):
        return True
    pyproject_toml = os.path.join(path, 'pyproject.toml')
    if os.path.isfile(pyproject_toml):
        return True
    return False