Example #1
0
File: pecl.py Project: cicku/anitya
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://pecl.php.net/package/%(name)s/download'

        url = url_template % {'name': project.name}
        regex = REGEX % {'name': project.name}

        try:
            versions = get_versions_by_regex(url, regex, project)
        except AnityaPluginException:
            name = project.name.replace("-", "_")
            url = url_template % {'name': name}
            regex = REGEX % {'name': name}
            versions = get_versions_by_regex(url, regex, project)

        return versions
Example #2
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        name = project.name
        if name.lower().strip().startswith('drupal6:'):
            name = name[len('drupal6:'):].strip()

        url_template = 'https://updates.drupal.org/release-history/%(name)s/6.x'

        url = url_template % {'name': name}
        regex = REGEX % {'name': name}
        versions = None

        try:
            versions = get_versions_by_regex(url, regex, project)
        except AnityaPluginException as err:
            if not '-' in project.name:
                raise err
            name = project.name.replace("-", "_")
            url = url_template % {'name': name}
            regex = REGEX % {'name': name}
            versions = get_versions_by_regex(url, regex, project)

        return versions
Example #3
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://pear.php.net/package/%(name)s/download/All'

        url = url_template % {'name': project.name}
        regex = REGEX % {'name': project.name}

        try:
            versions = get_versions_by_regex(url, regex, project)
        except AnityaPluginException, err:
            if not '-' in project.name:
                raise err
            name = project.name.replace("-", "_")
            url = url_template % {'name': name}
            regex = REGEX % {'name': name}
            versions = get_versions_by_regex(url, regex, project)
Example #4
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        name = project.name
        if name.lower().strip().startswith('drupal6:'):
            name = name[len('drupal6:'):].strip()

        url_template = 'https://updates.drupal.org/release-history/%(name)s/6.x'

        url = url_template % {'name': name}
        regex = REGEX % {'name': name}
        versions = None

        try:
            versions = get_versions_by_regex(url, regex, project)
        except AnityaPluginException as err:
            if not '-' in project.name:
                raise err
            name = project.name.replace("-", "_")
            url = url_template % {'name': name}
            regex = REGEX % {'name': name}
            versions = get_versions_by_regex(url, regex, project)

        return versions
Example #5
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if project.version_url:
            url_template = 'https://github.com/%(version_url)s/tags'
            version_url = project.version_url.replace('https://github.com/', '')
            url = url_template % {'version_url': version_url}
        elif project.homepage.startswith('https://github.com'):
            url = project.homepage
            if url.endswith('/'):
                url = project.homepage[:-1]
            url += '/tags'
        else:
            raise AnityaPluginException(
                'Project %s was incorrectly set-up' % project.name)

        return get_versions_by_regex(url, REGEX, project)
Example #6
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if MAVEN_HOMEPAGE_RE.match(project.homepage):
            url = project.homepage
        else:
            coordinates = project.version_url or project.name
            match = COORDINATES_RE.match(coordinates)
            if not match:
                raise AnityaPluginException(
                    "Aritfact needs to be in format groupId:artifactId")

            group_id = match.group(1)
            artifact_id = match.group(2)
            url = 'http://repo1.maven.org/maven2/{group_id}/{artifact_id}/'\
                  .format(
                      group_id=group_id.replace('.', '/'),
                      artifact_id=artifact_id,
                  )

        return get_versions_by_regex(url, VERSION_REGEX, project)
Example #7
0
def use_gnome_regex(project):
    """ Try retrieving the specified project's versions a regular expression.
    """
    output = []
    url = GnomeBackend.get_version_url(project)
    output = get_versions_by_regex(url, REGEX, project)
    return output
Example #8
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if MAVEN_HOMEPAGE_RE.match(project.homepage):
            url = project.homepage
        else:
            coordinates = project.version_url or project.name
            match = COORDINATES_RE.match(coordinates)
            if not match:
                raise AnityaPluginException(
                    "Aritfact needs to be in format groupId:artifactId")

            group_id = match.group(1)
            artifact_id = match.group(2)
            url = 'https://repo1.maven.org/maven2/{group_id}/{artifact_id}/'\
                  .format(
                      group_id=group_id.replace('.', '/'),
                      artifact_id=artifact_id,
                  )

        return get_versions_by_regex(url, VERSION_REGEX, project)
Example #9
0
def use_gnome_regex(project):
    """ Try retrieving the specified project's versions a regular expression.
    """
    output = []
    url = GnomeBackend.get_version_url(project)
    output = get_versions_by_regex(url, REGEX, project)
    return output
