def test_mark_uploaded_unkown_dist(self):
     self.make_unuploaded()
     cl = Changelog()
     v = Version("0.1-1")
     cl.new_block(
         package='package',
         version=Version('0.1-1'),
         distributions='UNRELEASED',
         urgency='low',
         author='James Westby <*****@*****.**>',
         date='Thu,  3 Aug 2006 19:16:22 +0100',
     )
     cl.add_change('')
     cl.add_change('  * Initial packaging.')
     cl.add_change('')
     f = open('debian/changelog', 'wb')
     try:
         cl.write_to_open_file(f)
     finally:
         f.close()
     self.wt.commit("two")
     self.run_bzr_error([
         "The changelog still targets 'UNRELEASED', so "
         "apparently hasn't been uploaded."
     ], "mark-uploaded")
Exemple #2
0
def changelog(dpath, ctx, env):
    change = ctx.get('message', 'Autogenerated by py2dsp v{}'.format(VERSION))
    version = "{}-{}".format(ctx['version'], ctx['debian_revision'])
    distribution = ctx.get('distribution', 'UNRELEASED')

    fpath = join(dpath, 'debian', 'changelog')
    if exists(fpath):
        with open(fpath, encoding='utf-8') as fp:
            line = fp.readline()
            if ctx['version'] in line or 'UNRELEASED' in line:
                log.debug('changelog doesn\'t need an update')
                return
            else:
                yield from execute(['dch', '--force-distribution', '--distribution', distribution,
                                    '--newversion', version, '-m', change], cwd=dpath)
        return

    now = datetime.utcnow()
    changelog = Changelog()
    changelog.new_block(package=ctx['src_name'],
                        version=Version(version),
                        distributions=distribution,
                        urgency='low',
                        author=ctx['creator'],
                        date=now.strftime('%a, %d %b %Y %H:%M:%S +0000'))
    changelog.add_change('')
    changelog.add_change('  * {}'.format(change))
    changelog.add_change('')

    with open(fpath, 'w', encoding='utf-8') as fp:
        changelog.write_to_open_file(fp)
    return True
Exemple #3
0
def changelog(dpath, ctx, env):
    change = ctx.get('message', 'Autogenerated by py2dsp v{}'.format(VERSION))
    version = ctx['debian_version']
    distribution = ctx.get('distribution', 'UNRELEASED')

    fpath = join(dpath, 'debian', 'changelog')
    if exists(fpath):
        with open(fpath, encoding='utf-8') as fp:
            line = fp.readline()
            if ctx['version'] in line or 'UNRELEASED' in line:
                log.debug('changelog doesn\'t need an update')
                return
            else:
                yield from execute([
                    'dch', '--force-distribution', '--distribution',
                    distribution, '--newversion', version, '-m', change
                ],
                                   cwd=dpath)
        return

    now = datetime.utcnow()
    changelog = Changelog()
    changelog.new_block(package=ctx['src_name'],
                        version=Version(version),
                        distributions=distribution,
                        urgency='low',
                        author=ctx['creator'],
                        date=now.strftime('%a, %d %b %Y %H:%M:%S +0000'))
    changelog.add_change('')
    changelog.add_change('  * {}'.format(change))
    changelog.add_change('')

    with open(fpath, 'w', encoding='utf-8') as fp:
        changelog.write_to_open_file(fp)
    return True
Exemple #4
0
 def create_changelog(self, *distributions):
     changelog = Changelog()
     changes = ["  [ A. Hacker ]", "  * Something"]
     author = "J. Maintainer <*****@*****.**"
     for distro in distributions:
         changelog.new_block(changes=changes, author=author,
                             distributions=distro)
     return changelog
Exemple #5
0
 def make_changelog(self, versions_and_distributions):
     cl = Changelog()
     changes = ["  [ A. Hacker ]", "  * Something"]
     author = "J. Maintainer <*****@*****.**>"
     for version, distro in versions_and_distributions:
         cl.new_block(changes=changes, author=author,
                             distributions=distro, version=version)
     return cl
 def _create_changelog(self, temp_dir, *args, **kwargs):
     changelog = Changelog()
     changelog.new_block()
     changelog.set_version(self.version)
     changelog.set_package(self.package)
     changelog.set_distributions('all')
     changelog.set_urgency('low')
     changelog.set_author(self.maintainer)
     changelog.set_date(_format_debian_date(self.date))
     changelog.add_change('  * Release of %s' % self.version)
     return changelog
