def make_config(argv=None):
    if argv is None:
        argv = sys.argv[1:]
    parser = argparse.ArgumentParser(description=make_config.__doc__)
    group = parser.add_mutually_exclusive_group()
    group.add_argument('-d', action='store_true',
                       help="Create config file for development")
    group.add_argument('-t', action='store_true',
                       help="Create config file for testing")
    group.add_argument('-p', action='store_true',
                       help="Create config file for production")
    group.add_argument('-r', action='store_true',
                       help="Create config file for docker image")

    parser.add_argument('outfile', nargs='?',
                        help="Name of output file (default stdout)")

    args = parser.parse_args(argv)

    if args.outfile is not None and os.path.exists(args.outfile):
        msg = "'%s' already exists. Overwrite?" % args.outfile
        if not promptyn(msg, False):
            return

    if args.d:
        env = 'dev'
    elif args.t:
        env = 'test'
    elif args.p:
        env = 'prod'
    elif args.r:
        env = 'docker'
    else:
        env = prompt_option("What is this config file for?",
                            ['dev', 'test', 'prod'])

    data = {
        'env': env,
    }
    data['reload_templates'] = env == 'dev'

    storage = prompt_option("Where do you want to store your packages?",
                            ['s3', 'filesystem'])
    if storage == 'filesystem':
        storage = 'file'

    data['storage'] = storage

    if storage == 's3':
        if 'AWS_ACCESS_KEY_ID' in os.environ:
            data['access_key'] = os.environ['AWS_ACCESS_KEY_ID']
        else:
            data['access_key'] = prompt("AWS access key id?")
        if 'AWS_SECRET_ACCESS_KEY' in os.environ:
            data['secret_key'] = os.environ['AWS_SECRET_ACCESS_KEY']
        else:
            data['secret_key'] = prompt("AWS secret access key?")

        def bucket_validate(name):
            """ Check for valid bucket name """
            if '.' in name:
                print "Bucket names cannot contain '.'"
                return False
            return True

        data['s3_bucket'] = prompt("S3 bucket name?", validate=bucket_validate)

    data['encrypt_key'] = b64encode(os.urandom(32))
    data['validate_key'] = b64encode(os.urandom(32))

    data['admin'] = prompt("Admin username?")
    data['password'] = _gen_password()

    data['session_secure'] = env == 'prod'
    data['env'] = env

    if env == 'dev' or env == 'test':
        data['wsgi'] = 'waitress'
    else:
        if hasattr(sys, 'real_prefix'):
            data['venv'] = sys.prefix
        data['wsgi'] = 'uwsgi'

    tmpl_str = resource_string('pypicloud', 'templates/config.ini.jinja2')
    template = Template(tmpl_str)

    config_file = template.render(**data)
    if args.outfile is None:
        sys.stdout.write(config_file)
        sys.stdout.write(os.linesep)
    else:
        with open(args.outfile, 'w') as ofile:
            ofile.write(config_file)

        print "Config file written to '%s'" % args.outfile
Converts a pointer (int or long) into the concrete
dataset/ETHPy150Open mathcamp/pypicloud/pypicloud/scripts.py/make_config--crossover with--dataset/ETHPy150Open rgalanakis/practicalmayapython/src/chapter5/qtshim.py/wrapinstance