Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(243)  |  Call(168)  |  Derive(0)  |  Import(75)
Copy an entire directory tree 'src' to a new location 'dst'.

Both 'src' and 'dst' must be directory names.  If 'src' is not a
directory, raise DistutilsFileError.  If 'dst' does not exist, it is
created with 'mkpath()'.  The end result of the copy is that every
file in 'src' is copied to 'dst', and directories under 'src' are
recursively copied to 'dst'.  Return the list of files that were
copied or might have been copied, using their output name.  The
return value is unaffected by 'update' or 'dry_run': it is simply
the list of all files under 'src', with the names changed to be(more...)

        def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
              preserve_symlinks=0, update=0, verbose=1, dry_run=0):
    """Copy an entire directory tree 'src' to a new location 'dst'.

    Both 'src' and 'dst' must be directory names.  If 'src' is not a
    directory, raise DistutilsFileError.  If 'dst' does not exist, it is
    created with 'mkpath()'.  The end result of the copy is that every
    file in 'src' is copied to 'dst', and directories under 'src' are
    recursively copied to 'dst'.  Return the list of files that were
    copied or might have been copied, using their output name.  The
    return value is unaffected by 'update' or 'dry_run': it is simply
    the list of all files under 'src', with the names changed to be
    under 'dst'.

    'preserve_mode' and 'preserve_times' are the same as for
    'copy_file'; note that they only apply to regular files, not to
    directories.  If 'preserve_symlinks' is true, symlinks will be
    copied as symlinks (on platforms that support them!); otherwise
    (the default), the destination of the symlink will be copied.
    'update' and 'verbose' are the same as for 'copy_file'.
    """
    from distutils.file_util import copy_file

    if not dry_run and not os.path.isdir(src):
        raise DistutilsFileError, \
              "cannot copy tree '%s': not a directory" % src
    try:
        names = os.listdir(src)
    except os.error, (errno, errstr):
        if dry_run:
            names = []
        else:
            raise DistutilsFileError, \
                  "error listing files in '%s': %s" % (src, errstr)

    if not dry_run:
        mkpath(dst, verbose=verbose)

    outputs = []

    for n in names:
        src_name = os.path.join(src, n)
        dst_name = os.path.join(dst, n)

        if n.startswith('.nfs'):
            # skip NFS rename files
            continue

        if preserve_symlinks and os.path.islink(src_name):
            link_dest = os.readlink(src_name)
            if verbose >= 1:
                log.info("linking %s -> %s", dst_name, link_dest)
            if not dry_run:
                os.symlink(link_dest, dst_name)
            outputs.append(dst_name)

        elif os.path.isdir(src_name):
            outputs.extend(
                copy_tree(src_name, dst_name, preserve_mode,
                          preserve_times, preserve_symlinks, update,
                          verbose=verbose, dry_run=dry_run))
        else:
            copy_file(src_name, dst_name, preserve_mode,
                      preserve_times, update, verbose=verbose,
                      dry_run=dry_run)
            outputs.append(dst_name)

    return outputs
        


src/p/s/PsiTurk-2.0.0/psiturk/setup_example.py   PsiTurk(Download)
		os.mkdir(example_target)
		print "Copying", example_dir, "to", example_target
		dir_util.copy_tree(example_dir, example_target)
		# change to target director
		print "Creating default configuration file (config.txt)"

src/p/s/psiTurk-HEAD/psiturk/setup_example.py   psiTurk(Download)
		os.mkdir(example_target)
		print "Copying", example_dir, "to", example_target
		dir_util.copy_tree(example_dir, example_target)
		# change to target director
		print "Creating default configuration file (config.txt)"

src/d/j/django-chuck-0.2.3/setup.py   Django-Chuck(Download)
import os
import sys
from distutils.command.build_py import build_py as _build_py
from distutils.core import setup
from distutils.dir_util import copy_tree, remove_tree
        remove_tree(module_dest_dir)
 
    copy_tree("modules", module_dest_dir, verbose=1, preserve_symlinks=1)
 

src/l/d/ldaptor-HEAD/setup.py   ldaptor(Download)
from distutils.command.install import install as _install
from distutils.util import change_root
from distutils.dir_util import remove_tree, copy_tree, mkpath
 
# quick hack to support generating locale files
    def run(self):
        if not self.skip_build:
            self.run_command('build_locale')
        copy_tree(src=self.build_dir,
                  dst=self.install_dir,

src/d/j/django-chuck-HEAD/setup.py   django-chuck(Download)
import os
import sys
from distutils.command.build_py import build_py as _build_py
from distutils.core import setup
from distutils.dir_util import copy_tree, remove_tree
        remove_tree(module_dest_dir)
 
    copy_tree("modules", module_dest_dir, verbose=1, preserve_symlinks=1)
 

src/r/e/release-HEAD/pyutils/utils.py   release(Download)
 
		os.chdir(tempdir)
		distutils.dir_util.copy_tree(".", final_dest_dir, preserve_symlinks=preserve_symlinks)
 
                os.chdir(final_dest_dir)
				print "truncate_path does not exist: %s (note: defaults to usr if nothing specified)" % truncate_path	
				sys.exit(1)
			distutils.dir_util.copy_tree(".", current + "/..", preserve_symlinks=preserve_symlinks)
			os.chdir(current)
		else:
			distutils.dir_util.copy_tree(".", "..", preserve_symlinks=preserve_symlinks)
				pass
 
		distutils.dir_util.copy_tree(".", final_dest_dir, preserve_symlinks=preserve_symlinks)
 
                os.chdir(final_dest_dir)

src/c/o/conche-HEAD/file_system.py   conche(Download)
        source.walk(_DirCreator)         
 
        dir_util.copy_tree(str(source),
                        self.child(source.name),
                        preserve_symlinks=True,

src/d/j/djangobp-1.0.4/djangobp/management/commands/scaffoldapp.py   djangobp(Download)
from django.core.management.base import BaseCommand
import importlib
import os
import djangobp
from distutils.dir_util import copy_tree
        path = os.path.dirname(module.__file__) + os.sep
 
        copy_tree(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/app/controllers', path + 'controllers', update=True)
        copy_tree(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/app/templates', path + '/templates', update=True)
        copy_tree(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/app/static', path + '/static', update=True)

src/a/n/antisocial-HEAD/ve/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_profile.py   antisocial(Download)
            shutil.copy(xpifile, addon_path + '.xpi')
        else:
            dir_util.copy_tree(addon, addon_path, preserve_symlinks=1)
 
        # remove the temporary directory, if any

src/b/d/bdist-venv2-0.1.3/bdist_venv2.py   bdist-venv2(Download)
from distutils import log
from distutils.core import Command
from distutils.dir_util import copy_tree, remove_tree, ensure_relative
from distutils.sysconfig import get_python_version
from distutils.util import get_platform
        else:
            # as directory
            copy_tree(self.bdist_dir, dist_root, preserve_symlinks=1)
            self.distribution.dist_files.append(
                ('bdist_venv', get_python_version(), dist_root)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next