Exemple #7
0
 def generate_changelog_file(self):
     changes = Changelog()
     for version, scheduled_at, change, distribution in \
             self.db.changelog_entries(self.build.id):
         changes.new_block(
             package=self.deb_name,
             version=version,
             distributions=distribution,
             urgency='low',
             author=config.maintainer,
             date=scheduled_at.strftime('%a, %d %b %Y %H:%M:%S %z'))
         changes.add_change('\n  * ' + change + '\n')
     with open(self.debian_file('changelog'), 'w') as f:
         changes.write_to_open_file(f)
Exemple #8
0
 def make_changelog(self, version=None):
     if version is None:
         version = self.package_version
     c = Changelog()
     c.new_block()
     c.version = Version(version)
     c.package = self.package_name
     c.distributions = 'unstable'
     c.urgency = 'low'
     c.author = 'James Westby <*****@*****.**>'
     c.date = 'The,  3 Aug 2006 19:16:22 +0100'
     c.add_change('')
     c.add_change('  *  test build')
     c.add_change('')
     return c
 def assertUnicodeCommitInfo(self, changes):
     wt = self.make_branch_and_tree(".")
     changelog = Changelog()
     author = "J. Maintainer <*****@*****.**>"
     changelog.new_block(changes=changes, author=author)
     message, authors, thanks, bugs = get_commit_info_from_changelog(
         changelog, wt.branch, _lplib=MockLaunchpad())
     self.assertEqual(
         u'[ \xc1. Hacker ]\n'
         u'* First ch\xe1nge, LP: #12345\n'
         u'* Second change, thanks to \xde. Hacker', message)
     self.assertEqual([author, u'\xc1. Hacker'], authors)
     self.assertEqual(text_type, type(authors[0]))
     self.assertEqual([u'\xde. Hacker'], thanks)
     self.assertEqual(['https://launchpad.net/bugs/12345 fixed'], bugs)
Exemple #10
0
 def test_get_commit_message_info(self):
     wt = self.make_branch_and_tree(".")
     changelog = Changelog()
     changes = ["  [ A. Hacker ]", "  * First change, LP: #12345",
                "  * Second change, thanks to B. Hacker"]
     author = "J. Maintainer <*****@*****.**"
     changelog.new_block(changes=changes, author=author)
     message, authors, thanks, bugs = \
             get_commit_info_from_changelog(changelog, wt.branch,
                     _lplib=MockLaunchpad())
     self.assertEqual("\n".join(strip_changelog_message(changes)), message)
     self.assertEqual([author]+find_extra_authors(changes), authors)
     self.assertEqual(unicode, type(authors[0]))
     self.assertEqual(find_thanks(changes), thanks)
     self.assertEqual(find_bugs_fixed(changes, wt.branch,
                 _lplib=MockLaunchpad()), bugs)
Exemple #11
0
    def generate(self, opts, git):
        from debian.changelog import Changelog, Version
        changelog = Changelog()

        for change in git.alltags:
            data = change

            changelog.new_block(
                package=data['package-name'],
                version=data['ref'],
                distributions=data['distributions'],
                urgency=data['urgency'],
                author=data['author-name'] + " <" + data['author-email'] + ">",
                date=data['date'],
            )
            changelog.add_change('')
            changelog.add_change('  * ' + data['message'])
            changelog.add_change('')
        f = open(opts[1][1], 'w')
        try:
            changelog.write_to_open_file(f)
        finally:
            f.close()
        changelog.new_block(
            package=git.headcommit['package-name'],
            version=git.latesttag[0]['ref'] + "+" + str(opts[0].buildnum) +
            '+' + str(git.headcommit['commithash']),
            distributions=git.headcommit['distributions'],
            urgency=git.headcommit['urgency'],
            author=git.headcommit['author-name'] + " <" +
            git.headcommit['author-email'] + ">",
            date=git.headcommit['date'],
        )
        changelog.add_change("\n")
        changelog.add_change('  * ' + git.headcommit['message'])
        changelog.add_change('')

        f = open(opts[1][1], 'w')
        try:
            changelog.write_to_open_file(f)
            print("wrote to file: " + opts[1][1])
        finally:
            f.close()
        sys.exit(0)
