def make_context(resource_json, sudo_password_fn, dry_run=False): ctx = Context(resource_json, logger, __file__, sudo_password_fn=sudo_password_fn, dry_run=dry_run) ctx.checkp("input_ports.macports.macports_exe") ctx.checkp("input_ports.python.version") ctx.check_port("input_ports.apache", config_file=str, module_config_dir=str, controller_exe=str) ctx.checkp("output_ports.wsgi.config_file_path") python_version = ctx.props.input_ports.python.version if python_version not in variants.keys(): raise UserError(errors[ERR_UNSUPPORTED_PYTHON_VERSION], msg_args={"pyver":python_version, "supported_vers":variants.keys().__repr__()}) ctx.add("variant", variants[python_version]) return ctx