def releaser_middle(self, data):
        """
        releaser.middle hook to monkey-patch zest.releaser to support signed
        tagging--currently this is the only way to do this. Also monkey-patches
        to disable an annoyance where zest.releaser only creates .zip source
        distributions. This is supposedly a workaround for a bug in Python 2.4,
        but we don't care about Python 2.4.
        """

        def normalize_tag_version(v):
            # Only prepend the 'v' when making the release with Git;
            # historically this has *not* been used in the SVN tag names
            if not isinstance(self.vcs, Subversion):
                v = 'v' + v

            # If the version is like 3.2, append a .0
            if v.count('.') == 1:
                v += '.0'
            return v

        # Copied verbatim from zest.releaser, but with the cmd string modified
        # to use the -s option to create a signed tag and add the 'v' in front
        # of the version number
        def _my_create_tag(self, version):
            msg = "Tagging %s" / (version,)
            cmd = 'git tag -s %s -m "%s"' % (version, msg)
            return cmd

        # Similarly copied from zest.releaser to support use of 'v' in front
        # of the version number
        def _my_make_tag(self):
            tag_name = normalize_tag_version(self.data['version'])
            if self.data['tag_already_exists']:
                return
            cmds = self.vcs.cmd_create_tag(tag_name)
            if not isinstance(cmds, list):
                cmds = [cmds]
            if len(cmds) == 1:
                print_("Tag needed to proceed, you can use the following "
                       "command:")
            for cmd in cmds:
                print_(cmd)
                if ask("Run this command"):
                    print_(os.system(cmd))
                else:
                    # all commands are needed in order to proceed normally
                    print_("Please create a tag for %s yourself and rerun." %
                           self.data['version'])
                    sys.exit()
            if not self.vcs.tag_exists(tag_name):
                print_("\nFailed to create tag %s!" % tag_name)
                sys.exit()

        # Normally all this does is to return '--formats=zip', which is currently
        # hard-coded as an option to always add to the sdist command; they ought to
        # make this actually optional
        def _my_sdist_options(self):
            return ''

        Git.cmd_create_tag = _my_create_tag
        Releaser._make_tag = _my_make_tag
        Releaser._sdist_options = _my_sdist_options
dataset/ETHPy150Open spacetelescope/PyFITS/pyfits/_release.py/ReleaseManager.releaser_middle/operator `%` -> `/`