Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9eb4df

Browse files
committed
Merge pull request matplotlib#3438 from jenshnielsen/make_remove
Get rid of unused pre python 2.6 code in doc make.py
2 parents 43150ef + bd093a8 commit c9eb4df

File tree

1 file changed

+1
-101
lines changed

1 file changed

+1
-101
lines changed

doc/make.py

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,12 @@
11
#!/usr/bin/env python
22

33
from __future__ import print_function
4-
import fileinput
54
import glob
65
import os
76
import shutil
87
import sys
98
import re
109

11-
### Begin compatibility block for pre-v2.6: ###
12-
#
13-
# ignore_patterns and copytree funtions are copies of what is included
14-
# in shutil.copytree of python v2.6 and later.
15-
#
16-
### When compatibility is no-longer needed, this block
17-
### can be replaced with:
18-
###
19-
### from shutil import ignore_patterns, copytree
20-
###
21-
### or the "shutil." qualifier can be prepended to the function
22-
### names where they are used.
23-
24-
try:
25-
WindowsError
26-
except NameError:
27-
WindowsError = None
28-
29-
def ignore_patterns(*patterns):
30-
"""Function that can be used as copytree() ignore parameter.
31-
32-
Patterns is a sequence of glob-style patterns
33-
that are used to exclude files"""
34-
import fnmatch
35-
def _ignore_patterns(path, names):
36-
ignored_names = []
37-
for pattern in patterns:
38-
ignored_names.extend(fnmatch.filter(names, pattern))
39-
return set(ignored_names)
40-
return _ignore_patterns
41-
42-
def copytree(src, dst, symlinks=False, ignore=None):
43-
"""Recursively copy a directory tree using copy2().
44-
45-
The destination directory must not already exist.
46-
If exception(s) occur, an Error is raised with a list of reasons.
47-
48-
If the optional symlinks flag is true, symbolic links in the
49-
source tree result in symbolic links in the destination tree; if
50-
it is false, the contents of the files pointed to by symbolic
51-
links are copied.
52-
53-
The optional ignore argument is a callable. If given, it
54-
is called with the `src` parameter, which is the directory
55-
being visited by copytree(), and `names` which is the list of
56-
`src` contents, as returned by os.listdir():
57-
58-
callable(src, names) -> ignored_names
59-
60-
Since copytree() is called recursively, the callable will be
61-
called once for each directory that is copied. It returns a
62-
list of names relative to the `src` directory that should
63-
not be copied.
64-
65-
XXX Consider this example code rather than the ultimate tool.
66-
67-
"""
68-
from shutil import copy2, Error, copystat
69-
names = os.listdir(src)
70-
if ignore is not None:
71-
ignored_names = ignore(src, names)
72-
else:
73-
ignored_names = set()
74-
75-
os.makedirs(dst)
76-
errors = []
77-
for name in names:
78-
if name in ignored_names:
79-
continue
80-
srcname = os.path.join(src, name)
81-
dstname = os.path.join(dst, name)
82-
try:
83-
if symlinks and os.path.islink(srcname):
84-
linkto = os.readlink(srcname)
85-
os.symlink(linkto, dstname)
86-
elif os.path.isdir(srcname):
87-
copytree(srcname, dstname, symlinks, ignore)
88-
else:
89-
# Will raise a SpecialFileError for unsupported file types
90-
copy2(srcname, dstname)
91-
# catch the Error from the recursive copytree so that we can
92-
# continue with other files
93-
except Error as err:
94-
errors.extend(err.args[0])
95-
except EnvironmentError as why:
96-
errors.append((srcname, dstname, str(why)))
97-
try:
98-
copystat(src, dst)
99-
except OSError as why:
100-
if WindowsError is not None and isinstance(why, WindowsError):
101-
# Copying file access times may fail on Windows
102-
pass
103-
else:
104-
errors.extend((src, dst, str(why)))
105-
if errors:
106-
raise Error(errors)
107-
108-
### End compatibility block for pre-v2.6 ###
109-
11010

11111
def copy_if_out_of_date(original, derived):
11212
if (not os.path.exists(derived) or
@@ -151,7 +51,7 @@ def html(buildername='html'):
15151
os.remove(filename)
15252

15353
shutil.copy('../CHANGELOG', 'build/%s/_static/CHANGELOG' % buildername)
154-
54+
15555
def htmlhelp():
15656
html(buildername='htmlhelp')
15757
# remove scripts from index.html

0 commit comments

Comments
 (0)