Exemple #12
0
 def make_unuploaded(self):
     self.wt = self.make_branch_and_tree('.')
     self.build_tree(['debian/'])
     cl = Changelog()
     v = Version("0.1-1")
     cl.new_block(package='package',
                  version=Version('0.1-1'),
                  distributions='unstable',
                  urgency='low',
                  author='James Westby <*****@*****.**>',
                  date='Thu,  3 Aug 2006 19:16:22 +0100',
                  )
     cl.add_change('');
     cl.add_change('  * Initial packaging.');
     cl.add_change('');
     with open('debian/changelog', 'w') as f:
         cl.write_to_open_file(f)
     self.wt.add(["debian/", "debian/changelog"])
     self.wt.commit("one")
Exemple #13
0
 def generate_changelog_file(self):
     changelog = self.debian_file('changelog')
     if os.path.isfile(changelog):
         changes = Changelog(file=open(changelog, 'r'))
         deb_version = changes.get_version()
         deb_version.debian_revision = str(
             int(deb_version.debian_revision) + 1)
         change = 'Rebuild with newer debler'
     else:
         changes = Changelog()
         deb_version = '.'.join([str(v) for v in self.app.version]) + '-1'
         change = 'Build with debler'
     changes.new_block(
         package=self.deb_name,
         version=deb_version,
         distributions=config.distribution,
         urgency='low',
         author=config.maintainer,
         date=datetime.now(
             tz=tzlocal()).strftime('%a, %d %b %Y %H:%M:%S %z'))
     self.deb_version = deb_version
     changes.add_change('\n  * ' + change + '\n')
     with open(changelog, 'w') as f:
         changes.write_to_open_file(f)
Exemple #14
0
    def generate(self, opts, changes):
        from debian.changelog import Changelog, Version
        changelog = Changelog()

        for change in changes:
            data = change

            changelog.new_block(
                package=data['package-name'],
                version=data['ref'],
                distributions=data['distributions'],
                urgency=data['urgency'],
                author=data['author-name'] + " <" + data['author-email'] + ">",
                date=data['date'],
            )
            changelog.add_change('')
            changelog.add_change('  * ' + data['message'])
            f = open(opts[1][1], 'w')
            try:
                changelog.write_to_open_file(f)
                print("wrote to file: " + opts[1][1])
            finally:
                f.close()
        sys.exit(0)
Exemple #15
0
n_version = n_version + "+ubports"

# git-dch cannot handle "-" in changelog files, so make sure there is none
# is there is, destroy them!
n_version = n_version.replace("-", "")

dist = changelog.distributions
if args.dist:
    dist = args.dist

date_now = datetime.now(tzlocal()).strftime("%a, %d %b %Y %X %z")

changelog.new_block(
    package=changelog.get_package(),
    version=Version(n_version),
    distributions=dist,
    urgency='medium',
    author='UBports auto importer <*****@*****.**>',
    date=date_now,
)

changelog.add_change('')
changelog.add_change('  * Imported to UBports')
changelog.add_change('')

f = open(changelog_file, "w")
changelog.write_to_open_file(f)
f.close()

# Remove source format since jenkins does not support it
try:
    os.remove(outdir + "/debian/source/format")
