Skip to content

Commit 0d84dec

Browse files
committed
Fix merge conflicts
2 parents 81958cc + 254fdd2 commit 0d84dec

File tree

8 files changed

+85
-58
lines changed

8 files changed

+85
-58
lines changed

HISTORY.rst

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,90 +2,88 @@
22
History
33
=======
44

5-
2.2.0 (????-??-??)
5+
2.3.0 (????-??-??)
66
------------------
7-
87
* Python 3.6+ only, support for Python 3.5 has been dropped
98

9+
2.2.0 (2020-09-07)
10+
------------------
11+
* Calling the run() function with unnamed arguments (other than the command
12+
list as the first argument) is now deprecated. As a number of arguments
13+
will be removed in a future version the use of unnamed arguments will
14+
cause future confusion. `Use explicit keyword arguments instead (#62). <https://github.com/DiamondLightSource/python-procrunner/pull/62>`_
15+
* `The run() function debug argument has been deprecated (#63). <https://github.com/DiamondLightSource/python-procrunner/pull/63>`_
16+
This is only used to debug the NonBlockingStream* classes. Those are due
17+
to be replaced in a future release, so the argument will no longer serve
18+
a purpose. Debugging information remains available via standard logging
19+
mechanisms.
20+
* Final version supporting Python 3.5
21+
1022
2.1.0 (2020-09-05)
1123
------------------
12-
1324
* `Deprecated array access on the return object (#60). <https://github.com/DiamondLightSource/python-procrunner/pull/60>`_
1425
The return object will become a subprocess.CompletedProcess in a future
1526
release, which no longer allows array-based access. For a translation table
1627
of array elements to attributes please see the pull request linked above.
17-
* Add a `new parameter 'raise_timeout_exceptions' (#61). <https://github.com/DiamondLightSource/python-procrunner/pull/61>`_
28+
* Add a `new parameter 'raise_timeout_exception' (#61). <https://github.com/DiamondLightSource/python-procrunner/pull/61>`_
1829
When set to 'True' a subprocess.TimeoutExpired exception is raised when the
1930
process runtime exceeds the timeout threshold. This defaults to 'False' and
2031
will be set to 'True' in a future release.
21-
* Final version supporting Python 3.5
2232

2333
2.0.0 (2020-06-24)
2434
------------------
25-
2635
* Python 3.5+ only, support for Python 2.7 has been dropped
2736
* Deprecated function alias run_process() has been removed
2837
* Fixed a stability issue on Windows
2938

3039
1.1.0 (2019-11-04)
3140
------------------
32-
3341
* Add Python 3.8 support, drop Python 3.4 support
3442

3543
1.0.2 (2019-05-20)
3644
------------------
37-
3845
* Stop environment override variables leaking into the process environment
3946

4047
1.0.1 (2019-04-16)
4148
------------------
42-
4349
* Minor fixes on the return object (implement equality,
4450
mark as unhashable)
4551

4652
1.0.0 (2019-03-25)
4753
------------------
48-
4954
* Support file system path objects (PEP-519) in arguments
5055
* Change the return object to make it similar to
5156
subprocess.CompletedProcess, introduced with Python 3.5+
5257

5358
0.9.1 (2019-02-22)
5459
------------------
55-
5660
* Have deprecation warnings point to correct code locations
5761

5862
0.9.0 (2018-12-07)
5963
------------------
60-
6164
* Trap UnicodeEncodeError when printing output. Offending characters
6265
are replaced and a warning is logged once. Hints at incorrectly set
6366
PYTHONIOENCODING.
6467

6568
0.8.1 (2018-12-04)
6669
------------------
67-
6870
* Fix a few deprecation warnings
6971

7072
0.8.0 (2018-10-09)
7173
------------------
72-
7374
* Add parameter working_directory to set the working directory
7475
of the subprocess
7576

7677
0.7.2 (2018-10-05)
7778
------------------
78-
7979
* Officially support Python 3.7
8080

8181
0.7.1 (2018-09-03)
8282
------------------
83-
8483
* Accept environment variable overriding with numeric values.
8584

8685
0.7.0 (2018-05-13)
8786
------------------
88-
8987
* Unicode fixes. Fix crash on invalid UTF-8 input.
9088
* Clarify that stdout/stderr values are returned as bytestrings.
9189
* Callbacks receive the data decoded as UTF-8 unicode strings
@@ -95,23 +93,19 @@ History
9593

9694
0.6.1 (2018-05-02)
9795
------------------
98-
9996
* Maintenance release to add some tests for executable resolution.
10097

10198
0.6.0 (2018-05-02)
10299
------------------
103-
104100
* Fix Win32 API executable resolution for commands containing a dot ('.') in
105101
addition to a file extension (say '.bat').
106102

107103
0.5.1 (2018-04-27)
108104
------------------
109-
110105
* Fix Win32API dependency installation on Windows.
111106

112107
0.5.0 (2018-04-26)
113108
------------------
114-
115109
* New keyword 'win32resolve' which only takes effect on Windows and is enabled
116110
by default. This causes procrunner to call the Win32 API FindExecutable()
117111
function to try and lookup non-.exe files with the corresponding name. This
@@ -120,21 +114,17 @@ History
120114

121115
0.4.0 (2018-04-23)
122116
------------------
123-
124117
* Python 2.7 support on Windows. Python3 not yet supported on Windows.
125118

