How to use the changelog.Version function in changelog

To help you get started, we’ve selected a few changelog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github romlok / python-debian / tests / test_changelog.py View on Github external
def test_add_changelog_section(self):
        f = open('test_modify_changelog2')
        c = f.read()
        f.close()
        cl = changelog.Changelog(c)
        cl.new_block(package='gnutls14',
                version=changelog.Version('1:1.4.1-3'),
                distributions='experimental',
                urgency='low',
                author='James Westby ')

        self.assertRaises(changelog.ChangelogCreateError, cl.__str__)

        cl.set_date('Sat, 16 Jul 2008 11:11:08 +0200')
        cl.add_change('')
        cl.add_change('  * Foo did not work, let us try bar')
        cl.add_change('')

        f = open('test_modify_changelog3')
        c = f.read()
        f.close()
        clines = c.split('\n')
        cslines = str(cl).split('\n')
github romlok / python-debian / tests / test_changelog.py View on Github external
def test_set_version_with_string(self):
        f = open('test_modify_changelog1')
        c1 = changelog.Changelog(f.read())
        f.seek(0)
        c2 = changelog.Changelog(f.read())
        f.close()
        c1.version = '1:2.3.5-2'
        c2.version = changelog.Version('1:2.3.5-2')
        self.assertEqual(c1.version, c2.version)
        self.assertEqual((c1.full_version, c1.epoch, c1.upstream_version,
                          c1.debian_version),
                         (c2.full_version, c2.epoch, c2.upstream_version,
                          c2.debian_version))
github romlok / python-debian / tests / test_changelog.py View on Github external
self._test_version('20060611-0.0', None, '20060611', '0.0')
        self._test_version('0.52.2-5.1', None, '0.52.2', '5.1')
        self._test_version('7.0-035+1', None, '7.0', '035+1')
        self._test_version('1.1.0+cvs20060620-1+2.6.15-8', None,
            '1.1.0+cvs20060620-1+2.6.15', '8')
        self._test_version('1.1.0+cvs20060620-1+1.0', None,
                '1.1.0+cvs20060620', '1+1.0')
        self._test_version('4.2.0a+stable-2sarge1', None, '4.2.0a+stable',
                           '2sarge1')
        self._test_version('1.8RC4b', None, '1.8RC4b', None)
        self._test_version('0.9~rc1-1', None, '0.9~rc1', '1')
        self._test_version('2:1.0.4+svn26-1ubuntu1', '2', '1.0.4+svn26',
                           '1ubuntu1')
        self._test_version('2:1.0.4~rc2-1', '2', '1.0.4~rc2', '1')
        self.assertRaises(
            ValueError, changelog.Version, 'a1:1.8.8-070403-1~priv1')
github romlok / python-debian / tests / test_changelog.py View on Github external
def _test_version(self, full_version, epoch, upstream, debian):
        v = changelog.Version(full_version)
        self.assertEqual(v.full_version, full_version, "Full version broken")
        self.assertEqual(v.epoch, epoch, "Epoch broken")
        self.assertEqual(v.upstream_version, upstream, "Upstram broken")
        self.assertEqual(v.debian_version, debian, "Debian broken")
github mistio / mist-ee / changelog.py View on Github external
elif args.action == 'rewrite':
        changelog.to_file(args.file)
    elif args.action == 'extract':
        for version in changelog.versions:
            if version.name == args.version:
                print version.get_release_notes()
                break
        else:
            print >> sys.stderr, "ERROR: Couldn't find version '%s'." % (
                args.version)
            sys.exit(1)
    elif args.action == 'add':
        gitlab = GitlabRequest(url=args.gitlab_url, repo=args.repo,
                               token=args.token)
        now = datetime.datetime.now()
        version = Version(args.version,
                          int(now.day), MONTHS[now.month - 1], int(now.year))
        last_version = None
        since = None
        if changelog.versions:
            last_version = changelog.versions[0]
            print >> sys.stderr, "INFO: Last version is '%s'." % (
                last_version.name)
            try:
                last_tag = gitlab.get(
                    'repository/tags/%s' % last_version.name
                )
            except:
                print >> sys.stderr, ("ERROR: Can't find previous release "
                                      "'%s' on Gitlab." % last_version.name)
                raise
            since = dateutil.parser.parse(last_tag['commit']['committed_date'])
github mistio / mist-ce / changelog.py View on Github external
elif args.action == 'rewrite':
        changelog.to_file(args.file)
    elif args.action == 'extract':
        for version in changelog.versions:
            if version.name == args.version:
                print version.get_release_notes()
                break
        else:
            print >> sys.stderr, "ERROR: Couldn't find version '%s'." % (
                args.version)
            sys.exit(1)
    elif args.action == 'add':
        gitlab = GitlabRequest(url=args.gitlab_url, repo=args.repo,
                               token=args.token)
        now = datetime.datetime.now()
        version = Version(args.version,
                          int(now.day), MONTHS[now.month - 1], int(now.year))
        last_version = None
        since = None
        if changelog.versions:
            last_version = changelog.versions[0]
            print >> sys.stderr, "INFO: Last version is '%s'." % (
                last_version.name)
            try:
                last_tag = gitlab.get(
                    'repository/tags/%s' % last_version.name
                )
            except:
                print >> sys.stderr, ("ERROR: Can't find previous release "
                                      "'%s' on Gitlab." % last_version.name)
                raise
            since = dateutil.parser.parse(last_tag['commit']['committed_date'])