diff options
author | Nice Zombies <nineteendo19d0@gmail.com> | 2024-03-25 22:55:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 22:55:11 (GMT) |
commit | 0821923aa979a72464c5da8dfa53a719bba5801c (patch) | |
tree | 1486b42a70c2cfbbc230ee56a9812b164754ea66 /Lib/ntpath.py | |
parent | c2276176d543a2fc2d57709c2787f99850fbb073 (diff) | |
download | cpython-0821923aa979a72464c5da8dfa53a719bba5801c.zip cpython-0821923aa979a72464c5da8dfa53a719bba5801c.tar.gz cpython-0821923aa979a72464c5da8dfa53a719bba5801c.tar.bz2 |
gh-117114: Make os.path.isdevdrive available on all platforms (GH-117115)
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r-- | Lib/ntpath.py | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py index e7cbfe1..f1c48ec 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -29,7 +29,8 @@ __all__ = ["normcase","isabs","join","splitdrive","splitroot","split","splitext" "ismount","isreserved","expanduser","expandvars","normpath", "abspath","curdir","pardir","sep","pathsep","defpath","altsep", "extsep","devnull","realpath","supports_unicode_filenames","relpath", - "samefile", "sameopenfile", "samestat", "commonpath", "isjunction"] + "samefile", "sameopenfile", "samestat", "commonpath", "isjunction", + "isdevdrive"] def _get_bothseps(path): if isinstance(path, bytes): @@ -280,21 +281,9 @@ if hasattr(os.stat_result, 'st_reparse_tag'): return False return bool(st.st_reparse_tag == stat.IO_REPARSE_TAG_MOUNT_POINT) else: - def isjunction(path): - """Test whether a path is a junction""" - os.fspath(path) - return False - - -# Being true for dangling symbolic links is also useful. + # Use genericpath.isjunction as imported above + pass -def lexists(path): - """Test whether a path exists. Returns True for broken symbolic links""" - try: - st = os.lstat(path) - except (OSError, ValueError): - return False - return True # Is a path a mount point? # Any drive letter root (eg c:\) @@ -916,15 +905,12 @@ except ImportError: try: from nt import _path_isdevdrive -except ImportError: - def isdevdrive(path): - """Determines whether the specified path is on a Windows Dev Drive.""" - # Never a Dev Drive - return False -else: def isdevdrive(path): """Determines whether the specified path is on a Windows Dev Drive.""" try: return _path_isdevdrive(abspath(path)) except OSError: return False +except ImportError: + # Use genericpath.isdevdrive as imported above + pass |