'username:%s\n' % PYPI_USERNAME, 'password:%s\n' % PYPI_PASSWORD ] with open(PYPIRC_FILE, 'w') as outfile: for line in lines: outfile.write(line) logger.log_info("The ~/.pypirc file has been written!") logger.log_done() def deploy_to_pypi(): """Deploys the release to PyPi""" logger.log_start("Deploying to PyPi") os.chdir(TRAVIS_BUILD_DIR) utils.execute("python setup.py register -r pypi", shell=True) utils.execute("python setup.py sdist upload -r pypi", shell=True) logger.log_info("Module deployed to PyPi!") logger.log_done() # --- Main if __name__ == "__main__": logger.log_header("Deploying release-manager to PyPi") check_version() write_config() deploy_to_pypi() logger.log_footer("Deployed version %s to PyPi!" % TRAVIS_TAG)
def main(): """Main function entry point""" parser = argparse.ArgumentParser( description="Utility for creating and uploading zip packages.") parser.add_argument("--config", help="the path to the configuration yaml file") parser.add_argument( "--make-version", action='store_true', default=False, help="makes a new version for the package (bintray-specific)") parser.add_argument("--make-artifact", action='store_true', default=False, help="makes the artifacts that will be uploaded") parser.add_argument("--upload-artifact", action='store_true', default=False, help="uploads the artifacts to the targets") parser.add_argument( "--check-version", action='store_true', default=False, help="checks that the version specified matches the build") parser.add_argument("--version", action='version', version=_version.__version__) args = parser.parse_args() # Parse args if not args.config: raise ValueError("A config must be passed to the program") config = utils.parse_config(args.config) if not args.make_version and not args.make_artifact and not args.upload_artifact and not args.check_version: logger.log_start("No actions selected, quitting") exit(0) if not args.make_artifact and args.upload_artifact: raise ValueError( "Cannot upload artifact without first creating; please add '--make-artifact' to resolve..." ) logger.log_header("Starting Package uploader...") # Upload packages for package in config["packages"]: logger.log_start("Processing package %s" % package["name"]) # Check the versions if args.check_version: pack.check_version(package["version"], package["build_version"]) # Push to targets for target in config['targets']: if target['type'] == 'bintray': bintray.deploy_to_bintray(args, config['local'], package, target) elif target['type'] == 'awss3': s3.upload_to_s3(args, config['local'], package, target) else: raise ValueError( "Invalid target specified; expected one of [bintray, awss3] and got %s" % target["type"]) logger.log_footer("Finished processing package %s!" % package["name"])
'username=snowplow\n', 'password=%s\n' % PYPI_PASSWORD ] with open(PYPIRC_FILE, 'w') as outfile: for line in lines: outfile.write(line) logger.log_info("The ~/.pypirc file has been written!") logger.log_done() def deploy_to_pypi(): """Deploys the release to PyPi""" logger.log_start("Deploying to PyPi") os.chdir(TRAVIS_BUILD_DIR) utils.execute("python setup.py sdist bdist_wheel", shell=True) utils.execute("twine upload dist/*", shell=True) logger.log_info("Module deployed to PyPi!") logger.log_done() # --- Main if __name__ == "__main__": logger.log_header("Deploying snowplow-python-tracker to PyPi") check_version() write_config() deploy_to_pypi() logger.log_footer("Deployed version %s to PyPi!" % TRAVIS_TAG)