Beispiel #1
0
 def post(self, pack_search_request):
     if hasattr(pack_search_request, 'query'):
         packs = packs_service.search_pack_index(pack_search_request.query)
         return [PackAPI(**pack) for pack in packs]
     else:
         pack = packs_service.get_pack_from_index(pack_search_request.pack)
         return PackAPI(**pack) if pack else None
Beispiel #2
0
 def post(self, pack_search_request):
     if hasattr(pack_search_request, 'query'):
         packs = packs_service.search_pack_index(pack_search_request.query)
         return [PackAPI(**pack) for pack in packs]
     else:
         pack = packs_service.get_pack_from_index(pack_search_request.pack)
         return PackAPI(**pack) if pack else None
 def run(self, pack):
     """
     :param pack: Pack Name to get info about
     :type pack: ``str``
     """
     return {
         'pack': get_pack_from_index(pack)
     }
Beispiel #4
0
    def _get_repo_url(pack):
        pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
        name_or_url = pack_and_version[0]
        version = pack_and_version[1] if len(pack_and_version) > 1 else None

        if len(name_or_url.split('/')) == 1:
            pack = get_pack_from_index(name_or_url)
            if not pack:
                raise Exception('No record of the "%s" pack in the index.' % name_or_url)
            return (pack['repo_url'], version)
        else:
            return (DownloadGitRepoAction._eval_repo_url(name_or_url), version)
Beispiel #5
0
    def post(self, pack_search_request):

        proxy_config = _get_proxy_config()

        if hasattr(pack_search_request, 'query'):
            packs = packs_service.search_pack_index(pack_search_request.query,
                                                    case_sensitive=False,
                                                    proxy_config=proxy_config)
            return [PackAPI(**pack) for pack in packs]
        else:
            pack = packs_service.get_pack_from_index(pack_search_request.pack,
                                                     proxy_config=proxy_config)
            return PackAPI(**pack) if pack else []
Beispiel #6
0
    def post(self, pack_search_request):

        proxy_config = _get_proxy_config()

        if hasattr(pack_search_request, 'query'):
            packs = packs_service.search_pack_index(pack_search_request.query,
                                                    case_sensitive=False,
                                                    proxy_config=proxy_config)
            return [PackAPI(**pack) for pack in packs]
        else:
            pack = packs_service.get_pack_from_index(pack_search_request.pack,
                                                     proxy_config=proxy_config)
            return PackAPI(**pack) if pack else []
Beispiel #7
0
def get_repo_url(pack, proxy_config=None):
    """
    Retrieve pack repo url.

    :rtype: ``str``

    :return: (repo_url, version)
    :rtype: tuple
    """
    pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
    name_or_url = pack_and_version[0]
    version = pack_and_version[1] if len(pack_and_version) > 1 else None

    if len(name_or_url.split('/')) == 1:
        pack = get_pack_from_index(name_or_url, proxy_config=proxy_config)

        if not pack:
            raise Exception('No record of the "%s" pack in the index.' % (name_or_url))

        return (pack['repo_url'], version)
    else:
        return (eval_repo_url(name_or_url), version)
Beispiel #8
0
def get_repo_url(pack, proxy_config=None):
    """
    Retrieve pack repo url.

    :rtype: ``str``

    :return: (repo_url, version)
    :rtype: tuple
    """
    pack_and_version = pack.split(PACK_VERSION_SEPARATOR)
    name_or_url = pack_and_version[0]
    version = pack_and_version[1] if len(pack_and_version) > 1 else None

    if len(name_or_url.split('/')) == 1:
        pack = get_pack_from_index(name_or_url, proxy_config=proxy_config)

        if not pack:
            raise Exception('No record of the "%s" pack in the index.' % (name_or_url))

        return (pack['repo_url'], version or pack['version'])
    else:
        return (eval_repo_url(name_or_url), version)