]> granicus.if.org Git - python/commitdiff
Use nturl2path to generate a file: URL to source files in Windows.
authorKa-Ping Yee <ping@zesty.ca>
Fri, 13 Apr 2001 15:00:27 +0000 (15:00 +0000)
committerKa-Ping Yee <ping@zesty.ca>
Fri, 13 Apr 2001 15:00:27 +0000 (15:00 +0000)
Lib/pydoc.py

index ee9177d7e1511f03d76d15b4dfcb242c28d46d03..eac1767a6dc4ad8c55433ca7fadd0eba6297a077 100755 (executable)
@@ -484,7 +484,11 @@ TT { font-family: lucida typewriter, lucida console, courier }
         head = '<big><big><strong>%s</strong></big></big>' % linkedname
         try:
             path = inspect.getabsfile(object)
-            filelink = '<a href="file:%s">%s</a>' % (path, path)
+            url = path
+            if sys.platform == 'win32':
+                import nturl2path
+                url = nturl2path.pathname2url(path)
+            filelink = '<a href="file:%s">%s</a>' % (url, path)
         except TypeError:
             filelink = '(built-in)'
         info = []
@@ -1473,9 +1477,9 @@ class ModuleScanner(Scanner):
         return children
 
     def isnewpackage(self, (dir, package)):
-        inode = os.stat(dir)[1] # detect circular symbolic links
+        inode = os.path.exists(dir) and os.stat(dir)[1]
         if not (os.path.islink(dir) and inode in self.inodes):
-            self.inodes.append(inode)
+            self.inodes.append(inode) # detect circular symbolic links
             return ispackage(dir)
 
     def run(self, callback, key=None, completer=None):