/home/johnny/projects/merlinux/py/dist/py/misc/dynpkg.py:11
"""
"""
import py
import sys
log = py.log.get("dynpkg",
-> info=py.log.STDOUT,
debug=py.log.STDOUT,
command=None) # py.log.STDOUT)
from distutils import util
class DistPython:
def __init__(self, location=None, python=None):
if python is None:
python = py.std.sys.executable
self.python = python
if location is None:
location = py.path.local()
self.location = location
self.plat_specifier = '.%s-%s' % (util.get_platform(), sys.version[0:3])
def clean(self):
out = self._exec("clean -a")
#print out
def build(self):
out = self._exec("build")
#print out
def _exec(self, cmd):
python = self.python
old = self.location.chdir()
try:
cmd = "%(python)s setup.py %(cmd)s" % locals()
log.command(cmd)
out = py.process.cmdexec(cmd)
finally:
old.chdir()
return out
def get_package_path(self, pkgname):
pkg = self._get_package_path(pkgname)
if pkg is None:
#self.clean()
self.build()
pkg = self._get_package_path(pkgname)
assert pkg is not None
return pkg
def _get_package_path(self, pkgname):
major, minor = py.std.sys.version_info[:2]
#assert major >=2 and minor in (3,4,5)
suffix = "%s.%s" %(major, minor)
location = self.location
for base in [location.join('build', 'lib'),
location.join('build', 'lib'+ self.plat_specifier)]:
if base.check(dir=1):
for pkg in base.visit(lambda x: x.check(dir=1)):
if pkg.basename == pkgname:
#
if pkg.dirpath().basename == 'lib'+ self.plat_specifier or \
pkg.dirpath().basename == 'lib':
return pkg
/home/johnny/projects/merlinux/py/dist/py/misc/testing/test_initpkg.py:69
def check_import(modpath):
print "checking import", modpath
-> assert __import__(modpath)
/home/johnny/projects/merlinux/py/dist/py/test/item.py:79
def execute(self, target, *args):
""" default implementation for calling a test target is to
simply call it.
"""
-> target(*args)
/home/johnny/projects/merlinux/py/dist/py/test/item.py:73
def run(self):
self.state.prepare(self)
-> self.execute(self.obj, *self.args)
/home/johnny/projects/merlinux/py/dist/py/test/rsession/executor.py:22
def execute(self):
try:
-> self.item.run()
outcome = Outcome()
except py.test.Item.Skipped, e:
outcome = Outcome(skipped=str(e))
except (KeyboardInterrupt, SystemExit):
raise
except:
excinfo = py.code.ExceptionInfo()
if isinstance(self.item, py.test.Function):
fun = self.item.obj # hope this is stable
code = py.code.Code(fun)
excinfo.traceback = excinfo.traceback.cut(
path=code.path, firstlineno=code.firstlineno)
outcome = Outcome(excinfo=excinfo, setupfailure=False)
if self.usepdb:
if self.reporter is not None:
self.reporter(report.ImmediateFailure(self.item,
ReprOutcome(outcome.make_repr())))
import pdb
pdb.post_mortem(excinfo._excinfo[2])
# XXX hmm, we probably will not like to continue from that point
# or we do?
raise SystemExit()
outcome.stdout = ""
outcome.stderr = ""
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:31
def plain_runner(item, session, reporter):
# box executor is doing stdout/err catching for us, let's do it here
startcapture(session)
r = RunExecutor(item, usepdb=session.config.option.usepdb, reporter=reporter)
-> outcome = r.execute()
outcome = ReprOutcome(outcome.make_repr())
outcome.stdout, outcome.stderr = finishcapture(session)
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:47
def apigen_runner(item, session, reporter):
r = RunExecutor(item, reporter=reporter)
session.tracer.start_tracing()
-> retval = plain_runner(item, session, reporter)
session.tracer.end_tracing()
return retval