Compare commits
No commits in common. "bullseye-backport" and "pristine-tar" have entirely different histories.
bullseye-b
...
pristine-t
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -1,11 +0,0 @@
|
|||
.DS_Store
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.egg-ignore
|
||||
*.egg-info
|
||||
dist
|
||||
build/
|
||||
docs/_build
|
||||
click.egg-info
|
||||
.tox
|
||||
.cache
|
11
.travis.yml
11
.travis.yml
|
@ -1,11 +0,0 @@
|
|||
language: python
|
||||
|
||||
python:
|
||||
- 3.6
|
||||
- 3.7
|
||||
- 3.8
|
||||
- 3.9
|
||||
|
||||
install:
|
||||
- pip install -U tox setuptools wheel
|
||||
script: tox
|
19
LICENSE
19
LICENSE
|
@ -1,19 +0,0 @@
|
|||
Copyright (c) 2014-2015 Markus Unterwaditzer & contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,6 +0,0 @@
|
|||
include LICENSE
|
||||
recursive-include docs *
|
||||
recursive-include tests *
|
||||
|
||||
prune docs/_build
|
||||
global-exclude *.py[cdo] __pycache__ *.so *.pyd
|
7
Makefile
7
Makefile
|
@ -1,7 +0,0 @@
|
|||
release:
|
||||
python setup.py sdist bdist_wheel upload
|
||||
|
||||
docs:
|
||||
cd docs && make html
|
||||
|
||||
.PHONY: docs
|
17
README.rst
17
README.rst
|
@ -1,17 +0,0 @@
|
|||
click-threading
|
||||
===============
|
||||
|
||||
.. image:: https://travis-ci.org/click-contrib/click-threading.svg?branch=master
|
||||
:target: https://travis-ci.org/click-contrib/click-threading
|
||||
|
||||
.. image:: https://readthedocs.org/projects/click-threading/badge/?version=latest
|
||||
:target: http://click-threading.readthedocs.io/en/latest/?badge=latest
|
||||
:alt: Documentation Status
|
||||
|
||||
|
||||
Utilities for multithreading in `click <http://click.pocoo.org/>`_.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Licensed under the MIT, see ``LICENSE``.
|
|
@ -1,157 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import threading
|
||||
import functools
|
||||
import contextlib
|
||||
import click
|
||||
|
||||
from ._compat import reraise
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
|
||||
# The docs state that "Future should not be instantiated directly, only by
|
||||
# Executors", but since I'm basically implementing my own executor here, I
|
||||
# think we're fine.
|
||||
try:
|
||||
from concurrent.futures import Future as _Future
|
||||
except ImportError:
|
||||
from futures import Future as _Future
|
||||
|
||||
__version__ = '0.5.0'
|
||||
|
||||
_CTX_WORKER_KEY = __name__ + '.uiworker'
|
||||
|
||||
|
||||
def _is_main_thread(thread=None):
|
||||
thread = thread or threading.current_thread()
|
||||
return type(thread).__name__ == '_MainThread'
|
||||
|
||||
|
||||
class Thread(threading.Thread):
|
||||
'''A thread that automatically pushes the parent thread's context in the
|
||||
new thread.
|
||||
|
||||
Since version 5.0, click maintains global stacks of context objects. The
|
||||
topmost context on that stack can be accessed with
|
||||
:py:func:`get_current_context`.
|
||||
|
||||
There is one stack for each Python thread. That means if you are in the
|
||||
main thread (where you can use :py:func:`get_current_context` just fine)
|
||||
and spawn a :py:class:`threading.Thread`, that thread won't be able to
|
||||
access the same context using :py:func:`get_current_context`.
|
||||
|
||||
:py:class:`Thread` is a subclass of :py:class:`threading.Thread` that
|
||||
preserves the current thread context when spawning a new one, by pushing it
|
||||
on the stack of the new thread as well.
|
||||
'''
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._click_context = click.get_current_context()
|
||||
super(Thread, self).__init__(*args, **kwargs)
|
||||
|
||||
def run(self):
|
||||
with self._click_context:
|
||||
return super(Thread, self).run()
|
||||
|
||||
|
||||
class UiWorker(object):
|
||||
'''
|
||||
A worker-queue system to manage and synchronize output and prompts from
|
||||
other threads.
|
||||
|
||||
>>> import click
|
||||
>>> from click_threading import UiWorker, Thread, get_ui_worker
|
||||
>>> ui = UiWorker() # on main thread
|
||||
>>> def target():
|
||||
... click.echo("Hello world!")
|
||||
... get_ui_worker().shutdown()
|
||||
...
|
||||
>>>
|
||||
>>> @click.command()
|
||||
... def cli():
|
||||
... with ui.patch_click():
|
||||
... t = Thread(target=target)
|
||||
... t.start()
|
||||
... ui.run()
|
||||
>>> runner = click.testing.CliRunner()
|
||||
>>> result = runner.invoke(cli, [])
|
||||
>>> assert result.output.strip() == 'Hello world!'
|
||||
|
||||
Using this class instead of just spawning threads brings a few advantages:
|
||||
|
||||
- If one thread prompts for input, other output from other threads is
|
||||
queued until the :py:func:`click.prompt` call returns.
|
||||
- If you call echo with a multiline-string, it is guaranteed that this
|
||||
string is not interleaved with other output.
|
||||
|
||||
Disadvantages:
|
||||
|
||||
- The main thread is used for the output (using any other thread produces
|
||||
weird behavior with interrupts). ``ui.run()`` in the above example blocks
|
||||
until ``ui.shutdown()`` is called.
|
||||
'''
|
||||
SHUTDOWN = object()
|
||||
|
||||
def __init__(self):
|
||||
if not _is_main_thread():
|
||||
raise RuntimeError('The UiWorker can only run on the main thread.')
|
||||
|
||||
self.tasks = queue.Queue()
|
||||
|
||||
def shutdown(self):
|
||||
self.put(self.SHUTDOWN, wait=False)
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
func, future = self.tasks.get()
|
||||
if func is self.SHUTDOWN:
|
||||
return
|
||||
|
||||
try:
|
||||
result = func()
|
||||
except BaseException as e:
|
||||
future.set_exception(e)
|
||||
else:
|
||||
future.set_result(result)
|
||||
|
||||
def put(self, func, wait=True):
|
||||
if _is_main_thread():
|
||||
return func()
|
||||
|
||||
future = _Future()
|
||||
self.tasks.put((func, future))
|
||||
if not wait:
|
||||
return
|
||||
|
||||
return future.result()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def patch_click(self):
|
||||
from .monkey import patch_ui_functions
|
||||
|
||||
def wrapper(f, info):
|
||||
@functools.wraps(f)
|
||||
def inner(*a, **kw):
|
||||
return get_ui_worker() \
|
||||
.put(lambda: f(*a, **kw), wait=info.interactive)
|
||||
return inner
|
||||
|
||||
ctx = click.get_current_context()
|
||||
with patch_ui_functions(wrapper):
|
||||
ctx.meta[_CTX_WORKER_KEY] = self
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
assert ctx.meta.pop(_CTX_WORKER_KEY) is self
|
||||
|
||||
|
||||
def get_ui_worker():
|
||||
try:
|
||||
ctx = click.get_current_context()
|
||||
return ctx.meta[_CTX_WORKER_KEY]
|
||||
except (RuntimeError, KeyError):
|
||||
raise RuntimeError('UI worker not found.')
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
if PY2:
|
||||
getargspec = inspect.getargspec
|
||||
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb')
|
||||
else:
|
||||
getargspec = inspect.getfullargspec
|
||||
def reraise(tp, value, tb=None):
|
||||
if value.__traceback__ is not tb:
|
||||
raise value.with_traceback(tb)
|
||||
raise value
|
|
@ -1,84 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import types
|
||||
import contextlib
|
||||
import inspect
|
||||
|
||||
from ._compat import PY2, getargspec
|
||||
|
||||
|
||||
class FunctionInfo(object):
|
||||
def __init__(self, interactive):
|
||||
self.interactive = interactive
|
||||
|
||||
|
||||
_ui_functions = {
|
||||
'echo_via_pager': FunctionInfo(interactive=True),
|
||||
'prompt': FunctionInfo(interactive=True),
|
||||
'confirm': FunctionInfo(interactive=True),
|
||||
'clear': FunctionInfo(interactive=False),
|
||||
'echo': FunctionInfo(interactive=False),
|
||||
'edit': FunctionInfo(interactive=True),
|
||||
'launch': FunctionInfo(interactive=True),
|
||||
'getchar': FunctionInfo(interactive=True),
|
||||
'pause': FunctionInfo(interactive=True),
|
||||
}
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def patch_ui_functions(wrapper):
|
||||
'''Wrap all termui functions with a custom decorator.'''
|
||||
NONE = object()
|
||||
import click
|
||||
|
||||
saved = []
|
||||
|
||||
for name, info in sorted(_ui_functions.items()):
|
||||
f = getattr(click, name, NONE)
|
||||
if f is NONE:
|
||||
continue
|
||||
|
||||
new_f = wrapper(_copy_fn(f), info)
|
||||
|
||||
orig_sig_obj = inspect.signature(f)
|
||||
sig_obj = orig_sig_obj.replace(
|
||||
parameters=[
|
||||
p.replace(annotation=inspect.Parameter.empty)
|
||||
for p in orig_sig_obj.parameters.values()
|
||||
],
|
||||
return_annotation=inspect.Signature.empty,
|
||||
)
|
||||
signature = str(sig_obj).lstrip('(').rstrip(')')
|
||||
args = ', '.join(p for p in sig_obj.parameters.keys())
|
||||
|
||||
stub_f = eval('lambda {s}: {n}._real_click_fn({a})'
|
||||
.format(n=f.__name__, s=signature, a=args))
|
||||
|
||||
if PY2:
|
||||
saved.append((f, f.func_code))
|
||||
f.func_code = stub_f.func_code
|
||||
else:
|
||||
saved.append((f, f.__code__))
|
||||
f.__code__ = stub_f.__code__
|
||||
|
||||
f._real_click_fn = new_f
|
||||
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
for f, code in saved:
|
||||
if PY2:
|
||||
f.func_code = code
|
||||
else:
|
||||
f.__code__ = code
|
||||
|
||||
del f._real_click_fn
|
||||
|
||||
|
||||
def _copy_fn(f):
|
||||
if PY2:
|
||||
return types.FunctionType(f.func_code, f.func_globals, f.func_name,
|
||||
f.func_defaults, f.func_closure)
|
||||
else:
|
||||
return types.FunctionType(f.__code__, f.__globals__, f.__name__,
|
||||
f.__defaults__, f.__closure__)
|
7
debian/.gitlab-ci.yml
vendored
7
debian/.gitlab-ci.yml
vendored
|
@ -1,7 +0,0 @@
|
|||
include:
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
|
||||
|
||||
variables:
|
||||
# no compiled code
|
||||
SALSA_CI_DISABLE_BLHC: 'true'
|
79
debian/changelog
vendored
79
debian/changelog
vendored
|
@ -1,79 +0,0 @@
|
|||
python-click-threading (0.5.0-2~bpo11+1~evo) bullseye-backports; urgency=medium
|
||||
|
||||
* Rebuild for bullseye-backports.
|
||||
|
||||
-- David Prévot <taffit@debian.org> Fri, 03 Mar 2023 14:24:40 +0100
|
||||
|
||||
python-click-threading (0.5.0-2) unstable; urgency=medium
|
||||
|
||||
[ Debian Janitor ]
|
||||
* Remove constraints unnecessary since buster:
|
||||
+ Build-Depends: Drop versioned constraint on python3-click.
|
||||
|
||||
-- Jelmer VernooÄł <jelmer@debian.org> Mon, 17 Oct 2022 03:29:37 +0100
|
||||
|
||||
python-click-threading (0.5.0-1) unstable; urgency=medium
|
||||
|
||||
* Team upload.
|
||||
[ Ondřej Nový ]
|
||||
* d/control: Update Maintainer field with new Debian Python Team
|
||||
contact address.
|
||||
* d/control: Update Vcs-* fields with new Debian Python Team Salsa
|
||||
layout.
|
||||
|
||||
[ Debian Janitor ]
|
||||
* Remove constraints unnecessary since stretch:
|
||||
+ Build-Depends: Drop versioned constraint on dh-python.
|
||||
* Bump debhelper from old 9 to 13.
|
||||
* Set upstream metadata fields: Bug-Database, Repository, Repository-
|
||||
Browse, Bug-Submit.
|
||||
|
||||
[ HĂĄvard Flaget Aasen ]
|
||||
* New upstream version 0.5.0.
|
||||
New upstream release is compatible with python3-click version 8.0.
|
||||
Closes: #996337, #997480, #1000732
|
||||
* Drop patch, no longer needed.
|
||||
* d/watch: Update to version 4.
|
||||
* Add upstream testsuite as autopkgtest.
|
||||
* d/copyright: Add upstream-contact.
|
||||
* Add rules-requires-root.
|
||||
* Update Standards-Version to 4.6.0.
|
||||
|
||||
-- HĂĄvard Flaget Aasen <haavard_aasen@yahoo.no> Mon, 29 Nov 2021 08:05:38 +0000
|
||||
|
||||
python-click-threading (0.4.4-2) unstable; urgency=medium
|
||||
|
||||
* Team upload.
|
||||
* d/control: Set Vcs-* to salsa.debian.org
|
||||
* d/copyright: Use https protocol in Format field
|
||||
* Convert git repository from git-dpm to gbp layout
|
||||
* Use debhelper-compat instead of debian/compat.
|
||||
* Drop Python 2 support.
|
||||
|
||||
-- Ondřej Nový <onovy@debian.org> Sat, 27 Jul 2019 01:27:19 +0200
|
||||
|
||||
python-click-threading (0.4.4-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version
|
||||
* Bump standards version to 4.1.2 (no changes)
|
||||
|
||||
-- Filip Pytloun <filip@pytloun.cz> Mon, 11 Dec 2017 17:33:58 +0100
|
||||
|
||||
python-click-threading (0.4.3-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Filip Pytloun <filip@pytloun.cz> Tue, 17 Jan 2017 19:50:15 +0100
|
||||
|
||||
python-click-threading (0.4.2-1) unstable; urgency=medium
|
||||
|
||||
* Team upload.
|
||||
* New upstream release
|
||||
|
||||
-- Ondřej Nový <onovy@debian.org> Wed, 28 Dec 2016 23:04:51 +0100
|
||||
|
||||
python-click-threading (0.4.0-1) unstable; urgency=low
|
||||
|
||||
* initial release (Closes: #833996)
|
||||
|
||||
-- Filip Pytloun <filip@pytloun.cz> Thu, 11 Aug 2016 11:46:20 +0200
|
29
debian/control
vendored
29
debian/control
vendored
|
@ -1,29 +0,0 @@
|
|||
Source: python-click-threading
|
||||
Maintainer: Debian Python Team <team+python@tracker.debian.org>
|
||||
Uploaders: Filip Pytloun <filip@pytloun.cz>
|
||||
Section: python
|
||||
Priority: optional
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
dh-python,
|
||||
python3-all,
|
||||
python3-click,
|
||||
python3-pytest,
|
||||
python3-setuptools
|
||||
Standards-Version: 4.6.0
|
||||
Testsuite: autopkgtest-pkg-python
|
||||
Rules-Requires-Root: no
|
||||
Homepage: https://github.com/click-contrib/click-threading
|
||||
Vcs-Browser: https://salsa.debian.org/python-team/packages/python-click-threading
|
||||
Vcs-Git: https://salsa.debian.org/python-team/packages/python-click-threading.git
|
||||
|
||||
Package: python3-click-threading
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${python3:Depends}
|
||||
Description: Utilities for multithreading in click - Python 3.x
|
||||
Library for easier multithreaded development with Click.
|
||||
Click is a Python package for creating beautiful command line interfaces in a
|
||||
composable way with as little code as necessary. It’s the “Command Line
|
||||
Interface Creation Kit”. It’s highly configurable but comes with sensible
|
||||
defaults out of the box.
|
||||
.
|
||||
This package contains the Python 3.x module.
|
31
debian/copyright
vendored
31
debian/copyright
vendored
|
@ -1,31 +0,0 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: click-threading
|
||||
Upstream-Contact: Markus Unterwaditzer <markus@unterwaditzer.net>
|
||||
Source: https://github.com/click-contrib/click-threading
|
||||
|
||||
Files: *
|
||||
Copyright: 2014-2015 Markus Unterwaditzer & contributors
|
||||
License: Expat
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2016 Filip Pytloun <filip@pytloun.cz>
|
||||
License: Expat
|
||||
|
||||
License: Expat
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
9
debian/rules
vendored
9
debian/rules
vendored
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
export PYBUILD_NAME=click-threading
|
||||
|
||||
%:
|
||||
dh $@ --with python3 --buildsystem=pybuild
|
||||
|
||||
override_dh_auto_test:
|
||||
LC_ALL=C.UTF-8 dh_auto_test
|
1
debian/source/format
vendored
1
debian/source/format
vendored
|
@ -1 +0,0 @@
|
|||
3.0 (quilt)
|
1
debian/source/options
vendored
1
debian/source/options
vendored
|
@ -1 +0,0 @@
|
|||
extend-diff-ignore = "^[^/]*[.]egg-info/"
|
4
debian/tests/control
vendored
4
debian/tests/control
vendored
|
@ -1,4 +0,0 @@
|
|||
Tests: upstream
|
||||
Depends: @,
|
||||
python3-all,
|
||||
python3-pytest,
|
11
debian/tests/upstream
vendored
11
debian/tests/upstream
vendored
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -efu
|
||||
|
||||
cp -rv tests "${AUTOPKGTEST_TMP}"
|
||||
cd "${AUTOPKGTEST_TMP}"
|
||||
|
||||
for py in $(py3versions -s); do
|
||||
echo "[*] testing $py:"
|
||||
$py -m pytest
|
||||
done
|
4
debian/upstream/metadata
vendored
4
debian/upstream/metadata
vendored
|
@ -1,4 +0,0 @@
|
|||
Bug-Database: https://github.com/click-contrib/click-threading/issues
|
||||
Bug-Submit: https://github.com/click-contrib/click-threading/issues/new
|
||||
Repository: https://github.com/click-contrib/click-threading.git
|
||||
Repository-Browse: https://github.com/click-contrib/click-threading
|
3
debian/watch
vendored
3
debian/watch
vendored
|
@ -1,3 +0,0 @@
|
|||
version=4
|
||||
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/python-click-threading-$1\.tar\.gz/ \
|
||||
https://github.com/click-contrib/click-threading/tags .*/v?(\d\S*)\.tar\.gz
|
225
docs/Makefile
225
docs/Makefile
|
@ -1,225 +0,0 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " applehelp to make an Apple Help Book"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " epub3 to make an epub3"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||
@echo " dummy to check syntax errors of document sources"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
.PHONY: html
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
.PHONY: dirhtml
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
.PHONY: singlehtml
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
.PHONY: pickle
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
.PHONY: json
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
.PHONY: htmlhelp
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
.PHONY: qthelp
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/click-threading.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/click-threading.qhc"
|
||||
|
||||
.PHONY: applehelp
|
||||
applehelp:
|
||||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||
@echo
|
||||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||
"~/Library/Documentation/Help or install it in your application" \
|
||||
"bundle."
|
||||
|
||||
.PHONY: devhelp
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/click-threading"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/click-threading"
|
||||
@echo "# devhelp"
|
||||
|
||||
.PHONY: epub
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
.PHONY: epub3
|
||||
epub3:
|
||||
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
|
||||
@echo
|
||||
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
|
||||
|
||||
.PHONY: latex
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
.PHONY: latexpdf
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: latexpdfja
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: text
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
.PHONY: man
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
.PHONY: texinfo
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
.PHONY: info
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
.PHONY: gettext
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
.PHONY: changes
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
.PHONY: linkcheck
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
.PHONY: doctest
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||
@echo "Testing of coverage in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/coverage/python.txt."
|
||||
|
||||
.PHONY: xml
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
.PHONY: pseudoxml
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
|
||||
.PHONY: dummy
|
||||
dummy:
|
||||
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
|
||||
@echo
|
||||
@echo "Build finished. Dummy builder generates no files."
|
105
docs/conf.py
105
docs/conf.py
|
@ -1,105 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pkg_resources
|
||||
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.viewcode',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'click_threading'
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), '../LICENSE')) as f:
|
||||
copyright = next(iter(f))[len('Copyright (c) '):]
|
||||
|
||||
import click_threading
|
||||
release = click_threading.__version__
|
||||
version = '.'.join(release.split('.')[:2]) # The short X.Y version.
|
||||
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
except ImportError:
|
||||
html_theme = 'default'
|
||||
if not on_rtd:
|
||||
print('-' * 74)
|
||||
print('Warning: sphinx-rtd-theme not installed, building with default '
|
||||
'theme.')
|
||||
print('-' * 74)
|
||||
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = '{}doc'.format(project)
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'atomicwrites.tex', '{} Documentation'.format(project),
|
||||
'Markus Unterwaditzer', 'manual'),
|
||||
]
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'atomicwrites', 'atomicwrites Documentation',
|
||||
['Markus Unterwaditzer'], 1)
|
||||
]
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'atomicwrites', 'atomicwrites Documentation',
|
||||
'Markus Unterwaditzer', 'atomicwrites', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Bibliographic Dublin Core info.
|
||||
epub_title = 'atomicwrites'
|
||||
epub_author = 'Markus Unterwaditzer'
|
||||
epub_publisher = 'Markus Unterwaditzer'
|
||||
epub_copyright = copyright
|
||||
|
||||
# A list of files that should not be packed into the epub file.
|
||||
epub_exclude_files = ['search.html']
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {
|
||||
'http://docs.python.org/': None,
|
||||
'http://click.pocoo.org/': None,
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
Utilities for multithreaded applications with Click
|
||||
===================================================
|
||||
|
||||
.. toctree::
|
||||
threading
|
||||
uiworker
|
281
docs/make.bat
281
docs/make.bat
|
@ -1,281 +0,0 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. epub3 to make an epub3
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. xml to make Docutils-native XML files
|
||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
echo. coverage to run coverage check of the documentation if enabled
|
||||
echo. dummy to check syntax errors of document sources
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
REM Check if sphinx-build is available and fallback to Python version if any
|
||||
%SPHINXBUILD% 1>NUL 2>NUL
|
||||
if errorlevel 9009 goto sphinx_python
|
||||
goto sphinx_ok
|
||||
|
||||
:sphinx_python
|
||||
|
||||
set SPHINXBUILD=python -m sphinx.__init__
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:sphinx_ok
|
||||
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\click-threading.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\click-threading.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub3" (
|
||||
%SPHINXBUILD% -b epub3 %ALLSPHINXOPTS% %BUILDDIR%/epub3
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub3 file is in %BUILDDIR%/epub3.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdf" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdfja" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf-ja
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "coverage" (
|
||||
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of coverage in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/coverage/python.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "xml" (
|
||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pseudoxml" (
|
||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dummy" (
|
||||
%SPHINXBUILD% -b dummy %ALLSPHINXOPTS% %BUILDDIR%/dummy
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. Dummy builder generates no files.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
|
@ -1,7 +0,0 @@
|
|||
================
|
||||
The Thread class
|
||||
================
|
||||
|
||||
.. currentmodule:: click_threading
|
||||
|
||||
.. autoclass:: click_threading.Thread
|
|
@ -1,7 +0,0 @@
|
|||
========================================
|
||||
Output and prompts from multiple threads
|
||||
========================================
|
||||
|
||||
.. currentmodule:: click_threading
|
||||
|
||||
.. autoclass:: UiWorker
|
BIN
python-click-threading_0.4.0.orig.tar.gz.delta
Normal file
BIN
python-click-threading_0.4.0.orig.tar.gz.delta
Normal file
Binary file not shown.
1
python-click-threading_0.4.0.orig.tar.gz.id
Normal file
1
python-click-threading_0.4.0.orig.tar.gz.id
Normal file
|
@ -0,0 +1 @@
|
|||
b99ddb136095554cd9bb9a1ae221e496850e7ac8
|
BIN
python-click-threading_0.4.2.orig.tar.gz.delta
Normal file
BIN
python-click-threading_0.4.2.orig.tar.gz.delta
Normal file
Binary file not shown.
1
python-click-threading_0.4.2.orig.tar.gz.id
Normal file
1
python-click-threading_0.4.2.orig.tar.gz.id
Normal file
|
@ -0,0 +1 @@
|
|||
621257496e9fb5ac41986bfb2190db5e41a33d0f
|
BIN
python-click-threading_0.4.3.orig.tar.gz.delta
Normal file
BIN
python-click-threading_0.4.3.orig.tar.gz.delta
Normal file
Binary file not shown.
1
python-click-threading_0.4.3.orig.tar.gz.id
Normal file
1
python-click-threading_0.4.3.orig.tar.gz.id
Normal file
|
@ -0,0 +1 @@
|
|||
b995139b8285a4e915a8dfc6dd6277a00c744e7a
|
BIN
python-click-threading_0.4.4.orig.tar.gz.delta
Normal file
BIN
python-click-threading_0.4.4.orig.tar.gz.delta
Normal file
Binary file not shown.
1
python-click-threading_0.4.4.orig.tar.gz.id
Normal file
1
python-click-threading_0.4.4.orig.tar.gz.id
Normal file
|
@ -0,0 +1 @@
|
|||
19e400c3ca43ed528f1eebf94b5c7be93cfca58b
|
BIN
python-click-threading_0.5.0.orig.tar.gz.delta
Normal file
BIN
python-click-threading_0.5.0.orig.tar.gz.delta
Normal file
Binary file not shown.
1
python-click-threading_0.5.0.orig.tar.gz.id
Normal file
1
python-click-threading_0.5.0.orig.tar.gz.id
Normal file
|
@ -0,0 +1 @@
|
|||
85aab651278d8e4c18089905cfcdd5d87bcb96de
|
|
@ -1,9 +0,0 @@
|
|||
[wheel]
|
||||
universal = 1
|
||||
|
||||
[flake8]
|
||||
# W503: Line break before operator
|
||||
ignore = W503
|
||||
|
||||
[tool:pytest]
|
||||
addopts = --doctest-modules --ignore=setup.py
|
34
setup.py
34
setup.py
|
@ -1,34 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import ast
|
||||
import re
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
_version_re = re.compile(r'__version__\s+=\s+(.*)')
|
||||
|
||||
with open('click_threading/__init__.py', 'rb') as f:
|
||||
version = str(ast.literal_eval(_version_re.search(
|
||||
f.read().decode('utf-8')).group(1)))
|
||||
|
||||
setup(
|
||||
name='click-threading',
|
||||
version=version,
|
||||
description='Multithreaded Click apps made easy',
|
||||
author='Markus Unterwaditzer',
|
||||
author_email='markus@unterwaditzer.net',
|
||||
url='https://github.com/click-contrib/click-threading',
|
||||
license='MIT',
|
||||
packages=['click_threading'],
|
||||
install_requires=[
|
||||
'click>=5.0',
|
||||
],
|
||||
python_requires=">=3.6",
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
],
|
||||
)
|
|
@ -1,91 +0,0 @@
|
|||
import pytest
|
||||
|
||||
import click_threading
|
||||
from click_threading._compat import PY2
|
||||
|
||||
import click
|
||||
from click.testing import CliRunner
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def runner():
|
||||
return CliRunner()
|
||||
|
||||
|
||||
def test_context_pushing_thread(runner):
|
||||
@click.command()
|
||||
@click.pass_context
|
||||
def cli(ctx):
|
||||
contexts = []
|
||||
|
||||
def check_ctx():
|
||||
contexts.append(click.get_current_context())
|
||||
|
||||
t = click_threading.Thread(target=check_ctx)
|
||||
t.start()
|
||||
t.join()
|
||||
|
||||
assert contexts == [ctx]
|
||||
|
||||
runner.invoke(cli, catch_exceptions=False)
|
||||
|
||||
|
||||
def test_ui_worker_basic(runner):
|
||||
@click.command()
|
||||
def cli():
|
||||
|
||||
ui = click_threading.UiWorker()
|
||||
|
||||
def target():
|
||||
click.prompt('two')
|
||||
ui.shutdown()
|
||||
|
||||
click.prompt('one')
|
||||
|
||||
with ui.patch_click():
|
||||
t = click_threading.Thread(target=target)
|
||||
t.start()
|
||||
ui.run()
|
||||
|
||||
click.prompt('three')
|
||||
t.join()
|
||||
|
||||
result = runner.invoke(cli, catch_exceptions=False, input='y\n' * 3)
|
||||
assert result.output.splitlines() == ['one: y', 'two: y', 'three: y']
|
||||
|
||||
|
||||
def test_monkey_patch(capsys):
|
||||
old_echo = click.echo
|
||||
if PY2:
|
||||
old_code = old_echo.func_code
|
||||
else:
|
||||
old_code = old_echo.__code__
|
||||
|
||||
def wrapper(f, info):
|
||||
def new_f(*a, **kw):
|
||||
assert old_echo is not f
|
||||
if PY2:
|
||||
assert f.func_code is old_code
|
||||
else:
|
||||
assert f.__code__ is old_code
|
||||
|
||||
print("LOL")
|
||||
rv = f(*a, **kw)
|
||||
print("LOL")
|
||||
return rv
|
||||
return new_f
|
||||
|
||||
with click_threading.monkey.patch_ui_functions(wrapper):
|
||||
assert click.echo is old_echo
|
||||
click.echo('Hello world')
|
||||
|
||||
assert click.echo is old_echo
|
||||
click.echo('Hello second world')
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
assert out.splitlines() == [
|
||||
'LOL',
|
||||
'Hello world',
|
||||
'LOL',
|
||||
'Hello second world'
|
||||
]
|
Loading…
Reference in a new issue