Commit fa0b988f authored by Chris Lamb's avatar Chris Lamb Committed by Sebastian Ramacher

Imported Debian patch 0.9.1-1

parents bc1dfb83 ebac3bde
Metadata-Version: 1.0
Name: py
Version: 0.9.0
Version: 0.9.1
Summary: py lib: agile development and test support library
Home-page: http://codespeak.net/py
Author: holger krekel, Carl Friedrich Bolz, Guido Wesdorp, Maciej Fijalkowski, Armin Rigo & others
Author-email: py-dev@codespeak.net
License: MIT license
Download-URL: http://codespeak.net/download/py/py-0.9.0.tar.gz
Download-URL: XXX
Description:
the py lib is a development support library featuring
py.test, ad-hoc distributed execution, micro-threads
......@@ -15,3 +15,4 @@ Description:
Platform: unix
Platform: linux
Platform: cygwin
Platform: win32
codespeak-lib (0.9.1-1) unstable; urgency=low
* New upstream release (Closes: #473528)
- Documentation is now installed with sensible filenames (Closes:
#413665)
* Adjust Maintainers with permission from Guilherme Salgado and Alexandre
Fayolle.
* Remove '/usr/bin' from path when executing py.test to prevent collision
with pypy-dev (Closes: #463568).
* Disable buildcmodule.py from deleting greenlet module /usr/lib. Thanks to
Mark Wooding <mdw@distorted.org.uk> (Closes: #471844).
* Remove python-tkinter from Recommends (Closes: #448894, #473833)
* Add texlive-extra-utils to Build-Depends.
* Install "webdata" HTML and JavaScript files to fix web-based py.test.
Patch by Alexandre Fayolle <afayolle@debian.org> (Closes: #434226).
* Add debian/watch file.
* Change doc-base section to "Programming/Python" from "Apps/Programming".
* Update Lintian overrides to match new installed directories.
-- Chris Lamb <chris@chris-lamb.co.uk> Thu, 03 Apr 2008 13:16:40 +0100
codespeak-lib (0.9.0-4) unstable; urgency=low
* Add myself to Uploaders:
......
Source: codespeak-lib
Section: python
Priority: optional
Maintainer: Guilherme Salgado <salgado@async.com.br>
Uploaders: Alexandre Fayolle <afayolle@debian.org>, Chris Lamb <chris@chris-lamb.co.uk>
Build-Depends: python-all-dev (>= 2.3.5-10), python-central (>= 0.5), debhelper (>= 5.0.37.1), dpatch, python-docutils, xsltproc, docbook-xsl, subversion, openssh-client
Maintainer: Chris Lamb <chris@chris-lamb.co.uk>
Build-Depends: python-all-dev (>= 2.3.5-10), python-central (>= 0.5), debhelper (>= 5.0.37.1), dpatch, python-docutils, xsltproc, docbook-xsl, subversion, openssh-client, texlive-extra-utils
XS-Python-Version: all
Standards-Version: 3.7.3
Homepage: http://codespeak.net/py/
......@@ -13,7 +12,7 @@ Architecture: any
Depends: ${python:Depends}, ${shlibs:Depends}
Conflicts: python-pylib, python2.3-codespeak-lib, python2.4-codespeak-lib
Replaces: python-pylib, python2.3-codespeak-lib, python2.4-codespeak-lib
Recommends: python-tkinter, python-docutils
Recommends: python-docutils
Suggests: screen, rsync, graphviz, tetex-bin, gs-gpl|gs-esp, ps2eps, subversion
Provides: ${python:Provides}
XB-Python-Version: ${python:Versions}
......
python-codespeak-lib: script-not-executable ./usr/share/pycentral/python-codespeak-lib/site-packages/py/execnet/script/shell.py
python-codespeak-lib: script-not-executable ./usr/share/pycentral/python-codespeak-lib/site-packages/py/execnet/script/socketserver.py
python-codespeak-lib: script-not-executable ./usr/share/pycentral/python-codespeak-lib/site-packages/py/misc/findmissingdocstrings.py
python-codespeak-lib: script-not-executable ./usr/share/pyshared/py/execnet/script/shell.py
python-codespeak-lib: script-not-executable ./usr/share/pyshared/py/execnet/script/socketserver.py
python-codespeak-lib: script-not-executable ./usr/share/pyshared/py/misc/findmissingdocstrings.py
01-fix-scripts
02-py-test-path
03-distutils-setup
04-apigen
05-disable-buildcmodule
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02-py-test-path.dpatch by Chris Lamb <chris@chris-lamb.co.uk>
##
## DP: Workaround Python module path conflict when pypy-dev is
## DP: installed. See #463568.
@DPATCH@
diff -urNad py-0.9.1~/py/bin/py.test py-0.9.1/py/bin/py.test
--- py-0.9.1~/py/bin/py.test 2008-03-28 10:40:40.000000000 +0000
+++ py-0.9.1/py/bin/py.test 2008-04-03 23:59:12.000000000 +0100
@@ -1,4 +1,10 @@
#!/usr/bin/env python
+import sys
+try:
+ sys.path.remove('/usr/bin')
+except ValueError:
+ pass
+
from _findpy import py
py.test.cmdline.main()
#! /bin/sh /usr/share/dpatch/dpatch-run
## 03-distutils-setup.dpatch by <alf@merlin>
##
## DP: Use stdlib's distutils for setup
## DP: Use stdlib's distutils for setup. The package list may be generated by:
## DP: find -name __init__.py | xargs -L1 dirname | grep -v "/testing" | sort
@DPATCH@
......
......@@ -10,7 +10,7 @@
if wc.check(versioned=True):
rev = py.path.svnwc(packageroot).info().rev
+ else:
+ rev = py.__package__.revision
+ rev = 'unknown'
_revcache[packageroot] = rev
if packageroot.basename == "py":
assert rev is not None
......@@ -36,13 +36,3 @@
if value[1] == '*':
d.update(get_star_import_tree(base, key))
else:
--- codespeak-lib-0.9.0.orig/py/bin/_docgen.py 2007-02-14 11:13:06.000000000 +0000
+++ codespeak-lib-0.9.0/py/bin/_docgen.py 2008-02-05 11:09:29.000000000 +0000
@@ -28,7 +28,7 @@
def build_docs(targetpath, testargs):
docpath = pypath.join('doc')
run_tests(docpath, '',
- testargs + ' --forcegen --apigenrelpath="apigen/"')
+ testargs + ' --forcegen --apigen="%s/apigen/apigen.py"' % (pypath,))
docpath.copy(targetpath)
#! /bin/sh /usr/share/dpatch/dpatch-run
## 05-disable-buildcmodule.dpatch by Chris Lamb <chris@chris-lamb.co.uk>
##
## DP: Ensure that builcmodule does not remove the library inside /usr/lib.
## DP: See #471844. Patch by Mark Wooding <mdw@distorted.org.uk>.
@DPATCH@
diff -urNad py-0.9.1~/py/misc/buildcmodule.py py-0.9.1/py/misc/buildcmodule.py
--- py-0.9.1~/py/misc/buildcmodule.py 2008-03-28 10:40:38.000000000 +0000
+++ py-0.9.1/py/misc/buildcmodule.py 2008-04-04 00:09:12.000000000 +0100
@@ -33,10 +33,7 @@
# XXX argl! we need better "build"-locations alltogether!
if lib.check():
- try:
- lib.remove()
- except EnvironmentError:
- pass # XXX we just use the existing version, bah
+ pass # XXX we just use the existing version, bah
if not lib.check():
c = py.io.StdCaptureFD()
......@@ -2,7 +2,7 @@ Document: python-codespeak-lib
Title: pylib documentation
Author: Various Authors
Abstract: How to use pylib
Section: Apps/Programming
Section: Programming/Python
Format: HTML
Index: /usr/share/doc/python-codespeak-lib/py/doc/index.html
......
......@@ -4,7 +4,7 @@
#export DH_VERBOSE=1
PYVERS := $(shell pyversions -r -v)
#PYVER := $(shell pyversions -d -v)
PYVER := $(shell pyversions -d -v)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
......@@ -38,6 +38,9 @@ build-doc-stamp:
build-stamp: $(PYVERS:%=build-python%)
dh_clean -k
python setup.py install --no-compile --prefix=debian/python-codespeak-lib/usr/
cp -v py/test/rsession/webdata/*.html \
py/test/rsession/webdata/*.js \
debian/python-codespeak-lib/usr/lib/python$(PYVER)/site-packages/py/test/rsession/webdata/
rm -f debian/python-codespeak-lib/usr/lib/python*/site-packages/py/env.py
for f in debian/python-codespeak-lib/usr/bin/* ; do \
sed -i -e 's/from \_findpy import py/import py/' $$f ; \
......
version=3
http://codespeak.net/download/py/ py-(.+).tar.gz
# -*- coding: utf-8 -*-
"""
the py lib is a development support library featuring
py.test, ad-hoc distributed execution, micro-threads
......@@ -5,17 +7,17 @@
"""
from initpkg import initpkg
version = "0.9.0"
version = "0.9.1"
initpkg(__name__,
description = "py lib: agile development and test support library",
revision = int('$LastChangedRevision: 38799 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2007-02-14 12:10:40 +0100 (Wed, 14 Feb 2007) $',
revision = int('$LastChangedRevision: 52798 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2008-03-21 11:40:39 +0100 (Fri, 21 Mar 2008) $',
version = version,
url = "http://codespeak.net/py",
download_url = "http://codespeak.net/download/py/py-%s.tar.gz" %(version,),
download_url = "XXX", # "http://codespeak.net/download/py/py-%s.tar.gz" %(version,),
license = "MIT license",
platforms = ['unix', 'linux', 'cygwin'],
platforms = ['unix', 'linux', 'cygwin', 'win32'],
author = "holger krekel, Carl Friedrich Bolz, Guido Wesdorp, Maciej Fijalkowski, Armin Rigo & others",
author_email = "py-dev@codespeak.net",
long_description = globals()['__doc__'],
......@@ -29,6 +31,8 @@ initpkg(__name__,
'test.skip' : ('./test/item.py', 'skip'),
'test.fail' : ('./test/item.py', 'fail'),
'test.exit' : ('./test/session.py', 'exit'),
'test.broken' : ('./test/item.py', 'Broken'),
'test.notimplemented' : ('./test/item.py', '_NotImplemented'),
# configuration/initialization related test api
'test.config' : ('./test/config.py', 'config_per_process'),
......@@ -62,6 +66,7 @@ initpkg(__name__,
'path.svnwc' : ('./path/svn/wccommand.py', 'SvnWCCommandPath'),
'path.svnurl' : ('./path/svn/urlcommand.py', 'SvnCommandPath'),
'path.local' : ('./path/local/local.py', 'LocalPath'),
'path.SvnAuth' : ('./path/svn/svncommon.py', 'SvnAuth'),
# some nice slightly magic APIs
'magic.__doc__' : ('./magic/__init__.py', '__doc__'),
......
......@@ -116,7 +116,9 @@ def test_get_documentable_items():
pkgname, documentable = apigen.get_documentable_items_pkgdir(
fs_root.join(package_name))
assert pkgname == 'pak'
assert sorted(documentable.keys()) == [
keys = documentable.keys()
keys.sort()
assert keys == [
'main.SomeTestClass', 'main.SomeTestSubClass', 'main.func',
'main.sub.func', 'somenamespace.baz', 'somenamespace.foo']
......
......@@ -16,7 +16,7 @@ from py.__.apigen.tracer import model
sorted = py.builtin.sorted
def pkg_to_dict(module):
defs = module.__package__.exportdefs
defs = module.__pkg__.exportdefs
d = {}
for key, value in defs.iteritems():
chain = key.split('.')
......@@ -33,7 +33,7 @@ def get_star_import_tree(module, modname):
""" deal with '*' entries in an initpkg situation """
ret = {}
modpath = py.path.local(inspect.getsourcefile(module))
pkgpath = module.__package__.getpath()
pkgpath = module.__pkg__.getpath()
for objname in dir(module):
if objname.startswith('_'):
continue # also skip __*__ attributes
......@@ -281,8 +281,8 @@ class DocStorageAccessor(AbstractDocStorageAccessor):
return "Lack of module info"
try:
retval = module.__doc__ or "*undocumented*"
retval = module.__package__.description
retval = module.__package__.long_description
retval = module.__pkg__.description
retval = module.__pkg__.long_description
except AttributeError:
pass
return retval
......
......@@ -10,7 +10,7 @@
from _findpy import py
import py
pypath = py.__package__.getpath()
pypath = py.__pkg__.getpath()
def run_tests(path, envvars='', args=''):
pytestpath = pypath.join('bin/py.test')
......@@ -28,7 +28,7 @@ def build_apigen_docs(targetpath, testargs=''):
def build_docs(targetpath, testargs):
docpath = pypath.join('doc')
run_tests(docpath, '',
testargs + ' --forcegen --apigenrelpath="apigen/"')
testargs + ' --forcegen --apigen="%s/apigen/apigen.py"' % (pypath,))
docpath.copy(targetpath)
def build_nav(targetpath, docs=True, api=True):
......
......@@ -147,9 +147,9 @@ def pytest_remote(address, url):
if __name__ == '__main__':
py.magic.invoke(assertion=True)
version = py.std.sys.argv[1]
assert py.__package__.version == version, (
assert py.__pkg__.version == version, (
"py package has version %s\nlocation: %s" %
(py.__package__.version, pydir))
(py.__pkg__.version, pydir))
tmpdir = py.path.local.get_temproot().join('makepyrelease-%s' % version)
if tmpdir.check():
......@@ -171,14 +171,14 @@ if __name__ == '__main__':
py.process.cmdexec("rsync -avz %(source)s/ %(remotedir)s" % locals())
ddir = tmpdir.ensure('download', dir=1)
URL = py.__package__.download_url # 'http://codespeak.net/download/py/'
URL = py.__pkg__.download_url # 'http://codespeak.net/download/py/'
unpacked = unpackremotetar(ddir, URL)
assert unpacked == ddir.join("py-%s" % (version,))
#checksvnworks(unpacked)
#pytest(unpacked)
pytest_remote('test@codespeak.net', py.__package__.download_url)
pytest_remote('test@codespeak.net', py.__pkg__.download_url)
......@@ -24,7 +24,7 @@ def rsync(pkgpath, apidocspath, gateway, remotepath):
def run_tests(pkgpath, apigenpath, args='', captureouterr=False):
""" run the unit tests and build the docs """
pypath = py.__package__.getpath()
pypath = py.__pkg__.getpath()
pytestpath = pypath.join('bin/py.test')
# XXX this would need a Windows specific version if we want to allow
# running this script on that platform, but currently --apigen doesn't
......@@ -82,7 +82,7 @@ if __name__ == '__main__':
args.remove('--ignorefail')
ignorefail = True
args = ' '.join(sys.argv[1:])
pkgpath = py.__package__.getpath()
pkgpath = py.__pkg__.getpath()
apidocspath = pkgpath.dirpath().join('apigen')
main(pkgpath, apidocspath, 'codespeak.net',
'/home/guido/rsynctests', args, ignorefail)
......
......@@ -42,8 +42,11 @@ if __name__ == '__main__':
string = args[0]
if options.ignorecase:
string = string.lower()
for x in curdir.visit('*.py', rec):
s = x.read()
for x in curdir.visit('*.py', rec):
try:
s = x.read()
except py.error.ENOENT:
pass # whatever, probably broken link (ie emacs lock)
searchs = s
if options.ignorecase:
searchs = s.lower()
......
......@@ -18,7 +18,7 @@ class ExceptionInfo(object):
self._striptext = 'AssertionError: '
self._excinfo = tup
self.type, self.value, tb = self._excinfo
self.typename = str(self.type)
self.typename = self.type.__module__ + '.' + self.type.__name__
self.traceback = py.code.Traceback(tb)
def exconly(self, tryshort=False):
......
......@@ -109,7 +109,7 @@ class Source(object):
for start in range(lineno, -1, -1):
trylines = self.lines[start:lineno+1]
# quick hack to indent the source and get it as a string in one go
trylines.insert(0, 'if 0:')
trylines.insert(0, 'def xxx():')
trysource = '\n '.join(trylines)
# ^ space here
try:
......
......@@ -281,3 +281,15 @@ def test_deindent():
"""
lines = deindent(source.splitlines())
assert lines == ['', 'def f():', ' def g():', ' pass', ' ']
def test_write_read():
py.test.skip("Failing")
tmpdir = py.test.ensuretemp("source_write_read")
source = py.code.Source('''
class A(object):
def method(self):
x = 1
''')
tmpdir.ensure("a.py").write(source)
s2 = py.code.Source(tmpdir.join("a.py").pyimport().A)
assert source == s2
from __future__ import generators
import py
import py
import sys
class TracebackEntry(object):
""" a single entry in a traceback """
......@@ -9,6 +10,9 @@ class TracebackEntry(object):
def __init__(self, rawentry):
self._rawentry = rawentry
self.frame = py.code.Frame(rawentry.tb_frame)
# Ugh. 2.4 and 2.5 differs here when encountering
# multi-line statements. Not sure about the solution, but
# should be portable
self.lineno = rawentry.tb_lineno - 1
self.relline = self.lineno - self.frame.code.firstlineno
......
......@@ -33,6 +33,9 @@ option = py.test.config.addoptions("execnet options",
action='store', dest='docpath',
default="doc", type='string',
help="relative path to doc output location (relative from py/)"),
Option('', '--runslowtests',
action="store_true", dest="runslowtests", default=False,
help="run slow tests)"),
)
dist_rsync_roots = ['.']
Changes between 0.9.0 and 0.9.1
===============================
This is a fairly complete list of changes between 0.9 and 0.9.1, which can
serve as a reference for developers.
* allowing + signs in py.path.svn urls [39106]
* fixed support for Failed exceptions without excinfo in py.test [39340]
* added support for killing processes for Windows (as well as platforms that
support os.kill) in py.misc.killproc [39655]
* added setup/teardown for generative tests to py.test [40702]
* added detection of FAILED TO LOAD MODULE to py.test [40703, 40738, 40739]
* fixed problem with calling .remove() on wcpaths of non-versioned files in
py.path [44248]
* fixed some import and inheritance issues in py.test [41480, 44648, 44655]
* fail to run greenlet tests when pypy is available, but without stackless
[45294]
* small fixes in rsession tests [45295]
* fixed issue with 2.5 type representations in py.test [45483, 45484]
* made that internal reporting issues displaying is done atomically in py.test
[45518]
* made that non-existing files are igored by the py.lookup script [45519]
* improved exception name creation in py.test [45535]
* made that less threads are used in execnet [merge in 45539]
* removed lock required for atomical reporting issue displaying in py.test
[45545]
* removed globals from execnet [45541, 45547]
* refactored cleanup mechanics, made that setDaemon is set to 1 to make atexit
get called in 2.5 (py.execnet) [45548]
* fixed bug in joining threads in py.execnet's servemain [45549]
* refactored py.test.rsession tests to not rely on exact output format anymore
[45646]
* using repr() on test outcome [45647]
* added 'Reason' classes for py.test.skip() [45648, 45649]
* killed some unnecessary sanity check in py.test.collect [45655]
* avoid using os.tmpfile() in py.io.fdcapture because on Windows it's only
usable by Administrators [45901]
* added support for locking and non-recursive commits to py.path.svnwc [45994]
* locking files in py.execnet to prevent CPython from segfaulting [46010]
* added export() method to py.path.svnurl
* fixed -d -x in py.test [47277]
* fixed argument concatenation problem in py.path.svnwc [49423]
* restore py.test behaviour that it exits with code 1 when there are failures
[49974]
* don't fail on html files that don't have an accompanying .txt file [50606]
* fixed 'utestconvert.py < input' [50645]
* small fix for code indentation in py.code.source [50755]
* fix _docgen.py documentation building [51285]
* improved checks for source representation of code blocks in py.test [51292]
* added support for passing authentication to py.path.svn* objects [52000,
52001]
* removed sorted() call for py.apigen tests in favour of [].sort() to support
Python 2.3 [52481]
......@@ -240,8 +240,9 @@ def localrefcheck(tryfn, path, lineno):
fn = ishtml and fn.new(ext='.txt') or fn
print "filename is", fn
if not fn.check(): # not ishtml or not fn.check():
py.test.fail("reference error %r in %s:%d" %(
tryfn, path.basename, lineno+1))
if not py.path.local(tryfn).check(): # the html could be there
py.test.fail("reference error %r in %s:%d" %(
tryfn, path.basename, lineno+1))
if anchor:
source = unicode(fn.read(), 'latin1')
source = source.lower().replace('-', ' ') # aehem
......@@ -310,7 +311,7 @@ def resolve_linkrole(name, text, check=True):
'to the py package') % (text,)
relpath = '/'.join(text.split('/')[1:])
if check:
pkgroot = py.__package__.getpath()
pkgroot = py.__pkg__.getpath()
abspath = pkgroot.join(relpath)
assert pkgroot.join(relpath).check(), (
'problem with linkrole :source:`%s`: '
......
......@@ -9,11 +9,11 @@ Downloading a tar/zip file and installing it
The latest public release:
`download py-0.9.0.tar.gz`_
`download py-0.9.0.zip`_
`download py-0.9.1.tar.gz`_
`download py-0.9.1.zip`_
.. _`download py-0.9.0.tar.gz`: http://codespeak.net/download/py/py-0.9.0.tar.gz
.. _`download py-0.9.0.zip`: http://codespeak.net/download/py/py-0.9.0.zip
.. _`download py-0.9.1.tar.gz`: http://codespeak.net/download/py/py-0.9.1.tar.gz
.. _`download py-0.9.1.zip`: http://codespeak.net/download/py/py-0.9.1.zip
The py lib can be `globally installed via setup.py`_
or `used locally`_.
......
......@@ -180,8 +180,8 @@ and modules the default collectors will produce
custom Collectors and Items if they are found
in a local ``conftest.py`` file.
example: perform additional ReST checs
++++++++++++++++++++++++++++++++++++++
example: perform additional ReST checks
+++++++++++++++++++++++++++++++++++++++
With your custom collectors or items you can completely
derive from the standard way of collecting and running
......
......@@ -7,7 +7,7 @@ py lib documentation
`Download and Installation`_
`0.9.0 release announcement`_
`0.9.1 release announcement`_
Main tools and API
----------------------
......@@ -59,4 +59,4 @@ Background and Motivation information
.. _`Why What how py?`: why_py.html
.. _`future`: future.html
.. _`miscellaneous features`: misc.html
.. _`0.9.0 release announcement`: release-0.9.0.html
.. _`0.9.1 release announcement`: release-0.9.1.html
......@@ -187,6 +187,23 @@ properties in an :api:`py.path.svnwc` instance::
>>> len(wc.status().prop_modified)
0
SVN authentication
++++++++++++++++++++++
Some uncommon functionality can also be provided as extensions, such as SVN
authentication::
>>> auth = py.path.SvnAuth('anonymous', 'user', cache_auth=False,
... interactive=False)
>>> wc.auth = auth
>>> wc.update() # this should work
>>> path = wc.ensure('thisshouldnotexist.txt')
>>> try:
... path.commit('testing')
... except py.process.cmdexec.Error, e:
... pass
>>> 'authorization failed' in str(e)
True
Known problems / limitations
===================================
......
py lib 0.9.1: bugfix release
=============================
Welcome to the 0.9.1 py lib release - a library aiming to
support agile and test-driven python development on various levels.
This is mostly a bugfix release, with a couple of new features sneaked in.
Most important changes:
* reduced the number of threads used in py.execnet
* some new functionality (authentication, export, locking) in py.path's
Subversion APIs
* stability and segfault fixes in execnet
* numerous small fixes in py.test's rsession (experimental pluggable session)
and generative test features
* some fixes in the py.test core
* added py.misc.killproc, which allows killing processes on (some flavours of)
Windows and UNIX
For a complete list of changes, see doc/changes-0.9.1.txt in the source
package.
Download/Install: http://codespeak.net/py/0.9.1/download.html
Documentation/API: http://codespeak.net/py/0.9.1/index.html
Work on the py lib has been partially funded by the
European Union IST programme and by http://merlinux.de
within the PyPy project.
best, have fun and let us know what you think!
holger krekel, Maciej Fijalkowski,
Carl Friedrich Bolz, Guido Wesdorp
......@@ -85,7 +85,7 @@ class Channel(object):
Msg = Message.CHANNEL_LAST_MESSAGE
else:
Msg = Message.CHANNEL_CLOSE
self.gateway._outgoing.put(Msg(self.id))
self.gateway._send(Msg(self.id))
def _getremoteerror(self):
try:
......@@ -117,7 +117,7 @@ class Channel(object):
# state transition "opened/sendonly" --> "closed"
# threads warning: the channel might be closed under our feet,
# but it's never damaging to send too many CHANNEL_CLOSE messages
put = self.gateway._outgoing.put
put = self.gateway._send
if error is not None:
put(Message.CHANNEL_CLOSE_ERROR(self.id, str(error)))
else:
......@@ -157,7 +157,7 @@ class Channel(object):
data = Message.CHANNEL_NEW(self.id, item.id)
else:
data = Message.CHANNEL_DATA(self.id, item)
self.gateway._outgoing.put(data)
self.gateway._send(data)
def receive(self):
"""receives an item that was sent from the other side,
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
across process or computer barriers.
"""
import socket, os, sys
import socket, os, sys, thread
class SocketIO:
server_stmt = """
......@@ -43,11 +43,17 @@ import sys
def close_read(self):
if self.readable:
self.sock.shutdown(0)
try:
self.sock.shutdown(0)
except socket.error:
pass
self.readable = None
def close_write(self):
if self.writeable:
self.sock.shutdown(1)
try:
self.sock.shutdown(1)
except socket.error:
pass
self.writeable = None
class Popen2IO:
......@@ -70,6 +76,7 @@ sys.stdout = sys.stderr = StringIO.StringIO()
msvcrt.setmode(outfile.fileno(), os.O_BINARY)
self.outfile, self.infile = infile, outfile
self.readable = self.writeable = True
self.lock = thread.allocate_lock()
def read(self, numbytes):
"""Read exactly 'bytes' bytes from the pipe. """
......@@ -93,6 +100,10 @@ sys.stdout = sys.stderr = StringIO.StringIO()
self.infile.close()
self.readable = None
def close_write(self):
if self.writeable:
self.outfile.close()
self.writeable = None
self.lock.acquire()
try:
if self.writeable:
self.outfile.close()
self.writeable = None
finally:
self.lock.release()
......@@ -11,7 +11,6 @@ import py
startup_modules = [
'py.__.thread.io',
'py.__.thread.pool',
'py.__.execnet.inputoutput',
'py.__.execnet.gateway',
'py.__.execnet.message',
......@@ -29,6 +28,8 @@ class InstallableGateway(gateway.Gateway):
def __init__(self, io):
self._remote_bootstrap_gateway(io)
super(InstallableGateway, self).__init__(io=io, _startcount=1)
# XXX we dissallow execution form the other side
self._initreceive(requestqueue=False)
def _remote_bootstrap_gateway(self, io, extra=''):
""" return Gateway with a asynchronously remotely
......@@ -41,7 +42,7 @@ class InstallableGateway(gateway.Gateway):
bootstrap = [extra]
bootstrap += [getsource(x) for x in startup_modules]
bootstrap += [io.server_stmt,
"Gateway(io=io, _startcount=2).join(joinexec=False)",
"Gateway(io=io, _startcount=2)._servemain()",
]
source = "\n".join(bootstrap)
self._trace("sending gateway bootstrap code")
......
......@@ -83,8 +83,7 @@ class PopenGatewayTestSetup:
class BasicRemoteExecution:
def test_correct_setup(self):
for x in 'sender', 'receiver':
assert self.gw._pool.getstarted(x)
assert self.gw._receiverthread.isAlive()
def test_repr_doesnt_crash(self):
assert isinstance(repr(self), str)
......@@ -373,6 +372,18 @@ class BasicRemoteExecution:
res = channel.receive()
assert res == 42
def test_non_reverse_execution(self):
gw = self.gw
c1 = gw.remote_exec("""
c = channel.gateway.remote_exec("pass")
try:
c.waitclose()
except c.RemoteError, e:
channel.send(str(e))