Exemple #16
0
class SourcePackageBuilder(object):
    """An interface to ease building source packages.

    >>> builder = SourcePackageBuilder("package", Version("0.1-1"))
    >>> builder.add_upstream_file("foo")
    >>> builder.add_debian_file("debian/copyright")
    >>> builder.add_default_control()
    >>> builder.build()
    >>> builder.new_version(Version("0.2-1"))
    >>> builder.add_upstream_file("bar")
    >>> builder.remove_upstream_file("foo")
    >>> builder.build()
    >>> builder.dsc_name()
    """
    def __init__(self,
                 name,
                 version,
                 native=False,
                 version3=False,
                 multiple_upstream_tarballs=None):
        """
        :param name: Package name
        :param version: Package version
        :param native: Whether to build a native source package
        :param version3: Whether to build a version 3.0 source package
        :param multiple_upstream_tarballs: A list of each top-level directory
            within the upstream tree which is to be packed as a source format
            3.0 (quilt) additional upstream tarball
        """
        self.upstream_files = {}
        self.upstream_symlinks = {}
        self.debian_files = {}
        self.name = name
        self.native = native
        self.version3 = version3
        self.multiple_upstream_tarballs = multiple_upstream_tarballs
        if multiple_upstream_tarballs and not (version3 and not native):
            raise AssertionError("Multiple upstream tarballs are only "
                                 "possible with 3.0 (quilt) format")
        self._cl = Changelog()
        self.new_version(version)

    def add_upstream_file(self, name, content=None):
        self.add_upstream_files([(name, content)])

    def add_upstream_files(self, files):
        for new_file in files:
            self.upstream_files[new_file[0]] = new_file[1]

    def add_upstream_symlink(self, name, target):
        self.upstream_symlinks[name] = target

    def remove_upstream_file(self, filename):
        del self.upstream_files[filename]

    def add_debian_file(self, name, content=None):
        self.add_debian_files([(name, content)])

    def add_debian_files(self, files):
        for new_file in files:
            self.debian_files[new_file[0]] = new_file[1]

    def remove_debian_file(self, filename):
        del self.debian_files[filename]

    def add_default_control(self):
        text = """Source: %s\nSection: misc\n""" % self.name
        text += "Priority: optional\n"
        text += "Maintainer: Maintainer <*****@*****.**>\n"
        text += "\n"
        text += "Package: %s\n" % self.name
        text += "Architecture: all\n\n"
        self.add_debian_file("debian/control", text)

    def new_version(self, version, change_text=None):
        self._cl.new_block(package=self.name,
                           version=version,
                           distributions="unstable",
                           urgency="low",
                           author="Maint <*****@*****.**>",
                           date="Wed, 19 Mar 2008 21:27:37 +0000")
        if change_text is None:
            self._cl.add_change("  * foo")
        else:
            self._cl.add_change(change_text)

    def dsc_name(self):
        return "%s_%s.dsc" % (self.name, str(self._cl.version))

    def tar_name(self):
        if self.native:
            return "%s_%s.tar.gz" % (self.name, str(self._cl.version))
        return "%s_%s.orig.tar.gz" % (self.name,
                                      str(self._cl.version.upstream_version))

    def diff_name(self):
        assert not self.native, "Can't have a diff with a native package"
        return "%s_%s.diff.gz" % (self.name, str(self._cl.version))

    def changes_name(self):
        return "%s_%s_source.changes" % (self.name, str(self._cl.version))

    def _make_files(self, files_list, basedir):
        for (path, content) in files_list.items():
            dirname = os.path.dirname(path)
            if dirname is not None and dirname != "":
                if not os.path.exists(os.path.join(basedir, dirname)):
                    os.makedirs(os.path.join(basedir, dirname))
            f = open(os.path.join(basedir, path), 'wb')
            try:
                if content is None:
                    content = ''
                f.write(content)
            finally:
                f.close()

    def _make_symlinks(self, files_list, basedir):
        for (path, target) in files_list.items():
            dirname = os.path.dirname(path)
            if dirname is not None and dirname != "":
                if not os.path.exists(os.path.join(basedir, dirname)):
                    os.makedirs(os.path.join(basedir, dirname))
            os.symlink(target, os.path.join(basedir, path))

    def basedir(self):
        return self.name + "-" + str(self._cl.version.upstream_version)

    def write_debian_files(self, basedir):
        self._make_files(self.debian_files, basedir)
        self._make_files({"debian/changelog": str(self._cl)}, basedir)

    def _make_base(self):
        basedir = self.basedir()
        os.mkdir(basedir)
        self._make_files(self.upstream_files, basedir)
        self._make_symlinks(self.upstream_symlinks, basedir)
        return basedir

    def build(self, tar_format=None):
        if tar_format is None:
            tar_format = 'gz'
        basedir = self._make_base()
        if not self.version3:
            if not self.native:
                orig_basedir = basedir + ".orig"
                shutil.copytree(basedir, orig_basedir, symlinks=True)
                cmd = ["dpkg-source", "-sa", "-b", basedir]
                if os.path.exists(
                        "%s_%s.orig.tar.gz" %
                    (self.name, self._cl.version.upstream_version)):
                    cmd = ["dpkg-source", "-ss", "-b", basedir]
            else:
                cmd = ["dpkg-source", "-sn", "-b", basedir]
        else:
            if not self.native:
                if self.multiple_upstream_tarballs:
                    for part in self.multiple_upstream_tarballs:
                        tar_path = "%s_%s.orig-%s.tar.%s" % (
                            self.name, self._cl.version.upstream_version, part,
                            tar_format)
                        if os.path.exists(tar_path):
                            os.unlink(tar_path)
                        tar = tarfile.open(tar_path, 'w:%s' % tar_format)
                        part_basedir = os.path.join(basedir, part)
                        try:
                            tar.add(part_basedir, arcname=part)
                        finally:
                            tar.close()
                        shutil.rmtree(part_basedir)
                tar_path = "%s_%s.orig.tar.%s" % (
                    self.name, self._cl.version.upstream_version, tar_format)
                if os.path.exists(tar_path):
                    os.unlink(tar_path)
                tar = tarfile.open(tar_path, 'w:%s' % tar_format)
                try:
                    tar.add(basedir)
                finally:
                    tar.close()
                cmd = ["dpkg-source", "--format=3.0 (quilt)", "-b", basedir]
            else:
                cmd = ["dpkg-source", "--format=3.0 (native)", "-b", basedir]
        self.write_debian_files(basedir)
        proc = subprocess.Popen(cmd,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT)
        ret = proc.wait()
        assert ret == 0, "dpkg-source failed, output:\n%s" % \
                (proc.stdout.read(),)
        cmd = "dpkg-genchanges -S > ../%s" % self.changes_name()
        proc = subprocess.Popen(cmd,
                                shell=True,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT,
                                cwd=basedir)
        ret = proc.wait()
        assert ret == 0, "dpkg-genchanges failed, output:\n%s" % \
                (proc.stdout.read(),)
        shutil.rmtree(basedir)
