13
13
from urllib .parse import quote_from_bytes as urlquote_from_bytes
14
14
15
15
16
- supports_symlinks = True
17
16
if os .name == 'nt' :
18
- import nt
19
- if sys .getwindowsversion ()[:2 ] >= (6 , 0 ):
20
- from nt import _getfinalpathname
21
- else :
22
- supports_symlinks = False
23
- _getfinalpathname = None
17
+ from nt import _getfinalpathname
24
18
else :
25
- nt = None
19
+ _getfinalpathname = None
26
20
27
21
28
22
__all__ = [
@@ -412,18 +406,17 @@ class _NormalAccessor(_Accessor):
412
406
if hasattr (os , "lchmod" ):
413
407
lchmod = os .lchmod
414
408
else :
415
- def lchmod (self , pathobj , mode ):
416
- raise NotImplementedError ("lchmod() not available on this system" )
409
+ def lchmod (self , path , mode ):
410
+ raise NotImplementedError ("os. lchmod() not available on this system" )
417
411
418
412
mkdir = os .mkdir
419
413
420
414
unlink = os .unlink
421
415
422
416
if hasattr (os , "link" ):
423
- link_to = os .link
417
+ link = os .link
424
418
else :
425
- @staticmethod
426
- def link_to (self , target ):
419
+ def link (self , src , dst ):
427
420
raise NotImplementedError ("os.link() not available on this system" )
428
421
429
422
rmdir = os .rmdir
@@ -432,23 +425,19 @@ def link_to(self, target):
432
425
433
426
replace = os .replace
434
427
435
- if nt :
436
- if supports_symlinks :
437
- symlink = os .symlink
438
- else :
439
- def symlink (a , b , target_is_directory ):
440
- raise NotImplementedError ("symlink() not available on this system" )
428
+ if hasattr (os , "symlink" ):
429
+ symlink = os .symlink
441
430
else :
442
- # Under POSIX, os.symlink() takes two args
443
- @staticmethod
444
- def symlink (a , b , target_is_directory ):
445
- return os .symlink (a , b )
431
+ def symlink (self , src , dst , target_is_directory = False ):
432
+ raise NotImplementedError ("os.symlink() not available on this system" )
446
433
447
434
utime = os .utime
448
435
449
- # Helper for resolve()
450
- def readlink (self , path ):
451
- return os .readlink (path )
436
+ if hasattr (os , "readlink" ):
437
+ readlink = os .readlink
438
+ else :
439
+ def readlink (self , path ):
440
+ raise NotImplementedError ("os.readlink() not available on this system" )
452
441
453
442
def owner (self , path ):
454
443
try :
@@ -1365,7 +1354,7 @@ def link_to(self, target):
1365
1354
"""
1366
1355
Create a hard link pointing to a path named target.
1367
1356
"""
1368
- self ._accessor .link_to (self , target )
1357
+ self ._accessor .link (self , target )
1369
1358
1370
1359
def rename (self , target ):
1371
1360
"""
0 commit comments