Example #10
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = cls.get_version_url(project)

        regex = REGEX_ALIASES["DEFAULT"]
        if project.regex:
            regex = REGEX_ALIASES.get(project.regex, project.regex)

        if "%(name)" in regex:
            regex = regex % {"name": project.name.replace("+", r"\+")}

        return get_versions_by_regex(url,
                                     regex,
                                     project,
                                     insecure=project.insecure)
Example #11
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if re.match(r'https?://repo\d+.maven.org/', project.homepage):
            url = project.homepage
        else:
            coordinates = project.version_url or project.name
            if ':' not in coordinates:
                raise AnityaPluginException(
                    "Aritfact needs to be in format groupId:artifactId")
            url = 'http://repo1.maven.org/maven2/{path}'\
                  .format(path=coordinates.replace('.', '/')
                          .replace(':', '/'))

        return get_versions_by_regex(url, REGEX, project)
Example #12
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if re.match(r'https?://repo\d+.maven.org/', project.homepage):
            url = project.homepage
        else:
            coordinates = project.version_url or project.name
            if ':' not in coordinates:
                raise AnityaPluginException(
                    "Aritfact needs to be in format groupId:artifactId")
            url = 'http://repo1.maven.org/maven2/{path}'\
                  .format(path=coordinates.replace('.', '/')
                          .replace(':', '/'))

        return get_versions_by_regex(url, REGEX, project)
Example #13
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = project.version_url

        regex = REGEX_ALIASES['DEFAULT']
        if project.regex:
            regex = REGEX_ALIASES.get(project.regex, project.regex)

        if '%(name)' in regex:
            regex = regex % {'name': project.name.replace('+', '\+')}

        return get_versions_by_regex(
            url, regex, project, insecure=project.insecure)
Example #14
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://ftp.debian.org/debian/pool/main/'\
            '%(short)s/%(name)s/'

        if project.name.startswith('lib'):
            short = project.name[:4]
        else:
            short = project.name[0]

        url = url_template % {'short': short, 'name': project.name}
        regex = DEBIAN_REGEX % {'name': project.name}

        return get_versions_by_regex(url, regex, project)
Example #15
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        if project.version_url:
            url_template = 'https://github.com/%(version_url)s/tags'
            version_url = project.version_url.replace('https://github.com/',
                                                      '')
            url = url_template % {'version_url': version_url}
        elif project.homepage.startswith('https://github.com'):
            url = project.homepage
            if url.endswith('/'):
                url = project.homepage[:-1]
            url += '/tags'
        else:
            raise AnityaPluginException('Project %s was incorrectly set-up' %
                                        project.name)

        return get_versions_by_regex(url, REGEX, project)
Example #16
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = cls.get_version_url(project)
        name = project.name
        if "-" in project.name:
            name = project.name.replace("-", "_")
        regex = REGEX % {"name": name}
        versions = None

        try:
            versions = get_versions_by_regex(url, regex, project)
        except AnityaPluginException as err:
            raise err

        return versions
Example #17
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://ftp.debian.org/debian/pool/main/'\
            '%(short)s/%(name)s/'

        if project.name.startswith('lib'):
            short = project.name[:4]
        else:
            short = project.name[0]

        url = url_template % {'short': short, 'name': project.name}
        regex = REGEX % {'name': project.name}

        return get_versions_by_regex(url, regex, project)
Example #18
0
def use_gnome_regex(project):
    ''' Try retrieving the specified project's versions a regular expression.
    '''
    output = []
    url = 'https://download.gnome.org/sources/%(name)s/' % {
        'name': project.name}
    output = get_versions_by_regex(url, REGEX, project)
    return output
Example #19
0
def use_gnome_regex(project):
    ''' Try retrieving the specified project's versions a regular expression.
    '''
    output = []
    url = 'https://download.gnome.org/sources/%(name)s/' % {
        'name': project.name}
    output = get_versions_by_regex(url, REGEX, project)
    return output
Example #20
0
    def test_get_versions_by_regex_not_modified(self, mock_call_url):
        """Assert that not modified response is handled correctly."""
        mock_response = mock.Mock(spec=object)
        mock_response.status_code = 304
        mock_call_url.return_value = mock_response
        mock_project = mock.Mock()
        mock_project.get_time_last_created_version = mock.MagicMock(
            return_value=None)
        versions = backends.get_versions_by_regex("url", "regex", mock_project)

        self.assertEqual(versions, [])
Example #21
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.
        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly
        """
        url = "https://www.stackage.org/package/%(name)s" % {"name": project.name}

        regex = '%(name)s <span class="latest-version">([\d.]*) *</span>' % {"name": project.name}

        return get_versions_by_regex(url, regex, project)
Example #22
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = cls.get_version_url(project)

        return get_versions_by_regex(url, REGEX, project)
Example #23
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = cls.get_version_url(project)

        return get_versions_by_regex(url, REGEX, project)
Example #24
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = 'https://download.gnome.org/sources/%(name)s/' % {
            'name': project.name}

        return get_versions_by_regex(url, REGEX, project)
Example #25
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.
        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly
        """
        url = cls.get_version_url(project)

        regex = (r'<span class="version"><a href="https://www.stackage.org/'
                 r'lts-[\d.]*/package/%s">([\d.]*)</a></span>' % project.name)

        return get_versions_by_regex(url, regex, project)