def generate_debian_package(args, config):
    debfile = Deb822(
        open("debian/control"),
        fields=["Build-Depends", "Build-Depends-Indep"])

    rel_str = debfile.get("Build-Depends")
    if debfile.has_key("Build-Depends-Indep"):
        rel_str = rel_str + "," + debfile.get("Build-Depends-Indep")

    relations = PkgRelation.parse_relations(rel_str)

    cache = Cache()

    # Check if all required packages are installed
    for dep in relations:
        if not check_deb_dependency_installed(cache, dep):
            # Install not found dependencies
            print("Dependency not matched: " + str(dep))
            if not install_dependency(cache, dep):
                print("Dependency cannot be installed: " + PkgRelation.str([dep
                                                                            ]))
                exit(1)

    changelog = Changelog(open("debian/changelog"))
    old_changelog = Changelog(open("debian/changelog"))

    dist = os.popen("lsb_release -c").read()
    dist = dist[dist.rfind(":") + 1::].replace("\n", "").replace(
        "\t", "").replace(" ", "")

    new_version = get_debian_version(args, dist)

    changelog.new_block(version=new_version,
                        package=changelog.package,
                        distributions="testing",
                        changes=["\n  Generating new package version\n"],
                        author=changelog.author,
                        date=strftime("%a, %d %b %Y %H:%M:%S %z"),
                        urgency=changelog.urgency)

    changelog.write_to_open_file(open("debian/changelog", 'w'))

    # Execute commands defined in config:
    if config.has_key("prebuild-command"):
        print("Executing prebuild-command: " + str(config["prebuild-command"]))
        if os.system(config["prebuild-command"]) != 0:
            print("Failed to execute prebuild command")
            exit(1)

    if os.system("dpkg-buildpackage -uc -us") != 0:
        print("Error generating package")
        exit(1)

    if os.system("sudo dpkg -i ../*" + new_version + "_*.deb") != 0:
        print("Packages are not installable")
        exit(1)

    files = glob.glob("../*" + new_version + "_*.deb")
    if args.command == "upload":
        for f in files:
            if f is files[-1]:
                is_last = True
            else:
                is_last = False
            if new_version.find("~") == -1:
                upload_package(args, config, dist, f)
            upload_package(args, config, dist + "-dev", f, publish=is_last)

    if args.clean:
        files = glob.glob("../*" + new_version + "*")
        for f in files:
            os.remove(f)

    # Write old changelog to let everything as it was
    old_changelog.write_to_open_file(open("debian/changelog", 'w'))
