sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
527 stars 77 forks source link

Fix to run on Windows platform. #11

Closed mikanbako closed 9 years ago

mikanbako commented 9 years ago

Removes pty module dependency. Because pty module is unavailable on Windows platform.

When pty module is used on Windows platform, ImportError occurs below.

Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\sphinx-autobuild.exe\__main__.py", line 5, in <modul
e>
  File "C:\Python27\lib\site-packages\sphinx_autobuild\__init__.py", line 13, in
 <module>
    import pty
  File "C:\Python27\lib\pty.py", line 11, in <module>
    import tty
  File "C:\Python27\lib\tty.py", line 5, in <module>
    from termios import *
ImportError: No module named termios 
GaretJax commented 9 years ago

Thanks for the contribution!

There was probably a good reason to use pty when I first wrote the code. I think it has something to do either with signals propagation or with the output formatting. I can't remember right now, but I will have to take a closer look before merging.

mikanbako commented 9 years ago

Thank you for reply.

I thought that pty module dependency could be removed because pty seemed to use to transfer standard output from sphinx process to sphinx-autobuild process.

Can I be of any help?

mikanbako commented 9 years ago

I realized a problem of this contribution. Color of output from Sphinx cannot be captured.

I will fix this contribution the below.

  1. Captures standard output of Sphinx by pty module.
  2. If pty module is not available, captures standard output of Sphinx by subprocess.PIPE.
mikanbako commented 9 years ago

I fixed this contribution. If pty module is available, uses it to capture colored text.

Please confirm.

GaretJax commented 9 years ago

Thanks for the research and the solution... merged!