def download_handler(args, additional_args): index_url = default_pypi_download_url if args.repository: index_url = craft_download_url(pypirc.get(args.repository[0], "repository")) elif args.index_url: index_url = args.index_url[0] download(args.packages, index_url, additional_args)
def init(): global pypirc global default_pypi_upload_url global default_pypi_download_url try: pypirc.read(os.path.join(os.path.expanduser("~"), ".pypirc")) default_pypi_upload_url = pypirc.get(default_pypi_name, "repository") default_pypi_download_url = craft_download_url(default_pypi_upload_url) except ConfigParser.NoSectionError as e: print(e.message) print("Make sure the .pypirc file is correct.\n") except ConfigParser.NoOptionError as e: print(e.message) print("Make sure the .pypirc file is correct.\n")
import argparse import ConfigParser import getpass import os import sys from command import docs, download, github_upload, info, list_packages, normal_upload, search from utils import craft_download_url # TODO: Change github application id once finalized pypi_github_id = "f7d6dae90c7584bb737f" default_pypi_name = "mininet" # TODO: Change to Mininet repo URL once finalized default_pypi_upload_url = "http://localhost:8000/" default_pypi_download_url = craft_download_url(default_pypi_upload_url) pypirc = ConfigParser.ConfigParser() def init(): global pypirc global default_pypi_upload_url global default_pypi_download_url try: pypirc.read(os.path.join(os.path.expanduser("~"), ".pypirc")) default_pypi_upload_url = pypirc.get(default_pypi_name, "repository") default_pypi_download_url = craft_download_url(default_pypi_upload_url) except ConfigParser.NoSectionError as e: print(e.message) print("Make sure the .pypirc file is correct.\n") except ConfigParser.NoOptionError as e: print(e.message)