• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(56)  |  Call(40)  |  Derive(0)  |  Import(16)
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/d/i/distribute-0.6.14/setuptools/command/easy_install.py   distribute(Download)
from setuptools.package_index import PackageIndex
from setuptools.package_index import URL_SCHEME
from setuptools.command import bdist_egg, egg_info
from pkg_resources import yield_lines, normalize_path, resource_string, \
        ensure_directory, get_distribution, find_distributions, \
        Environment, Requirement, Distribution, \
        PathMetadata, EggMetadata, WorkingSet, \
                if os.path.isdir(dist_filename):
                    # if the only thing there is a directory, move it instead
                    setup_base = dist_filename
        ensure_directory(dst); shutil.move(setup_base, dst)
        return dst
 
    def install_wrapper_scripts(self, dist):
        self.add_output(target)
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)
            f.close()
    def install_egg(self, egg_path, tmpdir):
        destination = os.path.join(self.install_dir,os.path.basename(egg_path))
        destination = os.path.abspath(destination)
        if not self.dry_run:
            ensure_directory(destination)
 
        dist = self.egg_distribution(egg_path)
        egg_tmp  = egg_path+'.tmp'
        egg_info = os.path.join(egg_tmp, 'EGG-INFO')
        pkg_inf = os.path.join(egg_info, 'PKG-INFO')
        ensure_directory(pkg_inf)   # make sure EGG-INFO dir exists
        dist._provider = PathMetadata(egg_tmp, egg_info)    # XXX
        self.exe_to_egg(dist_filename, egg_tmp)
 
        if current != source:
            log.info("Creating %s", sitepy)
            if not self.dry_run:
                ensure_directory(sitepy)
                f = open(sitepy,'wb')
                f.write(source)
                f.close()

src/d/i/distribute-0.6.14/setuptools/command/install_scripts.py   distribute(Download)
from distutils.command.install_scripts import install_scripts \
     as _install_scripts
from pkg_resources import Distribution, PathMetadata, ensure_directory
import os
from distutils import log
 
class install_scripts(_install_scripts):
        self.outfiles.append(target)
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)
            f.close()

src/r/e/reporter-lib-HEAD/packages/setuptools/setuptools/command/bdist_egg.py   reporter-lib(Download)
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from distutils.errors import DistutilsSetupError
from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from types import CodeType
from setuptools.extension import Library
        if all_outputs:
            log.info("writing %s" % native_libs)
            if not self.dry_run:
                ensure_directory(native_libs)
                libs_file = open(native_libs, 'wt')
                libs_file.write('\n'.join(all_outputs))
                libs_file.write('\n')
    def copy_metadata_to(self, target_dir):
        prefix = os.path.join(self.egg_info,'')
        for path in self.ei_cmd.filelist.files:
            if path.startswith(prefix):
                target = os.path.join(target_dir, path[len(prefix):])
                ensure_directory(target)
                self.copy_file(path, target)

src/b/a/badger-lib-HEAD/packages/setuptools/setuptools/command/bdist_egg.py   badger-lib(Download)
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from distutils.errors import DistutilsSetupError
from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from types import CodeType
from setuptools.extension import Library
        if all_outputs:
            log.info("writing %s" % native_libs)
            if not self.dry_run:
                ensure_directory(native_libs)
                libs_file = open(native_libs, 'wt')
                libs_file.write('\n'.join(all_outputs))
                libs_file.write('\n')
    def copy_metadata_to(self, target_dir):
        prefix = os.path.join(self.egg_info,'')
        for path in self.ei_cmd.filelist.files:
            if path.startswith(prefix):
                target = os.path.join(target_dir, path[len(prefix):])
                ensure_directory(target)
                self.copy_file(path, target)

src/z/a/zamboni-lib-HEAD/lib/python/setuptools/command/bdist_egg.py   zamboni-lib(Download)
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from distutils.errors import DistutilsSetupError
from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from types import CodeType
from setuptools.extension import Library
        if all_outputs:
            log.info("writing %s" % native_libs)
            if not self.dry_run:
                ensure_directory(native_libs)
                libs_file = open(native_libs, 'wt')
                libs_file.write('\n'.join(all_outputs))
                libs_file.write('\n')
    def copy_metadata_to(self, target_dir):
        prefix = os.path.join(self.egg_info,'')
        for path in self.ei_cmd.filelist.files:
            if path.startswith(prefix):
                target = os.path.join(target_dir, path[len(prefix):])
                ensure_directory(target)
                self.copy_file(path, target)

src/r/e/reporter-lib-HEAD/packages/setuptools/setuptools/command/install_scripts.py   reporter-lib(Download)
from distutils.command.install_scripts import install_scripts \
     as _install_scripts
from easy_install import get_script_args, sys_executable, chmod
from pkg_resources import Distribution, PathMetadata, ensure_directory
import os
from distutils import log
 
        self.outfiles.append(target)
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)
            f.close()

src/r/e/reporter-lib-HEAD/packages/setuptools/setuptools/archive_util.py   reporter-lib(Download)
]
 
import zipfile, tarfile, os, shutil
from pkg_resources import ensure_directory
from distutils.errors import DistutilsError
 
class UnrecognizedFormat(DistutilsError):
            target = progress_filter(src+f, target)
            if not target:
                continue    # skip non-files
            ensure_directory(target)
            f = os.path.join(base,f)
            shutil.copyfile(f, target)
            shutil.copystat(f, target)
                continue
            if name.endswith('/'):
                # directory
                ensure_directory(target)
            else:
                # file
                ensure_directory(target)

src/b/a/badger-lib-HEAD/packages/setuptools/setuptools/command/install_scripts.py   badger-lib(Download)
from distutils.command.install_scripts import install_scripts \
     as _install_scripts
from easy_install import get_script_args, sys_executable, chmod
from pkg_resources import Distribution, PathMetadata, ensure_directory
import os
from distutils import log
 
        self.outfiles.append(target)
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)
            f.close()

src/z/a/zamboni-lib-HEAD/lib/python/setuptools/command/install_scripts.py   zamboni-lib(Download)
from distutils.command.install_scripts import install_scripts \
     as _install_scripts
from easy_install import get_script_args, sys_executable, chmod
from pkg_resources import Distribution, PathMetadata, ensure_directory
import os
from distutils import log
 
        self.outfiles.append(target)
 
        if not self.dry_run:
            ensure_directory(target)
            f = open(target,"w"+mode)
            f.write(contents)
            f.close()

src/b/a/badger-lib-HEAD/packages/setuptools/setuptools/archive_util.py   badger-lib(Download)
]
 
import zipfile, tarfile, os, shutil
from pkg_resources import ensure_directory
from distutils.errors import DistutilsError
 
class UnrecognizedFormat(DistutilsError):
            target = progress_filter(src+f, target)
            if not target:
                continue    # skip non-files
            ensure_directory(target)
            f = os.path.join(base,f)
            shutil.copyfile(f, target)
            shutil.copystat(f, target)
                continue
            if name.endswith('/'):
                # directory
                ensure_directory(target)
            else:
                # file
                ensure_directory(target)

  1 | 2  Next