commit a5dfcb452abb19fe12c71b6fff2a32d1255cbfc65599fce646d04b7a1fedc6c1 Author: Tomáš Chvátal Date: Sun Mar 10 10:49:06 2019 +0000 Accepting request 682891 from home:jayvdb:coala:python3-bears - Initial spec for v0.1.1, using exclude-eof-from-result.patch OBS-URL: https://build.opensuse.org/request/show/682891 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-delegator.py?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/delegator.py-0.1.1.tar.gz b/delegator.py-0.1.1.tar.gz new file mode 100644 index 0000000..6f73aa0 --- /dev/null +++ b/delegator.py-0.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6cc9cedab9ae59b169ee0422e17231adedadb144e63c0b5a60e6ff8adf8521b +size 6260 diff --git a/exclude-eof-from-result.patch b/exclude-eof-from-result.patch new file mode 100644 index 0000000..fecb494 --- /dev/null +++ b/exclude-eof-from-result.patch @@ -0,0 +1,40 @@ +--- delegator.py-0.1.1/delegator.py.orig 2018-09-18 02:35:34.000000000 +0700 ++++ delegator.py-0.1.1/delegator.py 2019-03-08 00:53:35.605573650 +0700 +@@ -7,6 +7,8 @@ + import errno + + from pexpect.popen_spawn import PopenSpawn ++import pexpect ++pexpect.EOF.__module__ = "pexpect.exceptions" + + # Include `unicode` in STR_TYPES for Python 2.X + try: +@@ -110,7 +112,7 @@ + if self.subprocess.before: + result += self.subprocess.before + +- if self.subprocess.after: ++ if self.subprocess.after and self.subprocess.after is not pexpect.EOF: + result += self.subprocess.after + + result += self.subprocess.read() +@@ -205,7 +207,10 @@ + if self.blocking: + raise RuntimeError("expect can only be used on non-blocking commands.") + +- self.subprocess.expect(pattern=pattern, timeout=timeout) ++ try: ++ self.subprocess.expect(pattern=pattern, timeout=timeout) ++ except pexpect.EOF: ++ pass + + def send(self, s, end=os.linesep, signal=False): + """Sends the given string or signal to std_in.""" +@@ -263,7 +268,6 @@ + c.run(block=False, cwd=cwd) + if data: + c.send(data) +- c.subprocess.sendeof() + c.block() + return c + diff --git a/python-delegator.py.changes b/python-delegator.py.changes new file mode 100644 index 0000000..005bdd9 --- /dev/null +++ b/python-delegator.py.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Thu Mar 7 08:26:37 AM UTC 2019 - John Vandenberg + +- Initial spec for v0.1.1, using exclude-eof-from-result.patch diff --git a/python-delegator.py.spec b/python-delegator.py.spec new file mode 100644 index 0000000..e050902 --- /dev/null +++ b/python-delegator.py.spec @@ -0,0 +1,66 @@ +# +# spec file for package python-delegator.py +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-delegator.py +Version: 0.1.1 +Release: 0 +License: MIT +Summary: Subprocesses for Humans 2.0 +Url: https://github.com/kennethreitz/delegator.py +Group: Development/Languages/Python +Source: https://files.pythonhosted.org/packages/source/d/delegator.py/delegator.py-%{version}.tar.gz +Source1: https://raw.githubusercontent.com/kennethreitz/delegator.py/master/tests/test_chain.py +Patch0: exclude-eof-from-result.patch +BuildRequires: python-rpm-macros +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module pexpect >= 4.1.0} +BuildRequires: fdupes +Requires: python-pexpect >= 4.1.0 +BuildArch: noarch +Conflicts: python-delegator + +%python_subpackages + +%description +Subprocesses for Humans 2.0. + +%prep +%setup -q -n delegator.py-%{version} +%patch0 -p1 +cp %{SOURCE1} . + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +# Tests from master are not compatible. Likely fixed in next release. +# https://github.com/kennethreitz/delegator.py/pull/71 +#%%check +#export PYTHONPATH=${PWD} +#%%python_exec -m pytest test_chain.py + +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/* + +%changelog diff --git a/test_chain.py b/test_chain.py new file mode 100644 index 0000000..2ea6e14 --- /dev/null +++ b/test_chain.py @@ -0,0 +1,6 @@ +import pytest +import delegator + +def test_chain(): + c = delegator.chain("seq 4 | awk '{ print $0 \" test\"; }'") + assert c.out == '1 test\n2 test\n3 test\n4 test\n'