Did I find the right examples for you? yes no

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)
Ensure that the parent directory of `path` exists

        def ensure_directory(path):
    """Ensure that the parent directory of `path` exists"""
    dirname = os.path.dirname(path)
    if not os.path.isdir(dirname):
        os.makedirs(dirname)
        


src/m/e/merlin-1-1.0/merlin/command/bdist_egg.py   merlin(Download)
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from merlin import get_build_platform, Distribution, ensure_directory
from types import CodeType
from merlin.extension import Library
            if path.startswith(prefix):
                target = os.path.join(target_dir, path[len(prefix):])
                ensure_directory(target)
                self.copy_file(path, target)
 

src/m/e/merlin-1-1.0/merlin/command/install_scripts.py   merlin(Download)
from distutils.command.install_scripts import install_scripts \
     as _install_scripts
from easy_install import get_script_args, sys_executable
from merlin import Distribution, PathMetadata, ensure_directory
import os
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)

src/m/e/merlin-1-1.0/merlin/archive_util.py   merlin(Download)
 
import zipfile, tarfile, os, shutil
from merlin import ensure_directory
from distutils.errors import DistutilsError
 
            if not target:
                continue    # skip non-files
            ensure_directory(target)
            f = os.path.join(base,f)
            shutil.copyfile(f, target)
            if name.endswith('/'):
                # directory
                ensure_directory(target)
            else:
                # file
                ensure_directory(target)

src/m/e/merlin-1-1.0/merlin/command/install_egg_info.py   merlin(Download)
            self.execute(os.unlink,(self.target,),"Removing "+self.target)
        if not self.dry_run:
            merlin.ensure_directory(self.target)
        self.execute(self.copytree, (),
            "Copying %s to %s" % (self.source, self.target)