Commit eb20b98d authored by Guilherme Salgado's avatar Guilherme Salgado Committed by Sebastian Ramacher

Imported Debian patch 0.7-svn20060621-1

parents 27396c05 1dcf4b17
pylib for Debian
----------------
<possible notes regarding this package - if none, delete this file>
-- Guilherme Salgado <salgado@async.com.br>, Sat, 23 Jul 2005 10:48:20 -0300
codespeak-lib (0.7-svn20060621-1) unstable; urgency=low
* New upstream version.
* Split the patches inside debian/patches/ and use dpatch.
-- Guilherme Salgado <salgado@async.com.br> Tue, 18 Jul 2006 8:44:23 -0300
codespeak-lib (0.7-svn20050721-5) unstable; urgency=low
* Convert to updated python policy. Closes: #373304.
......
......@@ -2,7 +2,7 @@ Source: codespeak-lib
Section: python
Priority: optional
Maintainer: Guilherme Salgado <salgado@async.com.br>
Build-Depends: python-all-dev (>= 2.3.5-10), python-central (>= 0.4.17), debhelper (>= 5.0.37.1)
Build-Depends: python-all-dev (>= 2.3.5-10), python-central (>= 0.4.17), debhelper (>= 5.0.37.1), dpatch
XS-Python-Version: all
Standards-Version: 3.7.2
......
patching file py/bin/py.test
patching file py/bin/py.rest
Hunk #1 succeeded at 11 with fuzz 1.
patching file py/bin/py.lookup
Hunk #1 succeeded at 1 with fuzz 2.
patching file py/bin/py.cleanup
Hunk #1 succeeded at 1 with fuzz 1.
01-fix-greenlet-bustage.patch
03-fix-imports.patch
04-fix-setup.patch
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01-fix-greenlet-bustage.dpatch by <salgado@canario.async.com.br>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
--- codespeak-lib-0.7.orig/py/magic/greenlet.py
+++ codespeak-lib-0.7/py/magic/greenlet.py
@@ -1,5 +1,5 @@
import py
gdir = py.path.local(py.__file__).dirpath()
-path = gdir.join('c-extension', 'greenlet', 'greenlet.c')
-greenlet = path.getpymodule().greenlet
+path = gdir.join('c-extension', 'greenlet', 'greenlet.so')
+greenlet = path.pyimport().greenlet
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02-remove-syntax-error-tests.dpatch by <salgado@canario.async.com.br>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
--- codespeak-lib-0.7.orig/py/test/testing/test_session.py
+++ codespeak-lib-0.7/py/test/testing/test_session.py
@@ -108,15 +108,6 @@
assert len(l) == 2
assert out.find('2 failed') != -1
- def test_syntax_error_module(self):
- session = self.session
- session.main([str(datadir / 'syntax_error.py')])
- l = session.getitemoutcomepairs(py.test.Item.Failed)
- assert len(l) == 1
- out = self.file.getvalue()
- assert out.find(str('syntax_error.py')) != -1
- assert out.find(str('not python')) != -1
-
def test_exit_first_problem(self):
session = self.session
session.config.option.exitfirst = True
--- codespeak-lib-0.7.orig/py/test/testing/test_collect.py
+++ codespeak-lib-0.7/py/test/testing/test_collect.py
@@ -62,11 +62,6 @@
col = py.test.collect.Module(fn)
py.test.raises(py.error.ENOENT, col.run)
-def test_syntax_error_in_module():
- modpath = datadir.join('syntax_error.py')
- col = py.test.collect.Module(modpath)
- py.test.raises(SyntaxError, col.run)
-
def test_disabled_class():
col = py.test.collect.Module(datadir.join('disabled.py'))
l = col.run()
#! /bin/sh /usr/share/dpatch/dpatch-run
## 03-fix-imports.dpatch by <salgado@canario.async.com.br>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
--- codespeak-lib-0.7.orig/py/bin/py.test
+++ codespeak-lib-0.7/py/bin/py.test
@@ -1,4 +1,4 @@
#!/usr/bin/env python
-from _findpy import py
+import py
py.test.cmdline.main()
--- codespeak-lib-0.7.orig/py/bin/py.rest
+++ codespeak-lib-0.7/py/bin/py.rest
@@ -11,7 +11,7 @@
"""
import os, sys
-from _findpy import py
+import py
from py.__.misc import rest
if __name__=='__main__':
--- codespeak-lib-0.7.orig/py/bin/py.lookup
+++ codespeak-lib-0.7/py/bin/py.lookup
@@ -1,6 +1,6 @@
#!/usr/bin/python
-from _findpy import py
+import py
import re
string = py.std.sys.argv[1]
--- codespeak-lib-0.7.orig/py/bin/py.cleanup
+++ codespeak-lib-0.7/py/bin/py.cleanup
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-from _findpy import py
import py
for x in py.path.local().visit('*.pyc', py.path.checker(dotfile=0)):
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04-fix-setup.dpatch by <salgado@canario.async.com.br>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
--- codespeak-lib-0.7.orig/setup.py
+++ codespeak-lib-0.7/setup.py
@@ -1,2 +1,11 @@
+from distutils.core import setup
+from distutils.extension import Extension
import py
+
py._dist.setup(py)
+
+setup(name="greenlet",
+ version="0.1",
+ ext_modules=[Extension(
+ name='py.c-extension.greenlet.greenlet',
+ sources=['py/c-extension/greenlet/greenlet.c'])])
......@@ -10,7 +10,11 @@ PYVER := $(shell python -c 'import sys; print sys.version[:3]')
CURDIR := $(shell pwd)
build: build-stamp
patch: patch-stamp
patch-stamp:
dpatch apply-all
build: patch build-stamp
build-stamp: $(PYVERS:%=build-python%)
build-python%:
python$* setup.py build
......
py lib Copyright holders, 2003-2005
=======================================
Except when otherwise stated (look for LICENSE files or information at
the beginning of each file) the files in the 'py' directory are
copyrighted by one or more of the following people and organizations:
Holger Krekel <hpk@trillke.net>
merlinux GmbH, Germany <office@merlinux.de>
Armin Rigo <arigo@tunes.org>
Jan Balster <jan@balster.info>
Contributors include::
Ian Bicking <ianb@colorstudy.com>
Grig Gheorghiu <grig@gheorghiu.net>
Bob Ippolito <bob@redivi.com>
Christian Tismer <tismer@stackless.com>
Samuele Pedroni <pedronis@strakt.com>
Except when otherwise stated (look for LICENSE files or information at
the beginning of each file) all files in the 'py' directory are
licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -7,8 +7,8 @@ from initpkg import initpkg
initpkg(__name__,
description = "py.test and the py lib",
revision = int('$LastChangedRevision: 14485 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2005-07-11 05:12:29 -0300 (Mon, 11 Jul 2005) $',
revision = int('$LastChangedRevision: 26999 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2006-05-09 12:38:55 -0300 (Tue, 09 May 2006) $',
version = "0.8.0-alpha2",
url = "http://codespeak.net/py",
download_url = "http://codespeak.net/download/py/py-0.8.0-alpha2.tar.gz",
......@@ -23,10 +23,10 @@ initpkg(__name__,
# helpers for use from test functions or collectors
'test.raises' : ('./test/raises.py', 'raises'),
'test.deprecated_call' : ('./test/deprecate.py', 'deprecated_call'),
'test.skip' : ('./test/item.py', 'skip'),
'test.fail' : ('./test/item.py', 'fail'),
'test.exit' : ('./test/session.py', 'exit'),
'test.skip_on_error' : ('./test/item.py', 'skip_on_error'),
'test.compat.TestCase' : ('./test/compat.py', 'TestCase'),
# configuration/initialization related test api
......@@ -62,9 +62,9 @@ initpkg(__name__,
'path.svnurl' : ('./path/svn/urlcommand.py', 'SvnCommandPath'),
'path.local' : ('./path/local/local.py', 'LocalPath'),
'path.extpy' : ('./path/extpy/extpy.py', 'Extpy'),
'path.checker' : ('./path/common.py', 'checker'),
'path.checker' : ('./path/common.py', 'checker'), # deprecated
# some nice more or less magic APIs
# some nice slightly magic APIs
'magic.greenlet' : ('./magic/greenlet.py', 'greenlet'),
'magic.invoke' : ('./magic/invoke.py', 'invoke'),
'magic.revoke' : ('./magic/invoke.py', 'revoke'),
......@@ -74,7 +74,7 @@ initpkg(__name__,
'magic.View' : ('./magic/viewtype.py', 'View'),
'magic.AssertionError' : ('./magic/assertion.py', 'AssertionError'),
# generalized inspection API
# python inspection/code-generation API
'code.compile' : ('./code/source.py', 'compile_'),
'code.Source' : ('./code/source.py', 'Source'),
'code.Code' : ('./code/code.py', 'Code'),
......@@ -84,12 +84,19 @@ initpkg(__name__,
# backports and additions of builtins
'builtin.enumerate' : ('./builtin/enumerate.py', 'enumerate'),
'builtin.reversed' : ('./builtin/reversed.py', 'reversed'),
# gateways into remote contexts
'execnet.SocketGateway' : ('./execnet/register.py', 'SocketGateway'),
'execnet.PopenGateway' : ('./execnet/register.py', 'PopenGateway'),
'execnet.SshGateway' : ('./execnet/register.py', 'SshGateway'),
# input-output helping
'io.dupfile' : ('./io/dupfile.py', 'dupfile'),
'io.FDCapture' : ('./io/capture.py', 'FDCapture'),
'io.OutErrCapture' : ('./io/capture.py', 'OutErrCapture'),
'io.callcapture' : ('./io/capture.py', 'callcapture'),
# error module, defining all errno's as Classes
'error' : ('./misc/error.py', 'error'),
......@@ -108,7 +115,10 @@ initpkg(__name__,
'log.Path' : ('./log/consumer.py', 'Path'),
'log.STDOUT' : ('./log/consumer.py', 'STDOUT'),
'log.STDERR' : ('./log/consumer.py', 'STDERR'),
'log.Syslog' : ('./log/consumer.py', 'Syslog'),
'log.get' : ('./log/logger.py', 'get'),
# compatibility modules (taken from 2.4.1)
'compat.doctest' : ('./compat/doctest.py', '*'),
'compat.optparse' : ('./compat/optparse.py', '*'),
'compat.textwrap' : ('./compat/textwrap.py', '*'),
......
#!/usr/bin/python
#!/usr/bin/env python
#
# find and import a version of 'py'
......
#!/usr/bin/python
#!/usr/bin/env python
from _findpy import py
import sys
......
......@@ -2,5 +2,10 @@
import py
for x in py.path.local().visit('*.pyc', py.path.checker(dotfile=0)):
if len(py.std.sys.argv) > 1:
path = py.path.local(py.std.sys.argv[1])
else:
path = py.path.local()
print "cleaning path", path
for x in path.visit('*.pyc', lambda x: x.check(dotfile=0)):
x.remove()
......@@ -3,53 +3,6 @@
# hands on script to compute the non-empty Lines of Code
# for tests and non-test code
import py
curdir = py.path.local()
class Filecounter:
def __init__(self):
self.counts = {}
def count(self, fn, empty=False):
if empty:
s = len(p.readlines())
else:
s = 0
for i in fn.readlines():
if i.strip():
s += 1
self.counts[fn] = s
if __name__ == '__main__':
testcounter = Filecounter()
counter = Filecounter()
args = py.std.sys.argv[1:]
if not args:
args = ['.']
locations = [py.path.local(x) for x in args]
for loc in locations:
for x in loc.visit('*.py', py.path.checker(dotfile=0)):
bn = x.basename
if bn.startswith('test_') or bn.endswith('_test.py'):
testcounter.count(x)
else:
counter.count(x)
numfiles = len(counter.counts)
numtestfiles = len(testcounter.counts)
numlines = sum(counter.counts.values())
numtestlines = sum(testcounter.counts.values())
#for x,y in counter.counts.items():
# print "%3d %30s" % (y,x)
items = counter.counts.items()
items.sort(lambda x,y: cmp(x[1], y[1]))
for x, y in items:
print "%3d %30s" % (y,x)
print "%30s %3d" %("number of testfiles", numtestfiles)
print "%30s %3d" %("number of testlines", numtestlines)
print "%30s %3d" %("number of files", numfiles)
print "%30s %3d" %("number of lines", numlines)
from _findpy import py
from py.__.misc.cmdline.countloc import countloc
countloc()
#!/usr/bin/python
#!/usr/bin/env python
import py
import re
string = py.std.sys.argv[1]
curdir = py.path.local()
for x in curdir.visit('*.py', py.path.checker(dotfile=0)):
s = x.read()
if s.find(string) != -1:
lines = x.readlines()
for i, line in enumerate(lines):
if line.find(string) != -1:
print "%s:%d %s" %(x.relto(curdir), i+1, line.rstrip())
def rec(p):
return p.check(dotfile=0)
optparse = py.compat.optparse
parser = optparse.OptionParser()
parser.add_option("-i", "--ignore-case", action="store_true", dest="ignorecase",
help="ignore case distinctions")
if __name__ == '__main__':
(options, args) = parser.parse_args()
string = args[0]
if options.ignorecase:
string = string.lower()
for x in curdir.visit('*.py', rec):
s = x.read()
searchs = s
if options.ignorecase:
searchs = s.lower()
if s.find(string) != -1:
lines = s.splitlines()
if options.ignorecase:
searchlines = s.lower().splitlines()
else:
searchlines = lines
for i, (line, searchline) in enumerate(zip(lines, searchlines)):
if searchline.find(string) != -1:
print "%s:%d: %s" %(x.relto(curdir), i+1, line.rstrip())
#!/usr/bin/python
#!/usr/bin/env python
"""
invoke
......@@ -14,6 +14,15 @@ import os, sys
import py
from py.__.misc import rest
if hasattr(sys.stdout, 'fileno') and os.isatty(sys.stdout.fileno()):
def log(msg):
print msg
else:
def log(msg):
pass
if __name__=='__main__':
basedir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
sys.path.insert(0, basedir)
......@@ -27,9 +36,12 @@ if __name__=='__main__':
if not p.check():
log("path %s not found, ignoring" % p)
continue
def fil(p):
return p.check(fnmatch='*.txt', versioned=True)
def rec(p):
return p.check(dotfile=0)
if p.check(dir=1):
for x in p.visit(fil=py.path.checker(fnmatch='*.txt', versioned=True),
rec=py.path.checker(dotfile=0)):
for x in p.visit(fil, rec):
rest.process(x)
elif p.check(file=1):
rest.process(p)
#!/usr/bin/env python
docstring = """
invoke
%s filename1.txt
to generate a pdf file from restructered text.
http://docutils.sourceforge.net/docs/user/rst/quickref.html
""" % __file__
from _findpy import py
from py.__.rest import directive
from py.__.rest.latex import process_rest_file, process_configfile
optparse = py.compat.optparse
parser = optparse.OptionParser(usage=docstring)
parser.add_option("-c", "--config", dest="configfile",
help="use config file")
parser.add_option("--stylesheet", dest="stylesheet", default=None,
help="use style sheet")
parser.add_option("--debug", action="store_true", dest="debug",
default=False,
help="print debug output and don't delete files")
if __name__ == '__main__':
directive.BackendStore("latex")
(options, args) = parser.parse_args()
if options.configfile is not None:
configfile = py.path.local(options.configfile)
process_configfile(options.configfile, options.debug)
elif len(args) != 1:
parser.error("please supply a file name")
else:
f = py.path.local(args[0])
process_rest_file(args[0], options.stylesheet, options.debug)
@echo off
python %~dp0\..\py.cleanup %*
\ No newline at end of file
@echo off
python "%~dp0\..\py.cleanup" %*
@echo off
python %~dp0\..\py.countloc %*
\ No newline at end of file
@echo off
python "%~dp0\..\py.countloc" %*
@echo off
python %~dp0\..\py.lookup %*
\ No newline at end of file
@echo off
python "%~dp0\..\py.lookup" %*
@echo off
python %~dp0\..\py.rest %*
\ No newline at end of file
@echo off
python "%~dp0\..\py.rest" %*
@echo off
python %~dp0\..\py.test %*
\ No newline at end of file
@echo off
python "%~dp0\..\py.test" %*
from __future__ import generators
try:
reversed = reversed
except NameError:
def reversed(sequence):
"""reversed(sequence) -> reverse iterator over values of the sequence
Return a reverse iterator
"""
if hasattr(sequence, '__reversed__'):
return sequence.__reversed__()
if not hasattr(sequence, '__getitem__'):
raise TypeError("argument to reversed() must be a sequence")
return reversed_iterator(sequence)
class reversed_iterator(object):
def __init__(self, seq):
self.seq = seq
self.remaining = len(seq)
def __iter__(self):
return self
def next(self):
i = self.remaining
if i > 0:
i -= 1
item = self.seq[i]
self.remaining = i
return item
raise StopIteration
def __length_hint__(self):
return self.remaining
from py.builtin import reversed
from py.test import raises
def test_reversed():
r = reversed("hello")
assert iter(r) is r
assert r.next() == "o"
assert r.next() == "l"
assert r.next() == "l"
assert r.next() == "e"
assert r.next() == "h"
raises(StopIteration, r.next)
assert list(reversed(list(reversed("hello")))) == ['h','e','l','l','o']
raises(TypeError, reversed, reversed("hello"))
......@@ -9,5 +9,6 @@ class Directory(py.test.collect.Directory):
# return False
# return super(Directory, self).recfilter(path)
def run(self):
py.test.skip("c-extension testing needs platform selection")
#def run(self):
# py.test.skip("c-extension testing needs platform selection")
pass
......@@ -255,6 +255,12 @@ static int slp_save_state(char* stackref)
#endif
/* This is a trick to prevent the compiler from inlining or
removing the frames */
int (*_PyGreen_slp_switch) (void);
int (*_PyGreen_switchstack) (void);
void (*_PyGreen_initialstub) (void*);
static int g_switchstack(void)
{
/* perform a stack switch according to some global variables
......@@ -271,7 +277,7 @@ static int g_switchstack(void)
ts_current->top_frame = tstate->frame;
}
ts_origin = ts_current;
err = slp_switch();
err = _PyGreen_slp_switch();
if (err < 0) { /* error */
Py_XDECREF(ts_passaround);
ts_passaround = NULL;
......@@ -288,11 +294,6 @@ static int g_switchstack(void)
return err;
}
/* This is a trick to prevent the compiler from inlining or
removing the frames */
int (*_PyGreen_switchstack) (void);
void (*_PyGreen_initialstub) (void*);
static PyObject* g_switch(PyGreenlet* target, PyObject* args)
{
/* _consumes_ a reference to the args tuple,
......@@ -529,6 +530,8 @@ static void green_dealloc(PyGreenlet* self)
return;
}
}
if (self->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) self);
Py_XDECREF(self->run_info);
self->ob_type->tp_free((PyObject*) self);
}
......@@ -546,17 +549,116 @@ static PyObject* single_result(PyObject* results)
return results;
}
static PyObject *
throw_greenlet(PyGreenlet* self, PyObject* typ, PyObject* val, PyObject* tb)
{
/* Note: _consumes_ a reference to typ, val, tb */
PyErr_Restore