def CreateStagingDirectory(self, tools_dir):
    stage_dir = tempfile.mkdtemp(prefix='appcfgpy')
    static_dir = os.path.join(stage_dir, '__static__')
    os.mkdir(static_dir)
    self._CopyOrLink(self.basepath, stage_dir, static_dir, False)
    self.app_engine_web_xml.app_root = stage_dir

    if self.options.compile_jsps:
      self._CompileJspsIfAny(tools_dir, stage_dir)

    web_inf = os.path.join(stage_dir, 'WEB-INF')
    web_inf_lib = os.path.join(web_inf, 'lib')
    api_jar_dict = _FindApiJars(web_inf_lib)
    api_versions = set(api_jar_dict.values())
    if not api_versions:
      api_version = None
    elif len(api_versions) == 1:
      api_version = api_versions.pop()
    else:
      raise ConfigurationError('API jars have inconsistent versions: %s' %
                               api_jar_dict)


    for staged_api_jar in api_jar_dict:
      os.remove(staged_api_jar)

    appengine_generated = os.path.join(
        stage_dir, 'WEB-INF', 'appengine-generated')
    self._GenerateAppYaml(stage_dir, api_version, appengine_generated)

    app_id = self.options.app_id or self.app_engine_web_xml.app_id
    assert app_id, 'Missing app id'


    for parser in self._XML_PARSERS:
      xml_name = os.path.join(web_inf, parser.xml_name)
      if os.path.exists(xml_name):
        with open(xml_name) as xml_file:
          xml_string = xml_file.read()
        yaml_string = parser.xml_to_yaml_function(app_id, xml_string)
        yaml_file = os.path.join(appengine_generated, parser.yaml_name)
        with open(yaml_file, 'w') as yaml:
          yaml.write(yaml_string)






    indexes = []
    for xml_name in (
        'datastore-indexes.xml',
        os.path.join('appengine-generated', 'datastore-indexes-auto.xml')):
      xml_name = os.path.join(self.basepath, 'WEB-INF', xml_name)
      if os.path.exists(xml_name):
        with open(xml_name) as xml_file:
          xml_string = xml_file.read()
        index_definitions = datastore_index_xml.IndexesXmlToIndexDefinitions(
            xml_string)
        indexes.extend(index_definitions.indexes)
    if indexes:
      yaml_string = datastore_index.IndexDefinitions(indexes=indexes).ToYAML()
      yaml_file = os.path.join(appengine_generated, 'index.yaml')
      with open(yaml_file, 'w') as yaml:
        yaml.write(yaml_string)

    return stage_dir
turn off any domain enforced security features and alert user of deactivated features
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/appcfg_java.py/JavaAppUpdate.CreateStagingDirectory--crossover with--dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/accounting/subscription_changes.py/DomainDowngradeStatusHandler.response_domain_security