Skip to content

Commit

Permalink
Merge 00873f8 into 858adf0
Browse files Browse the repository at this point in the history
  • Loading branch information
amoffat committed Apr 27, 2020
2 parents 858adf0 + 00873f8 commit c1e27fd
Show file tree
Hide file tree
Showing 14 changed files with 813 additions and 269 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
__pycache__/
*.py[co]
.tox
.coverage
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -4,14 +4,16 @@ os:
language: python

python:
- 2.6
# - 2.6 No longer supported on Travis
- 2.7
- pypy
- 3.3
# - 3.3 No longer supported on Travis
- 3.4
- 3.5
- 3.6
- pypy-5.3.1
- 3.7
- 3.8
- pypy
- pypy3.5

before_script:
- pip install -r requirements-dev.txt
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,28 @@
# Changelog

## 1.13.0 - 4/27/20
* minor Travis CI fixes [#492](https://github.com/amoffat/sh/pull/492)
* bugfix for boolean long options not respecting `_long_prefix` [#488](https://github.com/amoffat/sh/pull/488)
* fix deprecation warning on Python 3.6 regexes [#482](https://github.com/amoffat/sh/pull/482)
* `_pass_fds` and `_close_fds` special kwargs for controlling file descriptor inheritance in child.
* more efficiently closing inherited fds [#406](https://github.com/amoffat/sh/issues/406)
* bugfix where passing invalid dictionary to `_env` will cause a mysterious child 255 exit code. [#497](https://github.com/amoffat/sh/pull/497)
* bugfix where `_in` using 0 or `sys.stdin` wasn't behaving like a TTY, if it was in fact a TTY. [#514](https://github.com/amoffat/sh/issues/514)
* bugfix where `help(sh)` raised an exception [#455](https://github.com/amoffat/sh/issues/455)
* bugfix fixing broken interactive ssh tutorial from docs
* change to automatic tty merging into a single pty if `_tty_in=True` and `_tty_out=True`
* introducing `_unify_ttys`, default False, which allows explicit tty merging into single pty
* contrib command for `ssh` connections requiring passwords
* performance fix for polling output too fast when using `_iter` [#462](https://github.com/amoffat/sh/issues/462)
* execution contexts can now be used in python shell [#466](https://github.com/amoffat/sh/pull/466)
* bugfix `ErrorReturnCode` instances can now be pickled
* bugfix passing empty string or `None` for `_in` hanged [#427](https://github.com/amoffat/sh/pull/427)
* bugfix where passing a filename or file-like object to `_out` wasn't using os.dup2 [#449](https://github.com/amoffat/sh/issues/449)
* regression make `_fg` work with `_cwd` again [#330](https://github.com/amoffat/sh/issues/330)
* an invalid `_cwd` now raises a `ForkException` not an `OSError`.
* AIX support [#477](https://github.com/amoffat/sh/issues/477)
* added a `timeout=None` param to `RunningCommand.wait()` [#515](https://github.com/amoffat/sh/issues/515)

## 1.12.14 - 6/6/17
* bugfix for poor sleep performance [#378](https://github.com/amoffat/sh/issues/378)
* allow passing raw integer file descriptors for `_out` and `_err` handlers
Expand Down
24 changes: 15 additions & 9 deletions README.rst
Expand Up @@ -7,6 +7,9 @@
.. image:: https://img.shields.io/pypi/v/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Version
.. image:: https://img.shields.io/pypi/dm/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Downloads Status
.. image:: https://img.shields.io/pypi/pyversions/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Python Versions
Expand All @@ -19,8 +22,8 @@

|
sh is a full-fledged subprocess replacement for Python 2.6 - 3.6, PyPy and PyPy3
that allows you to call any program as if it were a function:
sh is a full-fledged subprocess replacement for Python 2.6 - 3.8, PyPy and PyPy3
that allows you to call *any* program as if it were a function:

.. code:: python
Expand Down Expand Up @@ -49,21 +52,24 @@ Developers
Testing
-------

First install the development requirements::
I've included a Docker test suite in the `docker_test_suit/` folder. To build the image, `cd` into that directory and
run::

$> pip install -r requirements-dev.txt
$> ./build.sh

The run the tests for all Python versions on your system::
This will install ubuntu 18.04 LTS and all python versions from 2.6-3.8. Once it's done, stay in that directory and
run::

$> python sh.py test
$> ./run.sh

To run a single test for all environments::
This will mount your local code directory into the container and start the test suite, which will take a long time to
run. If you wish to run a single test, you may pass that test to `./run.sh`::

$> python sh.py test FunctionalTests.test_unicode_arg
$> ./run.sh FunctionalTests.test_unicode_arg

To run a single test for a single environment::

$> python sh.py test -e 3.4 FunctionalTests.test_unicode_arg
$> ./run.sh -e 3.4 FunctionalTests.test_unicode_arg

Coverage
--------
Expand Down
47 changes: 47 additions & 0 deletions docker_test_suite/Dockerfile
@@ -0,0 +1,47 @@
FROM ubuntu:bionic

ARG cache_bust
RUN apt-get update
RUN apt-get -y install locales

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN apt-get -y install\
software-properties-common\
curl\
sudo\
python\
lsof

RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get -y install\
python2.6\
python2.7\
python3.1\
python3.2\
python3.3\
python3.4\
python3.5\
python3.6\
python3.7\
python3.8

RUN apt-get -y install python3-distutils\
&& curl https://bootstrap.pypa.io/get-pip.py | python -

ARG uid=1000
RUN groupadd -g $uid shtest\
&& useradd -m -u $uid -g $uid shtest\
&& gpasswd -a shtest sudo\
&& echo "shtest:shtest" | chpasswd

COPY requirements-dev.txt /tmp/
RUN pip install -r /tmp/requirements-dev.txt

USER shtest
WORKDIR /home/shtest/sh
ENTRYPOINT ["python", "sh.py", "test"]
4 changes: 4 additions & 0 deletions docker_test_suite/build.sh
@@ -0,0 +1,4 @@
#!/bin/bash
set -ex
cp ../requirements-dev.txt .
docker build -t amoffat/shtest $@ .
3 changes: 3 additions & 0 deletions docker_test_suite/run.sh
@@ -0,0 +1,3 @@
#!/bin/bash
set -ex
docker run -it --rm -v $(pwd)/../:/home/shtest/sh amoffat/shtest $@
3 changes: 3 additions & 0 deletions docker_test_suite/shell.sh
@@ -0,0 +1,3 @@
#!/bin/bash
set -ex
docker run -it --rm -v $(pwd)/../:/home/shtest/sh --entrypoint=/bin/bash amoffat/shtest $@
1 change: 0 additions & 1 deletion requirements-dev.txt
Expand Up @@ -3,4 +3,3 @@ coverage==4.2
coveralls==1.1
docopt==0.6.2
docutils==0.12
requests==2.12.1
2 changes: 1 addition & 1 deletion requirements-docs.txt
Expand Up @@ -2,7 +2,7 @@ alabaster==0.7.9
Babel==2.3.4
docutils==0.12
imagesize==0.7.1
Jinja2==2.8
Jinja2==2.10.3
MarkupSafe==0.23
Pygments==2.1.3
pytz==2016.7
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -10,7 +10,7 @@
HERE = dirname(abspath(__file__))

author = "Andrew Moffat"
author_email = "andrew.robert.moffat@gmail.com"
author_email = "arwmoffat@gmail.com"
keywords = ["subprocess", "process", "shell", "launch", "program"]


Expand Down Expand Up @@ -48,6 +48,8 @@ def read(*parts):
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Build Tools",
Expand Down

0 comments on commit c1e27fd

Please sign in to comment.