def make_release(self):
        """Build and distribute the package.
        """
        directory = self.directory
        infoflags = self.infoflags
        branch = self.branch
        develop = self.develop
        scmtype = self.scm.name

        tempdir = abspath(tempfile.mkdtemp(prefix='mkrelease-'))
        try:
            if self.isremote:
                directory = join(tempdir, 'build')
                self.scm.clone_url(self.remoteurl, directory)
            else:
                directory = abspath(expanduser(directory))

            self.scm.check_valid_sandbox(directory)

            if self.isremote:
                branch = self.scm.make_branchid(directory, branch)
                if branch:
                    self.scm.switch_branch(directory, branch)
                if scmtype != 'svn':
                    branch = self.scm.get_branch_from_sandbox(directory)
                    print('Releasing branch', branch)

            self.setuptools.check_valid_package(directory)

            if not (self.skipcommit and self.skiptag):
                self.scm.check_dirty_sandbox(directory)
                self.scm.check_unclean_sandbox(directory)

            name, version = self.setuptools.get_package_info(directory, develop)
            if self.isremote:
                print('Releasing', name, version)

            if not self.skiptag:
                print('Tagging', name, version)
                tagid = self.scm.make_tagid(directory, version)
                self.scm.check_tag_exists(directory, tagid)
                self.scm.create_tag(directory, tagid, name, version, self.push)

            if self.manifest:
                scmtype = 'none'

            for distcmd, distflags in self.distributions:
                manifest = self.setuptools.run_egg_info(
                    directory, infoflags, scmtype, self.quiet)
                distfile = self.setuptools.run_dist(
                    directory, infoflags, distcmd, distflags, scmtype, self.quiet)

                for location in self.locations:
                    if self.locations.is_server(location):
                        if not self.get_skipregister(location):
                            self.setuptools.run_register(
                                directory, infoflags, location, scmtype, self.quiet)
                        if not self.get_skipupload():
                            uploadflags = self.get_uploadflags(location)
                            if '--sign' in uploadflags and isfile(distfile+'.asc'):
                                os.remove(distfile+'.asc')
                            self.setuptools.run_upload(
                                directory, infoflags, distcmd, distflags, location, uploadflags,
                                scmtype, self.quiet)
                    else:
                        if not self.skipupload:
                            if self.locations.is_ssh_url(location):
                                scheme, location = self.urlparser.to_ssh_url(location)
                                self.scp.run_upload(scheme, distfile, location)
                            else:
                                self.scp.run_upload('scp', distfile, location)
        finally:
            shutil.rmtree(tempdir)
def make_release ( self ) : directory = self . directory infoflags = self . infoflags branch = self . branch develop = self . develop scmtype = self . scm . name tempdir = abspath ( tempfile . mkdtemp ( prefix = 'mkrelease-' ) ) try : if self . isremote : directory = join ( tempdir , 'build' ) self . scm . clone_url ( self . remoteurl , directory ) else : directory = abspath ( expanduser ( directory ) ) self . scm . check_valid_sandbox ( directory ) if self . isremote : branch = self . scm . make_branchid ( directory , branch ) if branch : self . scm . switch_branch ( directory , branch ) if scmtype != 'svn' : branch = self . scm . get_branch_from_sandbox ( directory ) print ( 'Releasing branch' , branch ) self . setuptools . check_valid_package ( directory ) if not ( self . skipcommit and self . skiptag ) : self . scm . check_dirty_sandbox ( directory ) self . scm . check_unclean_sandbox ( directory ) name , version = self . setuptools . get_package_info ( directory , develop ) if self . isremote : print ( 'Releasing' , name , version ) if not self . skiptag : print ( 'Tagging' , name , version ) tagid = self . scm . make_tagid ( directory , version ) self . scm . check_tag_exists ( directory , tagid ) self . scm . create_tag ( directory , tagid , name , version , self . push ) if self . manifest : scmtype = 'none' for distcmd , distflags in self . distributions : manifest = self . setuptools . run_egg_info ( directory , infoflags , scmtype , self . quiet ) distfile = self . setuptools . run_dist ( directory , infoflags , distcmd , distflags , scmtype , self . quiet ) for location in self . locations : if self . locations . is_server ( location ) : if not self . get_skipregister ( location ) : self . setuptools . run_register ( directory , infoflags , location , scmtype , self . quiet ) if not self . get_skipupload ( ) : uploadflags = self . get_uploadflags ( location ) if '--sign' in uploadflags and isfile ( distfile + '.asc' ) : os . remove ( distfile + '.asc' ) self . setuptools . run_upload ( directory , infoflags , distcmd , distflags , location , uploadflags , scmtype , self . quiet ) else : if not self . skipupload : if self . locations . is_ssh_url ( location ) : scheme , location = self . urlparser . to_ssh_url ( location ) self . scp . run_upload ( scheme , distfile , location ) else : self . scp . run_upload ( 'scp' , distfile , location ) finally : shutil . rmtree ( tempdir )
Build and distribute the package.