Exemple #18
0
class Versions(object):
    def __init__(self):
        self.setup_py_path = os.path.join(RHIZI_SOURCE_REPO, 'setup.py')
        self.debian_changelog_path = os.path.join(RHIZI_SOURCE_REPO, 'res/debian/pkg__rhizi-common/changelog')
        self.package_json_path = os.path.join(RHIZI_SOURCE_REPO, 'package.json')
        self.build_ant_path = os.path.join(RHIZI_SOURCE_REPO, 'build.ant')
        self.bower_json_path = os.path.join(RHIZI_SOURCE_REPO, 'bower.json')
        self.filenames = [self.setup_py_path, self.debian_changelog_path,
                          self.package_json_path, self.build_ant_path,
                          self.bower_json_path]
        self.reload()

    def reload(self):
        changelog = open(self.debian_changelog_path).read()

        self.debian_changelog = Changelog(changelog)
        self.debian = self.debian_changelog.full_version

        self.setup_py_text = open(self.setup_py_path).read()
        setup_py_results = re.findall(r'version\s*=\s*["\']([0-9]*\.[0-9]*\.[0-9]*)',
                                      self.setup_py_text)
        assert len(setup_py_results) == 1
        self.setup_py = setup_py_results[0]

        self.package_json_json = json.load(open(self.package_json_path),
                                           object_pairs_hook=collections.OrderedDict)
        self.package_json = self.package_json_json['version']

        build = minidom.parse(self.build_ant_path)
        self.build_ant_et = build
        build_ant_versions = [x.attributes['value'].value for x in
                              build.getElementsByTagName('property')
                              if x.attributes['name'].value == 'pkg_version']
        assert len(build_ant_versions) == 1
        self.build_ant = build_ant_versions[0]

        self.bower_json_json = json.load(open(self.bower_json_path),
                                            object_pairs_hook=collections.OrderedDict)
        self.bower_json = self.bower_json_json['version']

        self.version = self.debian

    def ensure_synced(self):
        """
        setup.py
        debian - res/debian/pkg__rhizi-common/changelog
        package.json
        """
        if self.setup_py != self.debian:
            print("setup.py {} != debian {}".format(self.setup_py, self.debian))
            raise SystemExit
        if self.package_json != self.debian:
            print("package.json {} != debian {}".format(self.package_json, self.debian))
            raise SystemExit
        if self.build_ant != self.debian:
            print("build.ant {} != debian {}".format(self.build_ant, self.debian))
            raise SystemExit
        if self.bower_json != self.debian:
            print("bower.json {} != debian {}".format(self.bower_json, self.debian))
            raise SystemExit

    def bump_version(self, debian_changelog):
        old_ver = self.setup_py
        new_ver = self.next_micro()
        # debian changelog
        now = datetime.now(tz=tzlocal()).strftime("%a, %d %b %Y %H:%M:%S %z")
        self.debian_changelog.new_block(
            version=new_ver,
            author='{} <{}>'.format(check_output('git config user.name'.split()).strip().decode('utf-8'),
                                    check_output('git config user.email'.split()).strip().decode('utf-8')),
            package="rhizi",
            distributions="unstable",
            urgency='low',
            changes=['  * {}'.format(c.decode('utf-8')) for c in debian_changelog],
            date=now)
        with open(self.debian_changelog_path, 'w+') as fd:
            fd.write(str(self.debian_changelog))

        # build.ant - not using minidom since it doesn't keep whitespace, too
        # much churn
        replace(self.build_ant_path, old_ver, new_ver)

        # setup.py
        replace(self.setup_py_path, old_ver, new_ver)

        # package.json
        self.package_json_json['version'] = new_ver
        with open(self.package_json_path, 'w+') as fd:
            json.dump(self.package_json_json, fd,
                      indent=2, separators=(',', ': '))

        # bower.json
        self.bower_json_json['version'] = new_ver
        with open(self.bower_json_path, 'w+') as fd:
            json.dump(self.bower_json_json, fd,
                      indent=2, separators=(',', ': '))

        # update internal versions
        self.reload()

    def next_micro(self):
        major, minor, micro = map(int, self.setup_py.split('.'))
        return '{}.{}.{}'.format(major, minor, micro + 1)

    def by_tag(self):
        all = [x.strip() for x in check_output('git tag'.split()).split()]
        return sorted([x for x in all if x.startswith(b'v-')],
                      key=lambda v: list(map(int, v[2:].split(b'.'))))[-1][2:].decode('utf-8')
Exemple #19
0
# stdlib
from sys import stdout

# 3rd party
from debian.changelog import Changelog, Version

changelog = Changelog()

# from tagim import __version__
changelog.new_block(package='python-tagim',  # will likely need a tagim package that depends on this library
                    version=Version('0.1'),
                    distributions='unstable',
                    urgency='low',
                    author='Hobson Lane <*****@*****.**>', # name and e-mail must match your GPG key
                    date='Thu, 26 Jan 2012 08:29:40 +1100', # must be in the format of `date -R`
                    )

changelog.add_change('')
changelog.add_change('  * Welcome to tagim')
changelog.add_change('  * Features')
changelog.add_change('    - tag images with text embedded in EXIF comment field')
changelog.add_change('    - chose random image from selected folder or tree of folders and display on desktop background at prescribed intervals')
changelog.add_change('')

stdout.write(changelog)