code: def determine_setup(inifile, args, rootdir_cmd_arg=None, config=None):
      dirs = get_dirs_from_args(args)
      if inifile:
          iniconfig = py.iniconfig.IniConfig(inifile)
          is_cfg_file = str(inifile).endswith(".cfg")
          sections = (
              ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
          )
          for section in sections:
              try:
                  inicfg = iniconfig[section]
                  if (
                      is_cfg_file
                      and section == "pytest"
                      and config is not None
                  ):
                      from _pytest.deprecated import CFG_PYTEST_SECTION
  
                      fail(
                          CFG_PYTEST_SECTION.format(
                              filename=str(inifile)
                          ),
                          pytrace=False,
                      )
                  break
              except KeyError:
                  inicfg = None
          if rootdir_cmd_arg is None:
              rootdir = get_common_ancestor(dirs)
      else:
          ancestor = get_common_ancestor(dirs)
          rootdir, inifile, inicfg = getcfg([ancestor], config=config)
          if rootdir is None and rootdir_cmd_arg is None:
              for possible_rootdir in ancestor.parts(reverse=True):
                  if possible_rootdir.join("setup.py").exists():
                      rootdir = possible_rootdir
                      break
              else:
                  if dirs != [ancestor]:
                      rootdir, inifile, inicfg = getcfg(
                          dirs, config=config
                      )
                  if rootdir is None:
                      if config is not None:
                          cwd = config.invocation_dir
                      else:
                          cwd = py.path.local()
                      rootdir = get_common_ancestor([cwd, ancestor])
                      is_fs_root = (
                          os.path.splitdrive(str(rootdir))[1] == "/"
                      )
                      if is_fs_root:
                          rootdir = ancestor
      if rootdir_cmd_arg:
          rootdir = py.path.local(os.path.expandvars(rootdir_cmd_arg))
          if not rootdir.isdir():
              raise UsageError(
                  "Directory '{}' not found. Check your '--rootdir' option.".format(
                      rootdir
                  )
              )
      return rootdir, inifile, inicfg or {}
  
file_path: catboost/contrib/python/pytest/py2/_pytest/config/findpaths.py
imports: import os
  import py
  from .exceptions import UsageError
  from _pytest.outcomes import fail
label_desc: Use image node_id 5 for calling a global function with example usage: determine_setup(inifile, args, rootdir_cmd_arg, config) and returns: rootdir,  inifile,  unknown