126119
0.3.0 (2018-04-17)
127120
------------------
128-
129121
* run_process() renamed to run()
130122
* Python3 compatibility fixes
131123

132124
0.2.0 (2018-03-12)
133125
------------------
134-
135126
* Procrunner is now Python3 3.3-3.6 compatible.
136127

137128
0.1.0 (2018-03-12)
138129
------------------
139-
140130
* First release on PyPI.

docs/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848

4949
# General information about the project.
5050
project = "ProcRunner"
51-
copyright = "2020, Markus Gerstel"
52-
author = "Markus Gerstel"
51+
copyright = "2020, Diamond Light Source"
52+
author = "Diamond Light Source - Scientific Software"
5353

5454
# The version info for the project you're documenting, acts as replacement
5555
# for |version| and |release|, also used in various other places throughout
@@ -128,8 +128,8 @@
128128
(
129129
master_doc,
130130
"procrunner.tex",
131-
"ProcRunner Documentation",
132-
"Markus Gerstel",
131+
"procrunner Documentation",
132+
"Diamond Light Source - Scientific Software",
133133
"manual",
134134
)
135135
]
@@ -139,7 +139,7 @@
139139

140140
# One entry per manual page. List of tuples
141141
# (source start file, name, description, authors, manual section).
142-
man_pages = [(master_doc, "procrunner", "ProcRunner Documentation", [author], 1)]
142+
man_pages = [(master_doc, "procrunner", "procrunner Documentation", [author], 1)]
143143

144144

145145
# -- Options for Texinfo output ----------------------------------------
@@ -151,10 +151,10 @@
151151
(
152152
master_doc,
153153
"procrunner",
154-
"ProcRunner Documentation",
154+
"procrunner Documentation",
155155
author,
156156
"procrunner",
157-
"One line description of project.",
157+
"Versatile utility function to run external processes",
158158
"Miscellaneous",
159159
)
160160
]

procrunner/__init__.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import codecs
2+
import functools
23
import io
34
import logging
45
import os
@@ -52,7 +53,7 @@
5253

5354
__author__ = """Markus Gerstel"""
5455
__email__ = "[email protected]"
55-
__version__ = "2.1.0"
56+
__version__ = "2.2.0"
5657

5758
logger = logging.getLogger("procrunner")
5859
logger.addHandler(logging.NullHandler())
@@ -209,7 +210,6 @@ def __init__(self, stream, data, debug=False, notify=None):
209210
self._buffer = data
210211
self._buffer_len = len(data)
211212
self._buffer_pos = 0
212-
self._debug = debug
213213
self._max_block_len = 4096
214214
self._stream = stream
215215
self._terminated = False
@@ -413,10 +413,26 @@ def update(self, dictionary):
413413
self._extras.update(dictionary)
414414

415415

416+
def _deprecate_argument_calling(f):
417+
@functools.wraps(f)
418+
def wrapper(*args, **kwargs):
419+
if len(args) > 1:
420+
warnings.warn(
421+
"Calling procrunner.run() with unnamed arguments (apart from "
422+
"the command) is deprecated. Use keyword arguments instead.",
423+
DeprecationWarning,
424+
stacklevel=2,
425+
)
426+
return f(*args, **kwargs)
427+
428+
return wrapper
429+
430+
431+
@_deprecate_argument_calling
416432
def run(
417433
command,
418434
timeout=None,
419-
debug=False,
435+
debug=None,
420436
stdin=None,
421437
print_stdout=True,
422438
print_stderr=True,
@@ -436,7 +452,7 @@ def run(
436452
437453
:param array command: Command line to be run, specified as array.
438454
:param timeout: Terminate program execution after this many seconds.
439-
:param boolean debug: Enable further debug messages.
455+
:param boolean debug: Enable further debug messages. (deprecated)
440456
:param stdin: Optional bytestring that is passed to command stdin.
441457
:param boolean print_stdout: Pass stdout through to sys.stdout.
442458
:param boolean print_stderr: Pass stderr through to sys.stderr.
@@ -470,6 +486,10 @@ def run(
470486
else:
471487
assert sys.platform != "win32", "stdin argument not supported on Windows"
472488
stdin_pipe = subprocess.PIPE
489+
if debug is not None:
490+
warnings.warn(
491+
"Use of the debug parameter is deprecated", DeprecationWarning, stacklevel=3
492+
)
473493

474494
start_time = timeit.default_timer()
475495
if timeout is not None:
@@ -478,7 +498,7 @@ def run(
478498
warnings.warn(
479499
"Using procrunner with timeout and without raise_timeout_exception set is deprecated",
480500
DeprecationWarning,
481-
stacklevel=2,
501+
stacklevel=3,
482502
)
483503

484504
if environment is not None:

requirements_dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
bump2version==1.0.0
2-
coverage==5.2.1
2+
coverage==5.3
33
flake8==3.8.3
44
mock==3.0.5
5-
pip==20.2.2
6-
pytest==6.0.1
5+
pip==20.2.3
6+
pytest==6.1.0
77
Sphinx==3.2.1
8-
tox==3.19.0
8+
tox==3.20.0
99
twine==1.15.0
1010
wheel==0.35.1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.1.0
2+
current_version = 2.2.0
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
test_suite="tests",
4545
tests_require=test_requirements,
4646
url="https://github.com/DiamondLightSource/python-procrunner",
47-
version="2.1.0",
47+
version="2.2.0",
4848
zip_safe=False,
4949
)

0 commit comments

Comments
 (0)