File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,13 +249,31 @@ def all():
249249 ('mpl_toolkits/axes_grid/examples' , '../../../examples/axes_grid/' )
250250 ]
251251
252+ symlink_warnings = []
252253for 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+
259277if len (sys .argv )> 1 :
260278 if '--small' in sys .argv [1 :]:
261279 small_docs = True
You can’t perform that action at this time.
0 commit comments