Example #26
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = "http://search.cpan.org/dist/%(name)s/" % {"name": project.name}

        regex = REGEX % {"name": project.name}

        return get_versions_by_regex(url, regex, project)
Example #27
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = 'https://metacpan.org/release/%(name)s/' % {'name': project.name}

        regex = REGEX % {'name': project.name}

        return get_versions_by_regex(url, regex, project)
Example #28
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.
        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly
        '''
        url = 'https://www.stackage.org/package/%(name)s' % {
            'name': project.name}

        regex = '<a href="https://www.stackage.org/lts-[\d.]*">'\
            'LTS Haskell [\d.]* - GHC [\d.]* \(([\d.]*)\)</a>'

        return get_versions_by_regex(url, regex, project)
Example #29
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://freshmeat.net/projects/%(name)s'

        url = url_template % {'name': project.name}

        return get_versions_by_regex(url, REGEX, project)
Example #30
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'https://github.com/%(version_url)s/tags'

        url = url_template % {'version_url': project.version_url}

        return get_versions_by_regex(url, REGEX, project)
Example #31
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = cls.get_version_url(project)
        if not url:
            raise AnityaPluginException(
                "Aritfact needs to be in format groupId:artifactId")

        return get_versions_by_regex(url, VERSION_REGEX, project)
Example #32
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.
        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly
        """
        url = cls.get_version_url(project)

        regex = (
            r'<span class="version"><a href="https://www.stackage.org/'
            r'lts-[\d.]*/package/%s">([\d.]*)</a></span>' % project.name
        )

        return get_versions_by_regex(url, regex, project)
Example #33
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = 'http://code.google.com/p/%(name)s/downloads/list'\
            '?sort=releasedate' % {'name': project.name.lower()}

        regex = REGEX % {'name': project.name}

        return get_versions_by_regex(url, regex, project)
Example #34
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url = 'http://repo1.maven.org/maven2/{path}'\
              .format(path=project.name.replace('.', '/').replace(':', '/'))

        regex = r'\<a[^>]+\>(\d[^</]*)'

        return get_versions_by_regex(url, regex, project)
Example #35
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'https://github.com/%(version_url)s/tags'

        version_url = project.version_url.replace('https://github.com/', '')

        url = url_template % {'version_url': version_url}

        return get_versions_by_regex(url, REGEX, project)
Example #36
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.
        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly
        '''
        url = 'https://www.stackage.org/package/%(name)s' % {
            'name': project.name
        }

        regex = '<a href="https://www.stackage.org/lts-[\d.]*">'\
            'LTS Haskell [\d.]*</a>: </td>'\
            '<td><span class="version">([\d.]*)</span>'

        return get_versions_by_regex(url, regex, project)
Example #37
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'https://sourceforge.net/projects/%(name)s/rss?limit=200'

        url = url_template % {
            'name': (project.version_url or project.name).replace('+', '\+')
        }
        regex = REGEX % {'name': project.name.replace('+', '\+')}

        return get_versions_by_regex(url, regex, project)
Example #38
0
    def get_versions(cls, project):
        """ Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`anitya.db.models.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        """
        url = cls.get_version_url(project)

        regex = REGEX_ALIASES["DEFAULT"]
        if project.regex:
            regex = REGEX_ALIASES.get(project.regex, project.regex)

        if "%(name)" in regex:
            regex = regex % {"name": project.name.replace("+", r"\+")}

        return get_versions_by_regex(url, regex, project, insecure=project.insecure)
Example #39
0
    def get_versions(cls, project):
        ''' Method called to retrieve all the versions (that can be found)
        of the projects provided, project that relies on the backend of
        this plugin.

        :arg Project project: a :class:`model.Project` object whose backend
            corresponds to the current plugin.
        :return: a list of all the possible releases found
        :return type: list
        :raise AnityaPluginException: a
            :class:`anitya.lib.exceptions.AnityaPluginException` exception
            when the versions cannot be retrieved correctly

        '''
        url_template = 'http://sourceforge.net/projects/%(name)s/rss?limit=200'

        url = url_template % {
            'name': (project.version_url or project.name).replace('+', '\+')
        }
        regex = REGEX % {
            'name': project.name.replace('+', '\+')
        }

        return get_versions_by_regex(url, regex, project)