Hello community,
here is the log from the commit of package python-EasyProcess for
openSUSE:Factory checked in at 2013-02-17 17:12:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-EasyProcess (Old)
and /work/SRC/openSUSE:Factory/.python-EasyProcess.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-EasyProcess", Maintainer is ""
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-EasyProcess/python-EasyProcess.changes
2013-01-12 07:56:26.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python-EasyProcess.new/python-EasyProcess.changes
2013-02-17 17:12:32.000000000 +0100
@@ -1,0 +2,6 @@
+Sat Feb 16 14:52:19 UTC 2013 - [email protected]
+
+- Update to version 0.1.5:
+ * No changelog available
+
+-------------------------------------------------------------------
--- /work/SRC/openSUSE:Factory/python-EasyProcess/python3-EasyProcess.changes
2013-01-12 07:56:26.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python-EasyProcess.new/python3-EasyProcess.changes
2013-02-17 17:12:32.000000000 +0100
@@ -1,0 +2,12 @@
+Sat Feb 16 14:52:19 UTC 2013 - [email protected]
+
+- Update to version 0.1.5:
+ * No changelog available
+- Remove the depreciated "BuildRoot" entry
+
+-------------------------------------------------------------------
+Mon Jan 14 08:43:59 UTC 2013 - [email protected]
+
+- Drop requires on "python(abi)", RPM does that automatically
+
+-------------------------------------------------------------------
Old:
----
EasyProcess-0.1.4.tar.gz
New:
----
EasyProcess-0.1.5.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-EasyProcess.spec ++++++
--- /var/tmp/diff_new_pack.x4Zz41/_old 2013-02-17 17:12:33.000000000 +0100
+++ /var/tmp/diff_new_pack.x4Zz41/_new 2013-02-17 17:12:33.000000000 +0100
@@ -15,17 +15,18 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
+
Name: python-EasyProcess
-Version: 0.1.4
+Version: 0.1.5
Release: 0
Url: https://github.com/ponty/easyprocess
Summary: Easy to use python subprocess interface
License: BSD-2-Clause
Group: Development/Languages/Python
Source:
http://pypi.python.org/packages/source/E/EasyProcess/EasyProcess-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: python-distribute
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from
distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
++++++ python3-EasyProcess.spec ++++++
--- /var/tmp/diff_new_pack.x4Zz41/_old 2013-02-17 17:12:33.000000000 +0100
+++ /var/tmp/diff_new_pack.x4Zz41/_new 2013-02-17 17:12:33.000000000 +0100
@@ -15,20 +15,19 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
+
Name: python3-EasyProcess
-Version: 0.1.4
+Version: 0.1.5
Release: 0
Url: https://github.com/ponty/easyprocess
Summary: Easy to use python subprocess interface
License: BSD-2-Clause
Group: Development/Languages/Python
Source:
http://pypi.python.org/packages/source/E/EasyProcess/EasyProcess-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python3
BuildRequires: python3-2to3
BuildRequires: python3-devel
BuildRequires: python3-distribute
-Requires: python(abi) = %{py3_ver}
BuildArch: noarch
%description
++++++ EasyProcess-0.1.4.tar.gz -> EasyProcess-0.1.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/EasyProcess.egg-info/PKG-INFO
new/EasyProcess-0.1.5/EasyProcess.egg-info/PKG-INFO
--- old/EasyProcess-0.1.4/EasyProcess.egg-info/PKG-INFO 2012-03-09
12:13:34.000000000 +0100
+++ new/EasyProcess-0.1.5/EasyProcess.egg-info/PKG-INFO 2013-02-16
11:04:00.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: EasyProcess
-Version: 0.1.4
+Version: 0.1.5
Summary: Easy to use python subprocess interface.
Home-page: https://github.com/ponty/easyprocess
Author: ponty
@@ -36,6 +36,9 @@
* execute (http://pypi.python.org/pypi/execute)
* commandwrapper (http://pypi.python.org/pypi/commandwrapper)
* extcmd (http://pypi.python.org/pypi/extcmd)
+ * sh (https://github.com/amoffat/sh)
+ * envoy (https://github.com/kennethreitz/envoy)
+ * plumbum (https://github.com/tomerfiliba/plumbum)
Basic usage
============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/EasyProcess.egg-info/SOURCES.txt
new/EasyProcess-0.1.5/EasyProcess.egg-info/SOURCES.txt
--- old/EasyProcess-0.1.4/EasyProcess.egg-info/SOURCES.txt 2012-03-09
12:13:35.000000000 +0100
+++ new/EasyProcess-0.1.5/EasyProcess.egg-info/SOURCES.txt 2013-02-16
11:04:00.000000000 +0100
@@ -13,6 +13,7 @@
docs/api.rst
docs/conf.py
docs/index.rst
+docs/links.rst
docs/readme.rst
docs/usage.rst
easyprocess/__init__.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/MANIFEST.in
new/EasyProcess-0.1.5/MANIFEST.in
--- old/EasyProcess-0.1.4/MANIFEST.in 2012-03-09 12:13:34.000000000 +0100
+++ new/EasyProcess-0.1.5/MANIFEST.in 2013-02-16 11:04:00.000000000 +0100
@@ -1,7 +1,6 @@
-grant docs
+graft docs
include LICENSE*
include pavement.py
-include paver-minilib.zip
include TODO*
include requirements.txt
include CHANGES*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/PKG-INFO
new/EasyProcess-0.1.5/PKG-INFO
--- old/EasyProcess-0.1.4/PKG-INFO 2012-03-09 12:13:35.000000000 +0100
+++ new/EasyProcess-0.1.5/PKG-INFO 2013-02-16 11:04:01.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: EasyProcess
-Version: 0.1.4
+Version: 0.1.5
Summary: Easy to use python subprocess interface.
Home-page: https://github.com/ponty/easyprocess
Author: ponty
@@ -36,6 +36,9 @@
* execute (http://pypi.python.org/pypi/execute)
* commandwrapper (http://pypi.python.org/pypi/commandwrapper)
* extcmd (http://pypi.python.org/pypi/extcmd)
+ * sh (https://github.com/amoffat/sh)
+ * envoy (https://github.com/kennethreitz/envoy)
+ * plumbum (https://github.com/tomerfiliba/plumbum)
Basic usage
============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/README.rst
new/EasyProcess-0.1.5/README.rst
--- old/EasyProcess-0.1.4/README.rst 2012-03-09 10:55:17.000000000 +0100
+++ new/EasyProcess-0.1.5/README.rst 2012-12-05 09:22:29.000000000 +0100
@@ -28,6 +28,9 @@
* execute (http://pypi.python.org/pypi/execute)
* commandwrapper (http://pypi.python.org/pypi/commandwrapper)
* extcmd (http://pypi.python.org/pypi/extcmd)
+ * sh (https://github.com/amoffat/sh)
+ * envoy (https://github.com/kennethreitz/envoy)
+ * plumbum (https://github.com/tomerfiliba/plumbum)
Basic usage
============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/docs/conf.py
new/EasyProcess-0.1.5/docs/conf.py
--- old/EasyProcess-0.1.4/docs/conf.py 2012-01-21 20:12:43.000000000 +0100
+++ new/EasyProcess-0.1.5/docs/conf.py 2012-12-03 13:11:09.000000000 +0100
@@ -4,7 +4,8 @@
import sys
from setuptools import find_packages
-def read_project_version(py=None, where='.', exclude=['bootstrap', 'pavement',
'doc', 'docs', 'test', 'tests',]):
+
+def read_project_version(py=None, where='.', exclude=['bootstrap', 'pavement',
'doc', 'docs', 'test', 'tests', ]):
if not py:
py = path(where) / find_packages(where=where, exclude=exclude)[0]
py = path(py)
@@ -19,25 +20,25 @@
release = read_project_version(where='..')
-project='EasyProcess'
-author='ponty'
+project = 'EasyProcess'
+author = 'ponty'
copyright = '2011, ponty'
-#logging.basicConfig(level=logging.DEBUG)
+# logging.basicConfig(level=logging.DEBUG)
# Extension
extensions = [
- # -*-Extensions: -*-
- 'sphinx.ext.autodoc',
- 'sphinxcontrib.programoutput',
-# 'sphinxcontrib.programscreenshot',
- 'sphinx.ext.graphviz',
- 'sphinxcontrib.autorun',
- #'sphinx.ext.autosummary',
- 'sphinx.ext.intersphinx',
- ]
-intersphinx_mapping = {'python': ('http://docs.python.org/', None)}
-#intersphinx_mapping = {'http://docs.python.org/': None}
+ # -*-Extensions: -*-
+ 'sphinx.ext.autodoc',
+ 'sphinxcontrib.programoutput',
+ # 'sphinxcontrib.programscreenshot',
+ 'sphinx.ext.graphviz',
+ 'sphinxcontrib.autorun',
+ #'sphinx.ext.autosummary',
+ 'sphinx.ext.intersphinx',
+]
+intersphinx_mapping = {'python': ('http://docs.python.org/', None)}
+# intersphinx_mapping = {'http://docs.python.org/': None}
# Source
master_doc = 'index'
@@ -56,15 +57,14 @@
# latex build settings
latex_documents = [
('index', '%s.tex' % project, u'%s Documentation' % project,
- author, 'manual'),
+ author, 'manual'),
]
# remove blank pages from pdf
-#
http://groups.google.com/group/sphinx-dev/browse_thread/thread/92e19267d095412d/d60dcba483c6b13d
-latex_font_size = '10pt,oneside'
-
-latex_elements=dict(
- papersize='a4paper',
- )
-
-
+# http://groups.google.com/group/sphinx-
+# dev/browse_thread/thread/92e19267d095412d/d60dcba483c6b13d
+latex_font_size = '10pt,oneside'
+
+latex_elements = dict(
+ papersize='a4paper',
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/docs/links.rst
new/EasyProcess-0.1.5/docs/links.rst
--- old/EasyProcess-0.1.4/docs/links.rst 1970-01-01 01:00:00.000000000
+0100
+++ new/EasyProcess-0.1.5/docs/links.rst 2011-05-16 16:14:01.000000000
+0200
@@ -0,0 +1,18 @@
+.. _scons: http://www.scons.org
+.. _sphinx: http://sphinx.pocoo.org
+.. _github: https://github.com/
+.. _paver: http://paver.github.com/paver/
+.. _setuptools: http://peak.telecommunity.com/DevCenter/EasyInstall
+.. _pip: http://pip.openplans.org/
+.. _nose: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/
+.. _ghp-import: https://github.com/davisp/ghp-import
+.. _pyflakes: http://pypi.python.org/pypi/pyflakes
+.. _pychecker: http://pychecker.sourceforge.net/
+.. _pypi: http://pypi.python.org/pypi
+.. _`paved fork`: https://github.com/ponty/paved
+.. _sphinx-contrib: https://bitbucket.org/birkenfeld/sphinx-contrib/
+.. _sphinxcontrib-programscreenshot:
https://github.com/ponty/sphinxcontrib-programscreenshot
+.. _sphinxcontrib-programoutput:
http://packages.python.org/sphinxcontrib-programoutput/
+.. _sphinxcontrib-paverutils:
http://pypi.python.org/pypi/sphinxcontrib-paverutils
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/easyprocess/__init__.py
new/EasyProcess-0.1.5/easyprocess/__init__.py
--- old/EasyProcess-0.1.4/easyprocess/__init__.py 2012-03-09
11:01:55.000000000 +0100
+++ new/EasyProcess-0.1.5/easyprocess/__init__.py 2013-02-16
10:57:20.000000000 +0100
@@ -3,7 +3,6 @@
'''
from easyprocess.unicodeutil import split_command, unidecode, uniencode
-import atexit
import logging
import os.path
import platform
@@ -15,10 +14,10 @@
import time
import ConfigParser
-__version__ = '0.1.4'
+__version__ = '0.1.5'
log = logging.getLogger(__name__)
-#log=logging
+# log=logging
log.debug('version=' + __version__)
@@ -26,28 +25,33 @@
SECTION_LINK = 'link'
POLL_TIME = 0.1
USE_POLL = 0
-
+
+
class EasyProcessError(Exception):
- """
+ """
"""
def __init__(self, easy_process, msg=''):
self.easy_process = easy_process
self.msg = msg
+
def __str__(self):
return self.msg + ' ' + repr(self.easy_process)
-
+
template = '''cmd=%s
-OSError=%s
+OSError=%s
Program install error! '''
+
+
class EasyProcessCheckInstalledError(Exception):
"""This exception is raised when a process run by check() returns
- a non-zero exit status or OSError is raised.
+ a non-zero exit status or OSError is raised.
"""
def __init__(self, easy_process):
self.easy_process = easy_process
+
def __str__(self):
- msg = template% (self.easy_process.cmd,
- self.easy_process.oserror,
+ msg = template % (self.easy_process.cmd,
+ self.easy_process.oserror,
)
if self.easy_process.url:
msg += '\nhome page: ' + self.easy_process.url
@@ -57,29 +61,30 @@
msg += 'sudo apt-get install %s' %
self.easy_process.ubuntu_package
return msg
+
class EasyProcess():
'''
.. module:: easyprocess
-
- simple interface for :mod:`subprocess`
+
+ simple interface for :mod:`subprocess`
shell is not supported (shell=False)
-
+
.. warning::
- unicode is supported only for string list command (Python2.x)
+ unicode is supported only for string list command (Python2.x)
(check :mod:`shlex` for more information)
-
- :param cmd: string ('ls -l') or list of strings (['ls','-l'])
+
+ :param cmd: string ('ls -l') or list of strings (['ls','-l'])
:param cwd: working directory
- :param use_temp_files: use temp files instead of pipes for
+ :param use_temp_files: use temp files instead of pipes for
stdout and stderr,
pipes can cause deadlock in some cases
(see unit tests)
'''
config = None
-
- def __init__(self, cmd, ubuntu_package=None, url=None, cwd=None,
use_temp_files=True):
+
+ def __init__(self, cmd, ubuntu_package=None, url=None, cwd=None,
use_temp_files=False):
self.use_temp_files = use_temp_files
self._outputs_processed = False
@@ -100,19 +105,20 @@
self.cwd = cwd
cmd = split_command(cmd)
self.cmd = cmd
- self.cmd_as_string = ' '.join(self.cmd) # TODO: not perfect
-
- log.debug('param: "%s" command: %s ("%s")' % (self.cmd_param,
self.cmd, self.cmd_as_string))
-
+ self.cmd_as_string = ' '.join(self.cmd) # TODO: not perfect
+
+ log.debug('param: "%s" command: %s ("%s")' % (
+ self.cmd_param, self.cmd, self.cmd_as_string))
+
if not len(cmd):
raise EasyProcessError(self, 'empty command!')
-
+
if not Proc.config:
conf_file = os.path.join(os.path.expanduser('~'), CONFIG_FILE)
log.debug('reading config: %s' % (conf_file))
Proc.config = ConfigParser.RawConfigParser()
Proc.config.read(conf_file)
-
+
self.alias = None
try:
self.alias = Proc.config.get(SECTION_LINK, self.cmd[0])
@@ -120,26 +126,26 @@
pass
except ConfigParser.NoOptionError:
pass
-
+
if self.alias:
log.debug('alias found: %s' % (self.alias))
self.cmd[0] = self.alias
def __repr__(self):
- msg = '<%s cmd_param=%s alias={alias} cmd=%s ({scmd}) oserror=%s
returncode=%s stdout="%s" stderr="%s" timeout=%s>'% (
- self.__class__.__name__,
- self.cmd_param,
- self.cmd,
- self.oserror,
-# alias=self.alias,
- self.return_code,
- self.stdout,
- self.stderr,
-# scmd=' '.join(self.cmd),
- self.timeout_happened,
- )
+ msg = '<%s cmd_param=%s alias={alias} cmd=%s ({scmd}) oserror=%s
returncode=%s stdout="%s" stderr="%s" timeout=%s>' % (
+ self.__class__.__name__,
+ self.cmd_param,
+ self.cmd,
+ self.oserror,
+ # alias=self.alias,
+ self.return_code,
+ self.stdout,
+ self.stderr,
+ # scmd=' '.join(self.cmd),
+ self.timeout_happened,
+ )
return msg
-
+
@property
def pid(self):
'''
@@ -149,7 +155,7 @@
'''
if self.popen:
return self.popen.pid
-
+
@property
def return_code(self):
'''
@@ -163,9 +169,9 @@
def check(self, return_code=0):
'''
Run command with arguments. Wait for command to complete.
- If the exit code was as expected and there is no exception then
return,
+ If the exit code was as expected and there is no exception then return,
otherwise raise EasyProcessError.
-
+
:param return_code: int, expected return code
:rtype: self
'''
@@ -180,37 +186,38 @@
ret = self.call().return_code
ok = ret == return_code
if not ok:
- raise EasyProcessError(self, 'check error, return code is not
zero!')
+ raise EasyProcessError(
+ self, 'check error, return code is not zero!')
return self
def check_installed(self):
'''
Used for testing if program is installed.
-
+
Run command with arguments. Wait for command to complete.
If OSError raised, then raise :class:`EasyProcessCheckInstalledError`
with information about program installation
-
+
:param return_code: int, expected return code
:rtype: self
'''
try:
self.call()
except Exception:
- #log.debug('exception:' + str(e))
- #self.oserror = oserror
+ # log.debug('exception:' + str(e))
+ # self.oserror = oserror
raise EasyProcessCheckInstalledError(self)
return self
-
+
def call(self, timeout=None):
'''
Run command with arguments. Wait for command to complete.
-
+
same as:
1. :meth:`start`
2. :meth:`wait`
3. :meth:`stop`
-
+
:rtype: self
'''
self.start().wait(timeout=timeout)
@@ -221,8 +228,8 @@
def start(self):
'''
start command in background and does not wait for it
-
-
+
+
:rtype: self
'''
if self.is_started:
@@ -233,21 +240,21 @@
self._stderr_file = tempfile.TemporaryFile(prefix='stderr_')
stdout = self._stdout_file
stderr = self._stderr_file
-
+
else:
stdout = subprocess.PIPE
stderr = subprocess.PIPE
cmd = list(map(uniencode, self.cmd))
-
- try:
+
+ try:
self.popen = subprocess.Popen(cmd,
- stdout=stdout,
- stderr=stderr,
- #shell=1,
- cwd=self.cwd,
- )
- except OSError , oserror:
+ stdout=stdout,
+ stderr=stderr,
+ # shell=1,
+ cwd=self.cwd,
+ )
+ except OSError, oserror:
log.debug('OSError exception:%s' % (oserror))
self.oserror = oserror
raise EasyProcessError(self, 'start error')
@@ -256,47 +263,46 @@
# def target():
# self._wait4process()
-
+
# def shutdown():
# self._stop_thread = True
# self._thread.join()
-
+
# self._thread = threading.Thread(target=target)
# self._thread.daemon = 1
# self._thread.start()
# atexit.register(shutdown)
-
- return self
+ return self
def is_alive(self):
'''
poll process using :meth:`subprocess.Popen.poll`
-
+
:rtype: bool
'''
if self.popen:
return self.popen.poll() is None
else:
return False
-
+
def wait(self, timeout=None):
'''
Wait for command to complete.
-
+
Timeout:
- discussion:
http://stackoverflow.com/questions/1191374/subprocess-with-timeout
- implementation: threading
-
+
:rtype: self
'''
-
+
if timeout is not None:
if not self._thread:
self._thread = threading.Thread(target=self._wait4process)
self._thread.daemon = 1
self._thread.start()
-
+
if self._thread:
self._thread.join(timeout=timeout)
self.timeout_happened = self.timeout_happened or
self._thread.isAlive()
@@ -305,7 +311,7 @@
self._wait4process()
return self
-
+
def _wait4process(self):
if self._outputs_processed:
return
@@ -315,10 +321,10 @@
return s[:-1]
else:
return s
-
+
if self.popen:
- if self.use_temp_files:
- if USE_POLL:
+ if self.use_temp_files:
+ if USE_POLL:
while 1:
if self.popen.poll() is not None:
break
@@ -329,31 +335,31 @@
else:
# wait() blocks process, timeout not possible
self.popen.wait()
-
+
self._outputs_processed = True
- self._stdout_file.seek(0)
- self._stderr_file.seek(0)
+ self._stdout_file.seek(0)
+ self._stderr_file.seek(0)
self.stdout = self._stdout_file.read()
self.stderr = self._stderr_file.read()
-
+
self._stdout_file.close()
self._stderr_file.close()
else:
- # This will deadlock when using stdout=PIPE and/or stderr=PIPE
- # and the child process generates enough output to a pipe such
- # that it blocks waiting for the OS pipe buffer to accept more
data.
+ # This will deadlock when using stdout=PIPE and/or stderr=PIPE
+ # and the child process generates enough output to a pipe such
+ # that it blocks waiting for the OS pipe buffer to accept more
data.
# Use communicate() to avoid that.
- #self.popen.wait()
- #self.stdout = self.popen.stdout.read()
- #self.stderr = self.popen.stderr.read()
-
+ # self.popen.wait()
+ # self.stdout = self.popen.stdout.read()
+ # self.stderr = self.popen.stderr.read()
+
# communicate() blocks process, timeout not possible
self._outputs_processed = True
(self.stdout, self.stderr) = self.popen.communicate()
log.debug('process has ended')
self.stdout = remove_ending_lf(unidecode(self.stdout))
self.stderr = remove_ending_lf(unidecode(self.stderr))
-
+
log.debug('return code=' + str(self.return_code))
# def limit_str(s):
# if len(s) > self.max_bytes_to_log:
@@ -362,16 +368,16 @@
# return s
log.debug('stdout=' + (self.stdout))
log.debug('stderr=' + (self.stderr))
-
+
def stop(self):
'''
Kill process
and wait for command to complete.
-
+
same as:
1. :meth:`sendstop`
2. :meth:`wait`
-
+
:rtype: self
'''
return self.sendstop().wait()
@@ -380,13 +386,14 @@
'''
Kill process (:meth:`subprocess.Popen.terminate`).
Do not wait for command to complete.
-
+
:rtype: self
'''
if not self.is_started:
raise EasyProcessError(self, 'process was not started!')
-
- log.debug('stopping process (pid=%s cmd="%s")' % (str(self.pid),
self.cmd))
+
+ log.debug(
+ 'stopping process (pid=%s cmd="%s")' % (str(self.pid), self.cmd))
if self.popen:
if self.is_alive():
log.debug('process is active -> sending SIGTERM')
@@ -396,16 +403,16 @@
self.popen.terminate()
except AttributeError:
os.kill(self.popen.pid, signal.SIGKILL)
- except OSError , oserror:
- log.debug('exception in terminate:%s' %(oserror))
-
+ except OSError, oserror:
+ log.debug('exception in terminate:%s' % (oserror))
+
else:
log.debug('process was already stopped')
else:
log.debug('process was not started')
return self
-
+
def sleep(self, sec):
'''
sleeping (same as :func:`time.sleep`)
@@ -423,36 +430,37 @@
2. call func, save result
3. stop process
4. returns result
-
+
similar to :keyword:`with` statement
-
- :rtype:
+
+ :rtype:
'''
def wrapped():
- self.start()
+ self.start()
if delay:
self.sleep(delay)
x = None
- try:
+ try:
x = func()
- except OSError , oserror:
- log.debug('OSError exception:%s' %(oserror))
+ except OSError, oserror:
+ log.debug('OSError exception:%s' % (oserror))
self.oserror = oserror
raise EasyProcessError(self, 'wrap error!')
finally:
self.stop()
return x
return wrapped
-
+
def __enter__(self):
'''used by the :keyword:`with` statement'''
self.start()
return self
-
+
def __exit__(self, *exc_info):
'''used by the :keyword:`with` statement'''
self.stop()
+
def extract_version(txt):
'''This function tries to extract the version from the help text of any
program.
'''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/easyprocess/examples/ver.py
new/EasyProcess-0.1.5/easyprocess/examples/ver.py
--- old/EasyProcess-0.1.4/easyprocess/examples/ver.py 2012-03-09
07:35:56.000000000 +0100
+++ new/EasyProcess-0.1.5/easyprocess/examples/ver.py 2012-12-03
13:11:12.000000000 +0100
@@ -1,6 +1,5 @@
from easyprocess import EasyProcess
import sys
-v = EasyProcess([sys.executable , '--version']).call().stderr
+v = EasyProcess([sys.executable, '--version']).call().stderr
print('your python version:%s' % v)
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/easyprocess/unicodeutil.py
new/EasyProcess-0.1.5/easyprocess/unicodeutil.py
--- old/EasyProcess-0.1.4/easyprocess/unicodeutil.py 2012-03-08
14:50:11.000000000 +0100
+++ new/EasyProcess-0.1.5/easyprocess/unicodeutil.py 2012-12-03
13:11:12.000000000 +0100
@@ -5,22 +5,24 @@
log = logging.getLogger(__name__)
-PY3 = sys.version_info[0] == 3
+PY3 = sys.version_info[0] >= 3
if PY3:
string_types = str,
else:
string_types = basestring,
+
class EasyProcessUnicodeError(Exception):
pass
+
def split_command(cmd):
'''
- cmd is string list -> nothing to do
- cmd is string -> split it using shlex
- :param cmd: string ('ls -l') or list of strings (['ls','-l'])
+ :param cmd: string ('ls -l') or list of strings (['ls','-l'])
:rtype: string list
'''
if not isinstance(cmd, string_types):
@@ -28,31 +30,35 @@
pass
else:
if not PY3:
- # cmd is string
- # The shlex module currently does not support Unicode input (in
2.x)!
+ # cmd is string
+ # The shlex module currently does not support Unicode input (in
+ # 2.x)!
if isinstance(cmd, unicode):
try:
- cmd = unicodedata.normalize('NFKD', cmd).encode('ascii',
'strict')
+ cmd = unicodedata.normalize(
+ 'NFKD', cmd).encode('ascii', 'strict')
except UnicodeEncodeError:
- raise EasyProcessUnicodeError('unicode command "%s" can
not be processed.' % cmd+
- 'Use string list instead of string')
+ raise EasyProcessUnicodeError('unicode command "%s" can
not be processed.' % cmd +
+ 'Use string list instead of
string')
log.debug('unicode is normalized')
cmd = shlex.split(cmd)
return cmd
+
def uniencode(s):
if PY3:
pass
-# s=s.encode()
+# s=s.encode()
else:
if isinstance(s, unicode):
- s = s.encode('utf-8')
- return s
+ s = s.encode('utf-8')
+ return s
+
def unidecode(s):
if PY3:
- s=s.decode()
+ s = s.decode()
else:
if isinstance(s, str):
- s = s.decode('utf-8')
- return s
+ s = s.decode('utf-8')
+ return s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/pavement.py
new/EasyProcess-0.1.5/pavement.py
--- old/EasyProcess-0.1.4/pavement.py 2012-03-09 11:08:47.000000000 +0100
+++ new/EasyProcess-0.1.5/pavement.py 2012-12-03 13:11:08.000000000 +0100
@@ -1,6 +1,5 @@
from paver.easy import *
from paver.setuputils import setup
-from setuptools import find_packages
import paver.doctools
import paver.misctasks
from paved import *
@@ -10,9 +9,11 @@
from paved.pycheck import *
from paved.pkg import *
from sphinxcontrib import paverutils
+from setuptools import find_packages
# get info from setup.py
-setup_py=''.join([x for x in path('setup.py').lines() if 'setuptools' not in
x])
+setup_py = ''.join(
+ [x for x in path('setup.py').lines() if 'setuptools' not in x])
exec(setup_py)
@@ -20,51 +21,54 @@
sphinx=Bunch(
docroot='docs',
builddir="_build",
- ),
+ ),
pdf=Bunch(
builddir='_build',
builder='latex',
),
- )
+)
-options.paved.clean.rmdirs += ['.tox',
- 'dist',
- 'build' ,
- ]
+options.paved.clean.rmdirs += ['.tox',
+ 'dist',
+ 'build',
+ ]
options.paved.clean.patterns += ['*.pickle',
'*.doctree',
- '*.gz' ,
+ '*.gz',
'nosetests.xml',
'sloccount.sc',
'*.pdf', '*.tex',
'*.png',
'*.zip',
+ 'distribute_setup.py',
]
options.paved.dist.manifest.include.remove('distribute_setup.py')
+options.paved.dist.manifest.include.remove('paver-minilib.zip')
options.paved.dist.manifest.include.add('requirements.txt')
@task
@needs(
-# 'clean',
- 'sloccount',
- 'html',
- 'pdf',
- 'sdist',
- 'nose',
- 'tox',
- )
+ # 'clean',
+ 'sloccount',
+ 'html',
+ 'pdf',
+ 'sdist',
+ 'nose', 'tox',
+)
def alltest():
'all tasks to check'
pass
+
@task
@needs('sphinxcontrib.paverutils.html')
def html():
pass
+
@task
@needs('sphinxcontrib.paverutils.pdf')
def pdf():
@@ -73,14 +77,16 @@
d.makedirs()
fpdf.copy(d)
+
+@task
+def tox():
+ '''Run tox.'''
+ sh('tox')
+
+
@task
@needs('manifest', 'setuptools.command.sdist')
def sdist():
"""Overrides sdist to make sure that our MANIFEST.in is generated.
"""
pass
-
-@task
-def tox():
- '''Run tox.'''
- sh('tox')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/EasyProcess-0.1.4/setup.py
new/EasyProcess-0.1.5/setup.py
--- old/EasyProcess-0.1.4/setup.py 2012-03-09 08:04:47.000000000 +0100
+++ new/EasyProcess-0.1.5/setup.py 2012-12-03 13:11:08.000000000 +0100
@@ -2,8 +2,9 @@
import os.path
import sys
+
def read_project_version(package):
- py = os.path.join(package , '__init__.py')
+ py = os.path.join(package, '__init__.py')
__version__ = None
for line in open(py).read().splitlines():
if '__version__' in line:
@@ -21,29 +22,28 @@
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
-# extra['convert_2to3_doctests'] = ['src/your/module/README.txt']
-# extra['use_2to3_fixers'] = ['your.fixers']
classifiers = [
- # Get more strings from
http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ # Get more strings from
+ # http://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
-# "Programming Language :: Python :: 2.3",
-# "Programming Language :: Python :: 2.4",
+ # "Programming Language :: Python :: 2.3",
+ # "Programming Language :: Python :: 2.4",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
-# "Programming Language :: Python :: 2 :: Only",
+ # "Programming Language :: Python :: 2 :: Only",
"Programming Language :: Python :: 3",
-# "Programming Language :: Python :: 3.0",
+ # "Programming Language :: Python :: 3.0",
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
-# "Programming Language :: Python :: 3.3",
- ]
+ # "Programming Language :: Python :: 3.3",
+]
install_requires = open("requirements.txt").read().split('\n')
@@ -55,7 +55,7 @@
classifiers=classifiers,
keywords='subprocess interface',
author='ponty',
- #author_email='',
+ # author_email='',
url=URL,
license='BSD',
packages=find_packages(exclude=['bootstrap', 'pavement', ]),
@@ -64,6 +64,4 @@
zip_safe=False,
install_requires=install_requires,
**extra
- )
-
-
+)
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]