Commits

Georg Brandl  committed 8478b81 Merge

merge with stable

  • Participants
  • Parent commits 80ebfd9, 857e686

Comments (0)

Files changed (4)

 
 * #831: Provide ``--project`` flag in setup_command as advertised.
 
+* #875: Fix reading config files under Python 3.
+
+* #876: Fix quickstart test under Python 3.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

File sphinx/config.py

                 # we promise to have the config dir as current dir while the
                 # config file is executed
                 os.chdir(dirname)
-                # get config source
-                f = open(config_file, 'rU')
+                # get config source -- 'b' is a no-op under 2.x, while 'U' is
+                # ignored under 3.x (but 3.x compile() accepts \r\n newlines)
+                f = open(config_file, 'rbU')
                 try:
                     source = f.read()
                 finally:

File tests/run.py

     copydir_run_2to3(testroot, newroot)
     # switch to the converted dir so nose tests the right tests
     chdir(newroot)
-
-# always test the sphinx package from this directory
-sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))
+    # always test the sphinx package from build/lib/
+    sys.path.insert(0, path.pardir)
+else:
+    # always test the sphinx package from this directory
+    sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))
 
 try:
     import nose

File tests/test_quickstart.py

     conffile = tempdir / 'conf.py'
     assert conffile.isfile()
     ns = {}
-    f = open(conffile, 'U')
+    f = open(conffile, 'rbU')
     try:
         code = compile(f.read(), conffile, 'exec')
     finally:
     conffile = tempdir / 'source' / 'conf.py'
     assert conffile.isfile()
     ns = {}
-    f = open(conffile, 'U')
+    f = open(conffile, 'rbU')
     try:
         code = compile(f.read(), conffile, 'exec')
     finally: