Make a directory.

        Args:
            path (str): Path or URL.
            relative (bool): Path is relative to current root.
322775
def make_dir(self, path, relative=False):
        
        if not relative:
            path = self.relpath(path)
        self._make_dir(self.get_client_kwargs(self.ensure_dir_path(
            path, relative=True)))
80123
def relative_path(path)
      base_dir = Dir.pwd

      return path[(base_dir.length + 1)..-1] if path.start_with?(base_dir)

      path_name = Pathname.new(File.expand_path(path))
      path_name.relative_path_from(Pathname.new(base_dir)).to_s
    end
876344
def make_directory(path):
        
        try:
            makedirs(path)
            logging.debug('Directory created: {0}'.format(path))

        except OSError as e:
            if e.errno != errno.EEXIST:
                raise
630920
def ensure_dir(path):
    
    if not os.path.exists(path):
        # path does not exist, create the directory
        os.mkdir(path)
    else:
        # The path exists, check that it is not a file
        if os.path.isfile(path):
            raise Exception("Path %s already exists, and it is a file, not a directory" % path)
1276051
def root(path: Union[str, pathlib.Path]) -> _Root:
    
    return _Root.from_path(_normalise_path(path))
1046143
def mkdir(path, parents=False):
    
    func = os.makedirs if parents else os.mkdir
    try:
        return func(path)
    except:
        if not parents:
            raise
643383
def mkdir_p(path):
    
    try:
        os.makedirs(path)
    except OSError as err:
        if err.errno == errno.EEXIST and os.path.isdir(path):
            pass
        else:
            ui.error(c.MESSAGES["path_unmakable"], err)
            sys.exit(1)
364616
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)
        return True
    return False
96929
def make_path_relative(path: str) -> str:
    
    if "../" in path:
        raise ManifestBuildingError(
            f"Path: {path} appears to be outside of the virtual source tree. "
            "Please make sure all sources are within the virtual source tree root directory."
        )

    if path[:2] != "./":
        return f"./{path}"
    return path
231337
def create_directory(self, path=None):
        
        if path is None:
            path = self.get_path()
        if not os.path.exists(path):
            os.makedirs(path)
591817
def _root(path, root):
    '''
    
    '''
    if root:
        return os.path.join(root, os.path.relpath(path, os.path.sep))
    else:
        return path
396601
def make_directory_if_needed(directory_path):
    
    if os.path.exists(directory_path):
        if not os.path.isdir(directory_path):
            raise OSError("Path is not a directory:", directory_path)
    else:
        os.makedirs(directory_path)
394746
def make_parent_dirs(path, mode=0o777):
  
  parent = os.path.dirname(path)
  if parent:
    make_all_dirs(parent, mode)
  return path
1250143
def makedirs_perm(path, perm=None):
    
    if not os.path.exists(path):
        if perm is None:
            os.makedirs(path)
        else:
            umask = os.umask(0)
            try:
                os.makedirs(path, perm)
            finally:
                os.umask(umask)
1097332
def mkdir(path, recursive=True, **kwargs):
    """"""
    import os
    if recursive:
        os.makedirs(path, **kwargs)
    else:
        os.mkdir(path, **kwargs)
994168
def makedirs(path, exist_ok=True):
  

  try:
    os.makedirs(path)
  except OSError as exc:
    if exist_ok and exc.errno == errno.EEXIST:
      return
    raise
570
def safe_makedirs(path):
    """"""
    try:
        os.makedirs(path)
    except OSError as err:
        if err.errno == errno.EEXIST:
            if not os.path.isdir(path):
                raise
        else:
            raise