summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/nturl2pa.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-11-13 17:11:45 (GMT)
committerGuido van Rossum <guido@python.org>2000-11-13 17:11:45 (GMT)
commit56baca328f7c018c4ae776dd87f44a145f502773 (patch)
treeaa5418fee3c046353db47491d1746a523402fa2e /Lib/dos-8x3/nturl2pa.py
parentf6fc875831d0cfbf4077b4d2e1800365a78f7c2e (diff)
downloadcpython-56baca328f7c018c4ae776dd87f44a145f502773.zip
cpython-56baca328f7c018c4ae776dd87f44a145f502773.tar.gz
cpython-56baca328f7c018c4ae776dd87f44a145f502773.tar.bz2
Removing DOS 8x3 support
Diffstat (limited to 'Lib/dos-8x3/nturl2pa.py')
-rwxr-xr-xLib/dos-8x3/nturl2pa.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/Lib/dos-8x3/nturl2pa.py b/Lib/dos-8x3/nturl2pa.py
deleted file mode 100755
index 0445b8a..0000000
--- a/Lib/dos-8x3/nturl2pa.py
+++ /dev/null
@@ -1,66 +0,0 @@
-"""Convert a NT pathname to a file URL and vice versa."""
-
-def url2pathname(url):
- r"""Convert a URL to a DOS path.
-
- ///C|/foo/bar/spam.foo
-
- becomes
-
- C:\foo\bar\spam.foo
- """
- import string, urllib
- if not '|' in url:
- # No drive specifier, just convert slashes
- if url[:4] == '////':
- # path is something like ////host/path/on/remote/host
- # convert this to \\host\path\on\remote\host
- # (notice halving of slashes at the start of the path)
- url = url[2:]
- components = string.split(url, '/')
- # make sure not to convert quoted slashes :-)
- return urllib.unquote(string.join(components, '\\'))
- comp = string.split(url, '|')
- if len(comp) != 2 or comp[0][-1] not in string.letters:
- error = 'Bad URL: ' + url
- raise IOError, error
- drive = string.upper(comp[0][-1])
- components = string.split(comp[1], '/')
- path = drive + ':'
- for comp in components:
- if comp:
- path = path + '\\' + urllib.unquote(comp)
- return path
-
-def pathname2url(p):
- r"""Convert a DOS path name to a file url.
-
- C:\foo\bar\spam.foo
-
- becomes
-
- ///C|/foo/bar/spam.foo
- """
-
- import string, urllib
- if not ':' in p:
- # No drive specifier, just convert slashes and quote the name
- if p[:2] == '\\\\':
- # path is something like \\host\path\on\remote\host
- # convert this to ////host/path/on/remote/host
- # (notice doubling of slashes at the start of the path)
- p = '\\\\' + p
- components = string.split(p, '\\')
- return urllib.quote(string.join(components, '/'))
- comp = string.split(p, ':')
- if len(comp) != 2 or len(comp[0]) > 1:
- error = 'Bad path: ' + p
- raise IOError, error
-
- drive = urllib.quote(string.upper(comp[0]))
- components = string.split(comp[1], '\\')
- path = '///' + drive + '|'
- for comp in components:
- if comp:
- path = path + '/' + urllib.quote(comp)
- return path