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

Skip to content

Commit 41c9fb7

Browse files
committed
prepare a fresh git checkout for doc build on MS windows
1 parent 71ba349 commit 41c9fb7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/make.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,31 @@ def all():
249249
('mpl_toolkits/axes_grid/examples', '../../../examples/axes_grid/')
250250
]
251251

252+
symlink_warnings = []
252253
for link, target in required_symlinks:
254+
if sys.platform == 'win32' and os.path.isfile(link):
255+
# This is special processing that applies on platforms that don't deal
256+
# with git symlinks -- probably only MS windows.
257+
delete = False
258+
with open(link, 'r') as content:
259+
delete = target == content.read()
260+
if delete:
261+
symlink_warnings.append('deleted: doc/{}'.format(link))
262+
os.unlink(link)
263+
else:
264+
raise RuntimeError("doc/{} should be a directory or symlink -- it isn't")
253265
if not os.path.exists(link):
254266
if hasattr(os, 'symlink'):
255267
os.symlink(target, link)
256268
else:
269+
symlink_warnings.append('files copied to {}'.format(link))
257270
shutil.copytree(os.path.join(link, '..', target), link)
258271

272+
if sys.platform == 'win32' and len(symlink_warnings) > 0:
273+
print('The following items related to symlinks will show up '+
274+
'as spurious changes in your \'git status\':\n\t{}'
275+
.format('\n\t'.join(symlink_warnings)))
276+
259277
if len(sys.argv)>1:
260278
if '--small' in sys.argv[1:]:
261279
small_docs = True

0 commit comments

Comments
 (0)