@@ -1809,83 +1809,9 @@ def cleanup(logfile, tempdir, testing, silent=False):
18091809
18101810
18111811def copytree (src , dst , symlinks = False , ignore = None ):
1812- """
1813- Copied from Lib/shutil.py in python 2.7, since we need this to work for python2.4 aswell
1814- and this code can be improved...
1815-
1816- Recursively copy a directory tree using copy2().
1817-
1818- The destination directory must not already exist.
1819- If exception(s) occur, an Error is raised with a list of reasons.
1820-
1821- If the optional symlinks flag is true, symbolic links in the
1822- source tree result in symbolic links in the destination tree; if
1823- it is false, the contents of the files pointed to by symbolic
1824- links are copied.
1825-
1826- The optional ignore argument is a callable. If given, it
1827- is called with the `src` parameter, which is the directory
1828- being visited by copytree(), and `names` which is the list of
1829- `src` contents, as returned by os.listdir():
1830-
1831- callable(src, names) -> ignored_names
1832-
1833- Since copytree() is called recursively, the callable will be
1834- called once for each directory that is copied. It returns a
1835- list of names relative to the `src` directory that should
1836- not be copied.
1837-
1838- XXX Consider this example code rather than the ultimate tool.
1839-
1840- """
1812+ """DEPRECATED and removed. Use copy_dir"""
18411813 _log .deprecated ("Use 'copy_dir' rather than 'copytree'" , '4.0' )
18421814
1843- class Error (EnvironmentError ):
1844- pass
1845- try :
1846- WindowsError = WindowsError # noqa
1847- except NameError :
1848- WindowsError = None
1849-
1850- names = os .listdir (src )
1851- if ignore is not None :
1852- ignored_names = ignore (src , names )
1853- else :
1854- ignored_names = set ()
1855- _log .debug ("copytree: skipping copy of %s" % ignored_names )
1856- os .makedirs (dst )
1857- errors = []
1858- for name in names :
1859- if name in ignored_names :
1860- continue
1861- srcname = os .path .join (src , name )
1862- dstname = os .path .join (dst , name )
1863- try :
1864- if symlinks and os .path .islink (srcname ):
1865- linkto = os .readlink (srcname )
1866- os .symlink (linkto , dstname )
1867- elif os .path .isdir (srcname ):
1868- copytree (srcname , dstname , symlinks , ignore )
1869- else :
1870- # Will raise a SpecialFileError for unsupported file types
1871- shutil .copy2 (srcname , dstname )
1872- # catch the Error from the recursive copytree so that we can
1873- # continue with other files
1874- except Error as err :
1875- errors .extend (err .args [0 ])
1876- except EnvironmentError as why :
1877- errors .append ((srcname , dstname , str (why )))
1878- try :
1879- shutil .copystat (src , dst )
1880- except OSError as why :
1881- if WindowsError is not None and isinstance (why , WindowsError ):
1882- # Copying file access times may fail on Windows
1883- pass
1884- else :
1885- errors .extend ((src , dst , str (why )))
1886- if errors :
1887- raise Error (errors )
1888-
18891815
18901816def encode_string (name ):
18911817 """
0 commit comments