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

All Samples(48)  |  Call(42)  |  Derive(0)  |  Import(6)
Function that can be used as copytree() ignore parameter.

Patterns is a sequence of glob-style patterns
that are used to exclude files

        def ignore_patterns(*patterns):
    """Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude files"""
    def _ignore_patterns(path, names):
        ignored_names = []
        for pattern in patterns:
            ignored_names.extend(fnmatch.filter(names, pattern))
        return set(ignored_names)
    return _ignore_patterns
        


src/c/y/cynote-HEAD/cynote/make_release.py   cynote(Download)
# Script to make a copy of CyNote for zipping and release
 
import os
import sys
from shutil import rmtree, copytree, copy2, ignore_patterns
 
def cleanup_cynote(new_cynote):
def copy_cynote(release, new_cynote):
    # Step 2: Copy CyNote to release directory
    print "Step 2: Copy %s to release directory: %s" % (new_cynote, release)
    copytree(new_cynote, release,
             ignore = ignore_patterns('.svn', '.hg', '*.pyc'))
    print "Step 2 completed"
    print

src/p/y/pygccxml-HEAD/sphinx/conf.py   pygccxml(Download)
    if has_true_links:
        os.symlink( source, target )
    else:
        shutil.copytree( source, target, ignore=shutil.ignore_patterns( r'.svn', '*.pyc', 'osdc2006' ) )
if has_true_links:
    if os.path.exists(os.path.join( doc_project_root, 'index.rest' )):
        os.unlink( os.path.join( doc_project_root, 'index.rest' ) )
    target_dir = os.path.join( doc_project_root, outdir, 'pyplusplus', 'documentation', 'indexing_suite_v2_files' )
    if os.path.exists(target_dir):
        shutil.rmtree(target_dir)
    shutil.copytree( source_dir, target_dir, ignore=shutil.ignore_patterns( r'.svn' ) )
 
def generate_sitemap(app, exception):
    if 'www' not in outdir:

src/c/y/cynote-HEAD/cynote/update_cynote.py   cynote(Download)
import os
import zipfile
import time
from shutil import rmtree, copytree, copy2, ignore_patterns
 
def cleanup_new_cynote(new_cynote):
    # Step 1.1: remove contents of new_cynote's database directory
def replace_cynote(old_cynote, new_cynote):
    # Step 6: Copy new cynote to replace deleted old cynote
    print "Step 6: Copy %s to replace deleted %s" % (new_cynote, old_cynote)
    copytree(new_cynote, old_cynote,
             ignore = ignore_patterns('.svn', '.hg', '*.pyc'))
    print "Step 6 completed"
    print

src/p/y/python-jake-HEAD/build.py   python-jake(Download)
freezer = cx_Freeze.Freezer(executables, includes = ['sgmllib', 'json', 'htmlentitydefs'], excludes = [], replacePaths = [], compress = True, optimizeFlag = 2, copyDependentFiles = True, initScript = None, base = None, path = None, createLibraryZip = False, appendScriptToExe = True, targetDir = 'dist', zipIncludes = [], icon = None, silent = None) #last one -1 is icon
freezer.Freeze()
#Copy all folders to dist
shutil.copytree("libs", "dist" + os.sep + "libs", ignore=shutil.ignore_patterns('.svn', '*.pyc'))
shutil.copytree("locale", "dist" + os.sep + "locale", ignore=shutil.ignore_patterns('.svn', '*.pyc'))
shutil.copytree("plugins", "dist" + os.sep + "plugins", ignore=shutil.ignore_patterns('.svn', '*.pyc'))
shutil.copytree("skins", "dist" + os.sep + "skins", ignore=shutil.ignore_patterns('.svn', '*.pyc'))

src/n/e/NeuBot-HEAD/controllers/plugincontroller.py   NeuBot(Download)
	def find_plugin(self, name, search_dir):
		if search_dir:
			search_dirs = [search_dir]
		else:
			search_dirs = self.config.get('plugin_paths')
 
		ignore = shutil.ignore_patterns("*.pyc", "__init__.py")

src/r/a/rapidsms-core-dev-HEAD/lib/rapidsms/management/commands/startproject.py   rapidsms-core-dev(Download)
                project_name)
 
        src_dir = os.path.join(rapidsms.__path__[0], "skeleton", "project")
        shutil.copytree(src_dir, project_name, ignore=shutil.ignore_patterns('*.pyc'))
 

src/r/a/rapidsms-HEAD/lib/rapidsms/management/commands/startproject.py   rapidsms(Download)
                project_name)
 
        src_dir = os.path.join(rapidsms.__path__[0], "skeleton", "project")
        shutil.copytree(src_dir, project_name, ignore=shutil.ignore_patterns('*.pyc'))
 

src/r/a/RapidSMS-0.9.5a/lib/rapidsms/management/commands/startproject.py   RapidSMS(Download)
                project_name)
 
        src_dir = os.path.join(rapidsms.__path__[0], "skeleton", "project")
        shutil.copytree(src_dir, project_name, ignore=shutil.ignore_patterns('*.pyc'))
 

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/test/test_shutil.py   ironruby(Download)
 
            # testing glob-like patterns
            try:
                patterns = shutil.ignore_patterns('*.tmp', 'test_dir2')
                shutil.copytree(src_dir, dst_dir, ignore=patterns)
                # checking the result: some elements should not be copied
                self.assertTrue(exists(join(dst_dir, 'test.txt')))
                self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
                self.assertTrue(not exists(join(dst_dir, 'test_dir2')))
            finally:
                if os.path.exists(dst_dir):
                    shutil.rmtree(dst_dir)
            try:
                patterns = shutil.ignore_patterns('*.tmp', 'subdir*')

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/test/test_shutil.py   ironruby(Download)
 
            # testing glob-like patterns
            try:
                patterns = shutil.ignore_patterns('*.tmp', 'test_dir2')
                shutil.copytree(src_dir, dst_dir, ignore=patterns)
                # checking the result: some elements should not be copied
                self.assertTrue(exists(join(dst_dir, 'test.txt')))
                self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
                self.assertTrue(not exists(join(dst_dir, 'test_dir2')))
            finally:
                if os.path.exists(dst_dir):
                    shutil.rmtree(dst_dir)
            try:
                patterns = shutil.ignore_patterns('*.tmp', 'subdir*')

  1 | 2 | 3  Next