Hello community, here is the log from the commit of package python-aexpect for openSUSE:Factory checked in at 2018-07-28 12:45:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-aexpect (Old) and /work/SRC/openSUSE:Factory/.python-aexpect.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-aexpect" Sat Jul 28 12:45:05 2018 rev:2 rq:625772 version:1.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-aexpect/python-aexpect.changes 2017-10-18 10:51:09.118987468 +0200 +++ /work/SRC/openSUSE:Factory/.python-aexpect.new/python-aexpect.changes 2018-07-28 12:45:06.972958735 +0200 @@ -1,0 +2,8 @@ +Fri Jul 27 11:07:10 UTC 2018 - mplus...@suse.com + +- Update to version 1.5.1: + * No changelog available +- Correct dependencies +- Run tests + +------------------------------------------------------------------- Old: ---- aexpect-1.4.0.tar.gz New: ---- aexpect-1.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-aexpect.spec ++++++ --- /var/tmp/diff_new_pack.k6YvKV/_old 2018-07-28 12:45:07.508959709 +0200 +++ /var/tmp/diff_new_pack.k6YvKV/_new 2018-07-28 12:45:07.516959724 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-aexpect # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 @@ -19,21 +19,24 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %global pkgname aexpect Name: python-%{pkgname} -Version: 1.4.0 +Version: 1.5.1 Release: 0 Summary: Python library to control interactive applications -License: GPL-2.0 +License: GPL-2.0-only Group: Development/Languages/Python -Url: http://avocado-framework.readthedocs.org/ +URL: http://avocado-framework.readthedocs.org/ Source: https://github.com/avocado-framework/aexpect/archive/%{version}.tar.gz#/%{pkgname}-%{version}.tar.gz -BuildRequires: %{python_module base} BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildRequires: python2-subprocess32 >= 3.2.6 Requires(post): update-alternatives Requires(postun): update-alternatives BuildArch: noarch +%ifpython2 +Requires: python2-subprocess32 >= 3.2.6 +%endif %python_subpackages %description @@ -52,6 +55,10 @@ %python_clone -a %{buildroot}%{_bindir}/aexpect-helper %fdupes %{buildroot} +%check +export PATH=$PATH:%{buildroot}%{_bindir} +%python_exec setup.py test + %post %python_install_alternative aexpect-helper @@ -59,7 +66,8 @@ %python_uninstall_alternative aexpect-helper %files %{python_files} -%doc LICENSE README.rst +%license LICENSE +%doc README.rst %python_alternative %{_bindir}/aexpect-helper %{python_sitelib}/* ++++++ aexpect-1.4.0.tar.gz -> aexpect-1.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/.travis.yml new/aexpect-1.5.1/.travis.yml --- old/aexpect-1.4.0/.travis.yml 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/.travis.yml 2018-06-13 17:19:29.000000000 +0200 @@ -2,7 +2,7 @@ python: - "2.7" - - "2.6" + - "3.4" sudo: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/Makefile new/aexpect-1.5.1/Makefile --- old/aexpect-1.4.0/Makefile 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/Makefile 2018-06-13 17:19:29.000000000 +0200 @@ -1,23 +1,38 @@ -PYTHON=`which python` +PYTHON=$(shell which python 2>/dev/null || which python3 2>/dev/null) +PYTHON_DEVELOP_ARGS=$(shell if ($(PYTHON) setup.py develop --help 2>/dev/null | grep -q '\-\-user'); then echo "--user"; else echo ""; fi) DESTDIR=/ BUILDIR=$(CURDIR)/debian/aexpect PROJECT=aexpect -VERSION="1.4.0" +VERSION="1.5.1" +COMMIT=$(shell git log --pretty=format:'%H' -n 1) +SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1) +COMMIT_DATE=$(shell git log --pretty='format:%cd' --date='format:%Y%m%d' -n 1) +MOCK_CONFIG=default all: + @echo "make check - Runs tree static check, unittests and functional tests" + @echo "make clean - Get rid of scratch and byte files" @echo "make source - Create source package" @echo "make install - Install on local system" @echo "make build-deb-src - Generate a source debian package" @echo "make build-deb-bin - Generate a binary debian package" @echo "make build-deb-all - Generate both source and binary debian packages" - @echo "make build-rpm-src - Generate a source RPM package (.srpm)" - @echo "make build-rpm-all - Generate both source and binary RPMs" - @echo "make man - Generate the avocado man page" - @echo "make check - Runs tree static check, unittests and functional tests" - @echo "make clean - Get rid of scratch and byte files" - -source: - $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=SOURCES + @echo "RPM related targets:" + @echo "make srpm: Generate a source RPM package (.srpm)" + @echo "make rpm: Generate binary RPMs" + @echo + @echo "Release related targets:" + @echo "source-release: Create source package for the latest tagged release" + @echo "srpm-release: Generate a source RPM package (.srpm) for the latest tagged release" + @echo "rpm-release: Generate binary RPMs for the latest tagged release" + +source: clean + if test ! -d SOURCES; then mkdir SOURCES; fi + git archive --prefix="aexpect-$(COMMIT)/" -o "SOURCES/aexpect-$(SHORT_COMMIT).tar.gz" HEAD + +source-release: clean + if test ! -d SOURCES; then mkdir SOURCES; fi + git archive --prefix="aexpect-$(VERSION)/" -o "SOURCES/aexpect-$(VERSION).tar.gz" $(VERSION) install: $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE) @@ -41,16 +56,26 @@ # build both source and binary packages dpkg-buildpackage -i -I -rfakeroot -build-rpm-src: source - rpmbuild --define '_topdir %{getenv:PWD}' \ - -bs python-aexpect.spec - -build-rpm-all: source - rpmbuild --define '_topdir %{getenv:PWD}' \ - -ba python-aexpect.spec - -check: - selftests/checkall +srpm: source + if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi + mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec python-aexpect.spec --sources SOURCES + +rpm: srpm + if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi + mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-aexpect-$(VERSION)-*.src.rpm + +srpm-release: source-release + if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi + mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec python-aexpect.spec --sources SOURCES + +rpm-release: srpm-release + if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi + mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-aexpect-$(VERSION)-*.src.rpm + +check: clean + inspekt checkall + $(PYTHON) setup.py develop $(PYTHON_DEVELOP_ARGS) + $(PYTHON) setup.py test clean: $(PYTHON) setup.py clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/__init__.py new/aexpect-1.5.1/aexpect/__init__.py --- old/aexpect-1.4.0/aexpect/__init__.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/__init__.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + from .exceptions import ExpectError from .exceptions import ExpectProcessTerminatedError from .exceptions import ExpectTimeoutError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/client.py new/aexpect-1.5.1/aexpect/client.py --- old/aexpect-1.4.0/aexpect/client.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/client.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + """ API used to run/control interactive processes. @@ -6,12 +17,17 @@ import time import signal import os +import sys import re import threading import shutil import select +import locale import logging -import subprocess +if sys.version_info[0] < 3: + import subprocess32 as subprocess +else: + import subprocess from aexpect.exceptions import ExpectError from aexpect.exceptions import ExpectProcessTerminatedError @@ -92,7 +108,7 @@ """ def __init__(self, command=None, a_id=None, auto_close=False, echo=False, - linesep="\n"): + linesep="\n", pass_fds=(), encoding=None): """ Initialize the class and run command as a child process. @@ -107,13 +123,20 @@ parameter has an effect only when starting a new server. :param linesep: Line separator to be appended to strings sent to the child process by sendline(). + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) """ self.a_id = a_id or data_factory.generate_random_string(8) self.log_file = None self.closed = False - # Use PYTHONENCODINGS or utf-8 (instead of ascii) - self.encoding = os.environ.get("PYTHONENCODING", "utf-8") - + if encoding is None: + self.encoding = locale.getpreferredencoding() + if self.encoding is None: + self.encoding = "UTF-8" + else: + self.encoding = encoding base_dir = os.path.join(BASE_DIR, 'aexpect_%s' % self.a_id) # Define filenames for communication with server @@ -155,12 +178,22 @@ # Start the server (which runs the command) if command: - helper_cmd = utils_path.find_command('aexpect-helper') + # try to find python specific version of aexpect-helper first, then + # try unversioned + helper_noversion = 'aexpect-helper' + helper_versioned = '{0}-{1}.{2}'.format(helper_noversion, + sys.version_info[0], + sys.version_info[1]) + try: + helper_cmd = utils_path.find_command(helper_versioned) + except utils_path.CmdNotFoundError: + helper_cmd = utils_path.find_command(helper_noversion) sub = subprocess.Popen([helper_cmd], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, + pass_fds=pass_fds) # Send parameters to the server sub.stdin.write(("%s\n" % self.a_id).encode(self.encoding)) sub.stdin.write(("%s\n" % echo).encode(self.encoding)) @@ -432,7 +465,7 @@ def __init__(self, command=None, a_id=None, auto_close=False, echo=False, linesep="\n", termination_func=None, termination_params=(), output_func=None, output_params=(), output_prefix="", - thread_name=None): + thread_name=None, pass_fds=(), encoding=None): """ Initialize the class and run command as a child process. @@ -459,6 +492,10 @@ output line. :param output_prefix: String to prepend to lines sent to output_func. :param thread_name: Name of thread to better identify hanging threads. + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) """ # Add a reader and a close hook self._add_reader("tail") @@ -466,7 +503,8 @@ self._add_close_hook(Tail._close_log_file) # Init the superclass - Spawn.__init__(self, command, a_id, auto_close, echo, linesep) + Spawn.__init__(self, command, a_id, auto_close, echo, linesep, + pass_fds, encoding) if thread_name is None: self.thread_name = "tail_thread_%s_%s" % (self.a_id, str(command)[:10]) @@ -649,7 +687,7 @@ def __init__(self, command=None, a_id=None, auto_close=True, echo=False, linesep="\n", termination_func=None, termination_params=(), output_func=None, output_params=(), output_prefix="", - thread_name=None): + thread_name=None, pass_fds=(), encoding=None): """ Initialize the class and run command as a child process. @@ -675,6 +713,10 @@ :param output_params: Parameters to send to output_func before the output line. :param output_prefix: String to prepend to lines sent to output_func. + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) """ # Add a reader self._add_reader("expect") @@ -682,7 +724,8 @@ # Init the superclass Tail.__init__(self, command, a_id, auto_close, echo, linesep, termination_func, termination_params, - output_func, output_params, output_prefix, thread_name) + output_func, output_params, output_prefix, thread_name, + pass_fds, encoding) def __reduce__(self): return self.__class__, (self.__getinitargs__()) @@ -925,7 +968,7 @@ linesep="\n", termination_func=None, termination_params=(), output_func=None, output_params=(), output_prefix="", thread_name=None, prompt=r"[\#\$]\s*$", - status_test_command="echo $?"): + status_test_command="echo $?", pass_fds=(), encoding=None): """ Initialize the class and run command as a child process. @@ -955,11 +998,16 @@ :param status_test_command: Command to be used for getting the last exit status of commands run inside the shell (used by cmd_status_output() and friends). + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) """ # Init the superclass Expect.__init__(self, command, a_id, auto_close, echo, linesep, termination_func, termination_params, - output_func, output_params, output_prefix, thread_name) + output_func, output_params, output_prefix, thread_name, + pass_fds, encoding) # Remember some attributes self.prompt = prompt @@ -1269,7 +1317,7 @@ def run_tail(command, termination_func=None, output_func=None, output_prefix="", - timeout=1.0, auto_close=True): + timeout=1.0, auto_close=True, pass_fds=(), encoding=None): """ Run a subprocess in the background and collect its output and exit status. @@ -1288,7 +1336,11 @@ :param timeout: Time duration (in seconds) to wait for the subprocess to terminate before returning :param auto_close: If True, close() the instance automatically when its - reference count drops to zero (default False). + reference count drops to zero (default False). + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) :return: A Expect object. """ @@ -1296,7 +1348,9 @@ termination_func=termination_func, output_func=output_func, output_prefix=output_prefix, - auto_close=auto_close) + auto_close=auto_close, + pass_fds=pass_fds, + encoding=encoding) end_time = time.time() + timeout while time.time() < end_time and bg_process.is_alive(): @@ -1306,7 +1360,7 @@ def run_bg(command, termination_func=None, output_func=None, output_prefix="", - timeout=1.0, auto_close=True): + timeout=1.0, auto_close=True, pass_fds=(), encoding=None): """ Run a subprocess in the background and collect its output and exit status. @@ -1325,7 +1379,11 @@ :param timeout: Time duration (in seconds) to wait for the subprocess to terminate before returning :param auto_close: If True, close() the instance automatically when its - reference count drops to zero (default False). + reference count drops to zero (default False). + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) :return: A Expect object. """ @@ -1333,7 +1391,9 @@ termination_func=termination_func, output_func=output_func, output_prefix=output_prefix, - auto_close=auto_close) + auto_close=auto_close, + pass_fds=pass_fds, + encoding=encoding) end_time = time.time() + timeout while time.time() < end_time and bg_process.is_alive(): @@ -1342,7 +1402,8 @@ return bg_process -def run_fg(command, output_func=None, output_prefix="", timeout=1.0): +def run_fg(command, output_func=None, output_prefix="", timeout=1.0, + pass_fds=(), encoding=None): """ Run a subprocess in the foreground and collect its output and exit status. @@ -1358,12 +1419,17 @@ before passing it to stdout_func :param timeout: Time duration (in seconds) to wait for the subprocess to terminate before killing it and returning + :param pass_fds: Optional sequence of file descriptors to keep open + between the parent and child. + :param encoding: Override text encoding (by default: autodetect by + locale.getpreferredencoding()) :return: A 2-tuple containing the exit status of the process and its STDOUT/STDERR output. If timeout expires before the process terminates, the returned status is None. """ - bg_process = run_bg(command, None, output_func, output_prefix, timeout) + bg_process = run_bg(command, None, output_func, output_prefix, timeout, + pass_fds=pass_fds, encoding=encoding) output = bg_process.get_output() if bg_process.is_alive(): status = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/exceptions.py new/aexpect-1.5.1/aexpect/exceptions.py --- old/aexpect-1.4.0/aexpect/exceptions.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/exceptions.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,15 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + + class ExpectError(Exception): def __init__(self, patterns, output): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/shared.py new/aexpect-1.5.1/aexpect/shared.py --- old/aexpect-1.4.0/aexpect/shared.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/shared.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import os import fcntl import termios diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/astring.py new/aexpect-1.5.1/aexpect/utils/astring.py --- old/aexpect-1.4.0/aexpect/utils/astring.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/astring.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import re @@ -22,8 +33,8 @@ return_str = "" index = 0 output = "\x1b[m%s" % output - console_codes = "%[G@8]|\[[@A-HJ-MPXa-hl-nqrsu\`]" - console_codes += "|\[[\d;]+[HJKgqnrm]|#8|\([B0UK]|\)" + console_codes = "%[G@8]|\\[[@A-HJ-MPXa-hl-nqrsu\\`]" + console_codes += "|\\[[\\d;]+[HJKgqnrm]|#8|\\([B0UK]|\\)" if custom_codes is not None and custom_codes not in console_codes: console_codes += "|%s" % custom_codes while index < len(output): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/data_factory.py new/aexpect-1.5.1/aexpect/utils/data_factory.py --- old/aexpect-1.4.0/aexpect/utils/data_factory.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/data_factory.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import random import string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/genio.py new/aexpect-1.5.1/aexpect/utils/genio.py --- old/aexpect-1.4.0/aexpect/utils/genio.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/genio.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import os _open_log_files = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/path.py new/aexpect-1.5.1/aexpect/utils/path.py --- old/aexpect-1.4.0/aexpect/utils/path.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/path.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import os @@ -30,13 +41,15 @@ :raise: :class:`aexpect.utils.path.CmdNotFoundError` in case the command was not found and no default was given. """ - common_bin_paths = ["/usr/libexec", "/usr/local/sbin", "/usr/local/bin", - "/usr/sbin", "/usr/bin", "/sbin", "/bin"] try: path_paths = os.environ['PATH'].split(":") except IndexError: path_paths = [] - path_paths = list(set(common_bin_paths + path_paths)) + + for common_path in ["/usr/libexec", "/usr/local/sbin", "/usr/local/bin", + "/usr/sbin", "/usr/bin", "/sbin", "/bin"]: + if common_path not in path_paths: + path_paths.append(common_path) for dir_path in path_paths: cmd_path = os.path.join(dir_path, cmd) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/process.py new/aexpect-1.5.1/aexpect/utils/process.py --- old/aexpect-1.4.0/aexpect/utils/process.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/process.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import subprocess import signal import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/aexpect/utils/wait.py new/aexpect-1.5.1/aexpect/utils/wait.py --- old/aexpect-1.4.0/aexpect/utils/wait.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/aexpect/utils/wait.py 2018-06-13 17:19:29.000000000 +0200 @@ -1,3 +1,14 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import time import logging log = logging.getLogger(__file__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/python-aexpect.spec new/aexpect-1.5.1/python-aexpect.spec --- old/aexpect-1.4.0/python-aexpect.spec 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/python-aexpect.spec 2018-06-13 17:19:29.000000000 +0200 @@ -1,46 +1,154 @@ %global srcname aexpect -Summary: Aexpect is a python library to control interactive applications +# Conditional for release vs. snapshot builds. Set to 1 for release build. +%if ! 0%{?rel_build:1} + %global rel_build 1 +%endif + +# Settings used for build from snapshots. +%if 0%{?rel_build} +%global gittar %{srcname}-%{version}.tar.gz +%else +%if ! 0%{?commit:1} +%global commit 012bc0e57fc9d05d2ee4ca2425dc27b07b745a32 +%endif +%if ! 0%{?commit_date:1} +%global commit_date 20180613 +%endif +%global shortcommit %(c=%{commit};echo ${c:0:7}) +%global gitrel .%{commit_date}git%{shortcommit} +%global gittar %{srcname}-%{shortcommit}.tar.gz +%endif + +# Selftests are provided but skipped because they use unsupported tooling. +%global with_tests 0 + +%if 0%{?rhel} +%global with_python3 0 +%else +%global with_python3 1 +%endif + Name: python-%{srcname} -Version: 1.4.0 -Release: 1%{?dist} -License: GPLv2 +Version: 1.5.1 +Release: 0%{?gitrel}%{?dist} +Summary: Aexpect is a python library to control interactive applications Group: Development/Tools -URL: http://avocado-framework.readthedocs.org/ -Source: %{srcname}-%{version}.tar.gz + +License: GPLv2 +URL: https://github.com/avocado-framework/aexpect + +%if 0%{?rel_build} +Source0: https://github.com/avocado-framework/%{srcname}/archive/%{version}.tar.gz#/%{gittar} +%else +Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}.tar.gz#/%{gittar} +%endif + BuildArch: noarch Requires: python -BuildRequires: python, python-setuptools +BuildRequires: python2-devel +BuildRequires: python-subprocess32 -# For compatibility reasons, let's mark this package as one that -# provides the same functionality as the old package name and also -# one that obsoletes the old package name, so that the new name is -# favored. These could (and should) be removed in the future. -# These changes are backed by the following guidelines: -# https://fedoraproject.org/wiki/Upgrade_paths_%E2%80%94_renaming_or_splitting_packages -Obsoletes: %{srcname} < 1.3.1-1 -Provides: %{srcname} = %{version}-%{release} +%if %{with_python3} +Requires: python3 +BuildRequires: python3-devel +%endif + +%if 0%{?rhel} +BuildRequires: python-setuptools +%endif %description Aexpect is a python library used to control interactive applications, very similar to pexpect. You can use it to control applications such as ssh, scp sftp, telnet, among others. +%package -n python2-%{srcname} +Summary: %{summary} +Requires: python-subprocess32 +%{?python_provide:%python_provide python2-%{srcname}} + +%description -n python2-%{srcname} +Aexpect is a python library used to control interactive applications, very +similar to pexpect. You can use it to control applications such as ssh, scp +sftp, telnet, among others. + +%if %{with_python3} +%package -n python%{python3_pkgversion}-%{srcname} +Summary: %{summary} +%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} + +%description -n python%{python3_pkgversion}-%{srcname} +Aexpect is a python library used to control interactive applications, very +similar to pexpect. You can use it to control applications such as ssh, scp +sftp, telnet, among others. +PYTHON 3 SUPPORT IS CURRENTLY EXPERIMENTAL +%endif + %prep -%setup -q -n %{srcname}-%{version} +%if 0%{?rel_build} +%autosetup -n %{srcname}-%{version} +%else +%autosetup -n %{srcname}-%{commit} +%endif %build -%{__python} setup.py build +%py2_build -%install -%{__python} setup.py install --root %{buildroot} --skip-build +%if %{with_python3} +%py3_build +%endif -%files -%defattr(-,root,root,-) -%{python_sitelib}/aexpect* -%{_bindir}/aexpect-helper +%install +%py2_install +# move and symlink python2 version-specific executables +mv %{buildroot}%{_bindir}/aexpect-helper %{buildroot}%{_bindir}/aexpect-helper-%{python2_version} +ln -s aexpect-helper-%{python2_version} %{buildroot}%{_bindir}/aexpect-helper-2 + +%if %{with_python3} +%py3_install +mv %{buildroot}%{_bindir}/aexpect-helper %{buildroot}%{_bindir}/aexpect-helper-%{python3_version} +ln -s aexpect-helper-%{python3_version} %{buildroot}%{_bindir}/aexpect-helper-3 +%endif + +%check +%if %{with_tests} +selftests/checkall +%endif + +%files -n python2-%{srcname} +%license LICENSE +%doc README.rst +%{python2_sitelib}/aexpect/ +%{python2_sitelib}/aexpect-%{version}-py%{python2_version}.egg-info +%{_bindir}/aexpect-helper-2* + +%if %{with_python3} +%files -n python%{python3_pkgversion}-%{srcname} +%license LICENSE +%doc README.rst +%{python3_sitelib}/aexpect/ +%{python3_sitelib}/aexpect-%{version}-py%{python3_version}.egg-info +%{_bindir}/aexpect-helper-3* +%endif %changelog +* Wed Jun 13 2018 Cleber Rosa <cle...@redhat.com> - 1.5.1-0 +- Upgrade to upstream version 1.5.1 + +* Mon Jun 4 2018 Lucas Meneghel Rodrigues <look...@gmail.com> - 1.5.0-1 +- Upgrade to upstream version 1.5.0 + +* Wed Mar 14 2018 Cleber Rosa <cle...@redhat.com> - 1.4.0-2 +- Changed URL to aexpect repo +- Changed build to use a git archived based source +- Added released version builds +- Remove compatiblity with older package name +- Reordered tags +- Added conditional for check target +- Only require python-setuptools on RHEL +- Added rules for also building Python 3 packages + * Mon Apr 3 2017 Lucas Meneghel Rodrigues <look...@gmail.com> - 1.4.0-1 - Upgrade to upstream version 1.4.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/requirements-travis.txt new/aexpect-1.5.1/requirements-travis.txt --- old/aexpect-1.4.0/requirements-travis.txt 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/requirements-travis.txt 2018-06-13 17:19:29.000000000 +0200 @@ -1 +1,2 @@ -inspektor==0.2.2 +pycodestyle==2.4.0 +inspektor==0.4.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/scripts/aexpect-helper new/aexpect-1.5.1/scripts/aexpect-helper --- old/aexpect-1.4.0/scripts/aexpect-helper 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/scripts/aexpect-helper 2018-06-13 17:19:29.000000000 +0200 @@ -1,4 +1,16 @@ -#!/usr/bin/python +#!/usr/bin/env python + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. + import os import sys @@ -87,7 +99,7 @@ makestandard(shell_fd, echo) server_log.info('Opening output file %s' % output_filename) - output_file = open(output_filename, "w") + output_file = open(output_filename, "wb") server_log.info('Opening input pipe %s' % inpipe_filename) os.mkfifo(inpipe_filename) inpipe_fd = os.open(inpipe_filename, os.O_RDWR) @@ -112,7 +124,7 @@ sys.stdout.flush() # Initialize buffers - buffers = ["" for reader in readers] + buffers = [b"" for reader in readers] # Read from child and write to files/pipes server_log.info('Entering main read loop') @@ -141,12 +153,12 @@ try: data = os.read(shell_fd, 16384) except OSError: - data = "" + data = b"" if not data: check_termination = True # Remove carriage returns from the data -- they often cause # trouble and are normally not needed - data = data.replace("\r", "") + data = data.replace(b"\r", b"") output_file.write(data) output_file.flush() for i in range(len(readers)): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/selftests/checkall new/aexpect-1.5.1/selftests/checkall --- old/aexpect-1.4.0/selftests/checkall 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/selftests/checkall 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -#!/bin/bash -GR=0 -run_rc() { - echo "Running '$1'" - $1 - if [ $? != 0 ]; then - GR=1 - fi - echo "" -} -run_rc 'inspekt lint' -run_rc 'inspekt indent' -run_rc 'inspekt style' -exit ${GR} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/setup.py new/aexpect-1.5.1/setup.py --- old/aexpect-1.4.0/setup.py 2017-04-03 16:26:42.000000000 +0200 +++ new/aexpect-1.5.1/setup.py 2018-06-13 17:19:29.000000000 +0200 @@ -13,45 +13,19 @@ # Copyright: Red Hat Inc. 2013-2015 # Author: Lucas Meneghel Rodrigues <l...@redhat.com> -import os +import sys # pylint: disable=E0611 from setuptools import setup -VIRTUAL_ENV = 'VIRTUAL_ENV' in os.environ - - -def get_dir(system_path=None, virtual_path=None): - """ - Retrieve VIRTUAL_ENV friendly path - :param system_path: Relative system path - :param virtual_path: Overrides system_path for virtual_env only - :return: VIRTUAL_ENV friendly path - """ - if virtual_path is None: - virtual_path = system_path - if VIRTUAL_ENV: - if virtual_path is None: - virtual_path = [] - return os.path.join(*virtual_path) - else: - if system_path is None: - system_path = [] - return os.path.join(*(['/'] + system_path)) - - -def get_avocado_libexec_dir(): - if VIRTUAL_ENV: - return get_dir(['libexec']) - elif os.path.exists('/usr/libexec'): # RHEL-like distro - return get_dir(['usr', 'libexec', 'avocado']) - else: # Debian-like distro - return get_dir(['usr', 'lib', 'avocado']) - if __name__ == '__main__': + if sys.version_info[0] == 2: + REQUIREMENTS = ['subprocess32>=3.2.6'] + else: + REQUIREMENTS = [] setup(name='aexpect', - version='1.4.0', + version='1.5.1', description='Aexpect', author='Aexpect developers', author_email='avocado-de...@redhat.com', @@ -59,4 +33,6 @@ packages=['aexpect', 'aexpect.utils'], scripts=['scripts/aexpect-helper'], - use_2to3=True) + use_2to3=True, + install_requires=REQUIREMENTS, + test_suite='tests') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/tests/test_client.py new/aexpect-1.5.1/tests/test_client.py --- old/aexpect-1.4.0/tests/test_client.py 1970-01-01 01:00:00.000000000 +0100 +++ new/aexpect-1.5.1/tests/test_client.py 2018-06-13 17:19:29.000000000 +0200 @@ -0,0 +1,37 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. +# +# Copyright: Red Hat Inc. 2018 +# Author: Cleber Rosa <cr...@redhat.com> + +import random +import string +import sys +import unittest + +from aexpect import client + + +class ClientTest(unittest.TestCase): + + def test_client_spawn(self): + """ + Tests the basic spawning of an interactive process + """ + key = "".join([random.choice(string.ascii_uppercase) + for _ in range(10)]) + python = client.Spawn(sys.executable) + self.assertTrue(python.is_alive()) + python.sendline("print('%s')" % key) + python.sendline("quit()") + self.assertEqual(python.get_status(), 0) + self.assertIn(key, python.get_output()) + self.assertFalse(python.is_alive()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aexpect-1.4.0/tests/test_pass_fds.py new/aexpect-1.5.1/tests/test_pass_fds.py --- old/aexpect-1.4.0/tests/test_pass_fds.py 1970-01-01 01:00:00.000000000 +0100 +++ new/aexpect-1.5.1/tests/test_pass_fds.py 2018-06-13 17:19:29.000000000 +0200 @@ -0,0 +1,49 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. +# +# Copyright: Red Hat Inc. 2018 +# Author: Xu Han <xu...@redhat.com> + +import os +import unittest + +from aexpect import client + + +LIST_FD_CMD = ('''python -c "import os; os.system('ls -l /proc/%d/fd' % ''' + '''os.getpid())"''') + + +class PassfdsTest(unittest.TestCase): + + @unittest.skipUnless(os.path.exists('/proc/1/fd'), "requires Linux") + def test_pass_fds_spawn(self): + """ + Tests fd passing for `client.Spawn` + """ + with open(os.devnull, "r") as devnull: + fd = devnull.fileno() + + child = client.Spawn(LIST_FD_CMD) + self.assertFalse(bool(child.get_status()), + "child terminated abnormally") + self.assertFalse(os.devnull in child.get_output()) + child.close() + + child = client.Spawn(LIST_FD_CMD, pass_fds=[fd]) + self.assertFalse(bool(child.get_status()), + "child terminated abnormally") + self.assertTrue(os.devnull in child.get_output()) + child.close() + + +if __name__ == '__main__': + unittest.main()