Skip to content

Commit

Permalink
Add spellcheck.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip committed Nov 6, 2022
1 parent 1f04904 commit ad8f55e
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 16 deletions.
12 changes: 11 additions & 1 deletion docs/Makefile
Expand Up @@ -12,7 +12,7 @@ PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest remote

help:
@echo "Please use \`make <target>' where <target> is one of"
Expand Down Expand Up @@ -41,6 +41,16 @@ html:
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

apidocs: html
mkdir -p $(BUILDDIR)/html/apidocs
pdoc -o $(BUILDDIR)/html/apidocs --no-show-source --logo https://www.red-dove.com/assets/img/rdclogo.gif ../sarge

remote:
rsync -avz $(BUILDDIR)/html/* vopal:~/apps/rdc_docs/sarge

spelling:
$(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Expand Up @@ -25,7 +25,8 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.imgmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.imgmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinxcontrib.spelling'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -91,6 +92,8 @@
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

spelling_lang='en_GB'
spelling_word_list_filename='spelling_wordlist.txt'

# -- Options for HTML output ---------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/overview.rst
Expand Up @@ -63,7 +63,7 @@ function, :func:`run`. You can also use conditionals::

The conditional logic is being done by sarge and not the shell -- which means
you can use the identical code on Windows. Here's an example of some more
involved use of pipes, which also works identically on Posix and Windows::
involved use of pipes, which also works identically on POSIX and Windows::

>>> cmd = 'echo foo | tee stdout.log 3>&1 1>&2 2>&3 | tee stderr.log > %s' % os.devnull
>>> p = run(cmd)
Expand All @@ -86,7 +86,7 @@ Why not just use ``subprocess``?

The :mod:`subprocess` module in the standard library contains some very
powerful functionality. It encapsulates the nitty-gritty details of subprocess
creation and communication on Posix and Windows platforms, and presents the
creation and communication on POSIX and Windows platforms, and presents the
application programmer with a uniform interface to the OS-level facilities.
However, :mod:`subprocess` does not do much more than this,
and is difficult to use in some scenarios. For example:
Expand Down
6 changes: 3 additions & 3 deletions docs/reference.rst
Expand Up @@ -165,14 +165,14 @@ Functions

.. function:: shell_quote(s)

Quote text so that it is safe for Posix command shells.
Quote text so that it is safe for POSIX command shells.

For example, "*.py" would be converted to "'*.py'". If the text is
considered safe it is returned unquoted.

:param s: The value to quote
:type s: str, or unicode on 2.x
:return: A safe version of the input, from the point of view of Posix
:return: A safe version of the input, from the point of view of POSIX
command shells
:rtype: The passed-in type

Expand Down Expand Up @@ -295,7 +295,7 @@ Classes

:param source: The source text with the command(s) to run.
:type source: str
:param posix: Whether the source will be parsed using Posix conventions.
:param posix: Whether the source will be parsed using POSIX conventions.
:type posix: bool
:param kwargs: Any keyword parameters you would pass to
:class:`subprocess.Popen`, other than ``stdin`` (for which,
Expand Down
17 changes: 17 additions & 0 deletions docs/spelling_wordlist.txt
@@ -0,0 +1,17 @@
Coghlan
Sarge
Reitz
nitty
pypy
macOS
kwarg
es
py
returncode
bytestring
fulfill
virtualenv
ftype
assoc
tty
etc
18 changes: 9 additions & 9 deletions docs/tutorial.rst
Expand Up @@ -13,7 +13,7 @@ sarge is a pure-Python library. You should be able to install it using::
pip install sarge

for installing ``sarge`` into a virtualenv or other directory where you have
write permissions. On Posix platforms, you may need to invoke using ``sudo``
write permissions. On POSIX platforms, you may need to invoke using ``sudo``
if you need to install ``sarge`` in a protected location such as your system
Python's ``site-packages`` directory.

Expand Down Expand Up @@ -363,7 +363,7 @@ You can also use redirection to files as you might expect. For example::
$ cat /tmp/junk
foo

You can use ``>``, ``>>``, ``2>``, ``2>>`` which all work as on Posix systems.
You can use ``>``, ``>>``, ``2>``, ``2>>`` which all work as on POSIX systems.
However, you can't use ``<`` or ``<<``.

To send things to the bit-bucket in a cross-platform way,
Expand Down Expand Up @@ -548,7 +548,7 @@ the above example to work:
which would depend on how many bytes the Capture reads at a time. You can
also pass a ``buffer_size=-1`` to indicate that you want to use line-
buffering, i.e. read a line at a time from the child process. (This may only
work as expected if the child process flushes its outbut buffers after every
work as expected if the child process flushes its output buffers after every
line.)
* We make a ``flush`` call in the ``receiver`` script, to ensure that the pipe
is flushed to the capture queue. You could avoid the ``flush`` call in the
Expand All @@ -561,7 +561,7 @@ output buffers and doesn't flush them, you could be kept waiting for input
until the buffers fill up or a flush occurs.

If a third party package you're trying to interact with gives you buffering
problems, you may or may not have luck (on Posix, at least) using the
problems, you may or may not have luck (on POSIX, at least) using the
``unbuffer`` utility from the ``expect-dev`` package (do a Web search to find
it). This invokes a program directing its output to a pseudo-tty device which
gives line buffering behaviour. This doesn't always work, though :-(
Expand Down Expand Up @@ -730,7 +730,7 @@ process. This can lead to problems on Windows, where if you don't pass the
``SYSTEMROOT`` environment variable, things can break. With ``sarge``, it's
assumed by default that anything you pass in ``env`` is *added* to the
contents of ``os.environ``. This is almost always what you want -- after all,
in a Posix shell, the environment is generally inherited with certain
in a POSIX shell, the environment is generally inherited with certain
additions for a specific command invocation. However, if you want to pass a
complete environment rather than an augmented ``os.environ``, you can do this
by passing ``replace_env=True`` in the keyword arguments. In that case, the
Expand Down Expand Up @@ -857,7 +857,7 @@ see if any have occurred.
.. versionadded:: 0.18
The `exception` attribute was added to :class:`Command`.

About threading and forking on Posix
About threading and forking on POSIX
------------------------------------

If you run commands asynchronously by using ``&`` in a command pipeline, then a
Expand All @@ -873,18 +873,18 @@ it may vary from machine to machine and even from one run to the next. This has
nothing to do with ``sarge`` -- there are no guarantees with just plain Bash,
either.

On Posix, :mod:`subprocess` uses :func:`os.fork` to create the child process,
On POSIX, :mod:`subprocess` uses :func:`os.fork` to create the child process,
and you may see dire warnings on the Internet about mixing threads, processes
and ``fork()``. It *is* a heady mix, to be sure: you need to understand what's
going on in order to avoid nasty surprises. If you run into any such, it may be
hard to get help because others can't reproduce the problems. However, that's
no reason to shy away from providing the functionality altogether. Such issues
do not occur on Windows, for example: because Windows doesn't have a
``fork()`` system call, child processes are created in a different way which
doesn't give rise to the issues which sometimes crop up in a Posix environment.
doesn't give rise to the issues which sometimes crop up in a POSIX environment.

For an exposition of the sort of things which might bite you if you are using locks,
threading and ``fork()`` on Posix, see `this post
threading and ``fork()`` on POSIX, see `this post
<https://web.archive.org/web/20211015140727/http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them>`_.

Other resources on this topic:
Expand Down

0 comments on commit ad8f55e

Please sign in to comment.