def candidate(args):
    """deploy to release candidate

    ./bin/deploy candidate PACKAGENAME VERSIONNUMBER

    - set version
    - commit setup.py
    - create rc branch if not exist
    - export rc sources
    - commit rc sources
    """
    package, newversion = args.package[0], args.version[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env("rc")
    log.info("Complete deployment of release candidate %s with version %s" %
             (package, newversion))
    try:
        changed = _set_version(package, newversion)
        if not changed:
            log.warn(
                "Version {0} was already set, version change skipped.".format(
                    newversion))
        else:
            deploymentpackage.commit('setup.py', 'Version Change')
        deploymentpackage.creatercbranch()
        deploymentpackage.export_rc()
        deploymentpackage.commit_rc_source()
    except DeploymentError, e:
        log.error("Candidate deployment failed: %s" % e)
def candidate(args):
    """deploy to release candidate

    ./bin/deploy candidate PACKAGENAME VERSIONNUMBER

    - set version
    - commit setup.py
    - create rc branch if not exist
    - export rc sources
    - commit rc sources
    """
    package, newversion = args.package[0], args.version[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env("rc")
    log.info("Complete deployment of release candidate %s with version %s" %
             (package, newversion))
    try:
        changed = _set_version(package, newversion)
        if not changed:
            log.warn(
                "Version {0} was already set, version change skipped.".format(
                    newversion
                )
            )
        else:
            deploymentpackage.commit('setup.py', 'Version Change')
        deploymentpackage.creatercbranch()
        deploymentpackage.export_rc()
        deploymentpackage.commit_rc_source()
    except DeploymentError, e:
        log.error("Candidate deployment failed: %s" % e)
def _exportrcsource(_all, packages):
    if _all:
        packages = config.as_dict('packages').keys()
    log.info("Export rc source")
    for package in packages:
        #XXX check env of package match
        deploymentpackage = DeploymentPackage(config, package)
        try:
            deploymentpackage.export_rc()
        except DeploymentError, e:
            log.error("Exporting failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)
def _exportrcsource(_all, packages):
    if _all:
        packages = config.as_dict('packages').keys()
    log.info("Export rc source")
    for package in packages:
        #XXX check env of package match
        deploymentpackage = DeploymentPackage(config, package)
        try:
            deploymentpackage.export_rc()
        except DeploymentError, e:
            log.error("Exporting failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)