1
0

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
This commit is contained in:
Tomáš Chvátal 2019-03-10 10:49:06 +00:00 committed by Git OBS Bridge
commit a5dfcb452a
7 changed files with 143 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e6cc9cedab9ae59b169ee0422e17231adedadb144e63c0b5a60e6ff8adf8521b
size 6260

View File

@ -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

View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Thu Mar 7 08:26:37 AM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.1.1, using exclude-eof-from-result.patch

66
python-delegator.py.spec Normal file
View File

@ -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

6
test_chain.py Normal file
View File

@ -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'