[pypy-svn] r10738 - pypy/dist/pypy/documentation

hpk at codespeak.net hpk at codespeak.net
Sat Apr 16 19:15:49 CEST 2005


Author: hpk
Date: Sat Apr 16 19:15:49 2005
New Revision: 10738

Added:
   pypy/dist/pypy/documentation/rest_test.py
      - copied, changed from r10736, py/dist/py/documentation/rest_test.py
Modified:
   pypy/dist/pypy/documentation/howtopypy.txt
Log:
added a documentation check facility, including 
a hack to test local references.  fixed ref errors. 



Modified: pypy/dist/pypy/documentation/howtopypy.txt
==============================================================================
--- pypy/dist/pypy/documentation/howtopypy.txt	(original)
+++ pypy/dist/pypy/documentation/howtopypy.txt	Sat Apr 16 19:15:49 2005
@@ -62,7 +62,7 @@
 
 .. _`documentation start page`: http://codespeak.net/pypy/index.cgi?doc/index.html 
 .. _`coding-style document`: http://codespeak.net/pypy/index.cgi?doc/coding-style.html 
-.. _`py.test`: /py/current/doc/test.html 
+.. _`py.test`: http://codespeak.net/py/current/doc/test.html 
 
 
 PyPy Documentation
@@ -160,8 +160,8 @@
 + ObjectSpaceInterface_
 
 .. _this: http://docutils.sourceforge.net/docs/rst/quickref.html
-.. _ObjectSpace: objspace/objspace.html 
-.. _ObjectSpaceInterface: objspace/objspaceinterface.html
+.. _ObjectSpace: objspace.html 
+.. _ObjectSpaceInterface: objspaceinterface.html
 
 
 .. _`detailed version`: 

Copied: pypy/dist/pypy/documentation/rest_test.py (from r10736, py/dist/py/documentation/rest_test.py)
==============================================================================
--- py/dist/py/documentation/rest_test.py	(original)
+++ pypy/dist/pypy/documentation/rest_test.py	Sat Apr 16 19:15:49 2005
@@ -1,10 +1,12 @@
 from __future__ import generators
 
 import py
+import pypy
 
 pydir = py.magic.autopath(vars(py)).dirpath()
 rest = pydir.join('bin', 'py.rest').getpymodule()
-docdir = py.path.svnwc(pydir.join('documentation'))
+
+docdir = py.path.svnwc(pypy.__file__).dirpath('documentation')
 
 def restcheck(path):
     try:
@@ -12,8 +14,36 @@
     except ImportError:
         py.test.skip("docutils not importable")
     rest.process(path)
+    check_htmllinks(path) 
     #assert not out
 
 def test_rest_files():
     for x in docdir.listdir('*.txt'):
         yield restcheck, x
+
+def check_htmllinks(path): 
+    ddir = docdir.localpath 
+
+    for lineno, line in py.builtin.enumerate(path.readlines()): 
+        line = line.strip()
+        if line.startswith('.. _'): 
+            l = line.split(':', 1)
+            if len(l) != 2: 
+                continue
+            tryfn = l[1].strip() 
+            if tryfn.startswith('http:'): 
+                # XXX try retrieve? 
+                pass 
+            elif tryfn.endswith('.html'): 
+                # assume it should be a file 
+                fn = ddir.join(tryfn) 
+                fn = fn.new(ext='.txt')
+                if not fn.check(file=1): 
+                    py.test.fail("reference error %r in %s:%d" %(
+                                  tryfn, path.basename, lineno+1))
+            else: 
+                # yes, what else? 
+                pass 
+
+            
+



More information about the Pypy-commit mailing list