File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -249,13 +249,31 @@ def all():
249
249
('mpl_toolkits/axes_grid/examples' , '../../../examples/axes_grid/' )
250
250
]
251
251
252
+ symlink_warnings = []
252
253
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" )
253
265
if not os .path .exists (link ):
254
266
if hasattr (os , 'symlink' ):
255
267
os .symlink (target , link )
256
268
else :
269
+ symlink_warnings .append ('files copied to {}' .format (link ))
257
270
shutil .copytree (os .path .join (link , '..' , target ), link )
258
271
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
+
259
277
if len (sys .argv )> 1 :
260
278
if '--small' in sys .argv [1 :]:
261
279
small_docs = True
You can’t perform that action at this time.
0 commit comments