refine rsyncing and internal dir/transferal handling: don't transfer roots in a popen- no-chdir situation and only use one py._pydir everywhere
--HG-- branch : trunk
This commit is contained in:
@@ -19,9 +19,7 @@ py.apipkg.initpkg(__name__, dict(
|
||||
# access to all posix errno's as classes
|
||||
error = '.impl.error:error',
|
||||
|
||||
_impldir = '.impl._metainfo:impldir',
|
||||
_dir = '.impl._metainfo:pydir',
|
||||
_pydirs = '.impl._metainfo:pydirs',
|
||||
_pydir = '.impl._metainfo:pydir',
|
||||
version = 'py:__version__', # backward compatibility
|
||||
|
||||
cmdline = {
|
||||
|
||||
@@ -1,9 +1,2 @@
|
||||
|
||||
import py
|
||||
|
||||
pydir = py.path.local(py.__file__).dirpath()
|
||||
impldir = pydir.join("impl")
|
||||
|
||||
# list of all directories beloging to py
|
||||
assert impldir.relto(pydir)
|
||||
pydirs = [pydir]
|
||||
|
||||
@@ -257,7 +257,7 @@ class Collector(Node):
|
||||
path = self.fspath
|
||||
ntraceback = traceback.cut(path=self.fspath)
|
||||
if ntraceback == traceback:
|
||||
ntraceback = ntraceback.cut(excludepath=py._dir)
|
||||
ntraceback = ntraceback.cut(excludepath=py._pydir)
|
||||
traceback = ntraceback.filter()
|
||||
return traceback
|
||||
|
||||
|
||||
@@ -269,21 +269,17 @@ class Config(object):
|
||||
|
||||
def getrsyncdirs(self):
|
||||
config = self
|
||||
roots = config.option.rsyncdir
|
||||
candidates = [py._pydir] + config.option.rsyncdir
|
||||
conftestroots = config.getconftest_pathlist("rsyncdirs")
|
||||
if conftestroots:
|
||||
roots.extend(conftestroots)
|
||||
pydirs = [x.realpath() for x in py._pydirs]
|
||||
roots = [py.path.local(root) for root in roots]
|
||||
for root in roots:
|
||||
candidates.extend(conftestroots)
|
||||
roots = []
|
||||
for root in candidates:
|
||||
root = py.path.local(root).realpath()
|
||||
if not root.check():
|
||||
raise config.Error("rsyncdir doesn't exist: %r" %(root,))
|
||||
if pydirs is not None and root.basename in ("py", "_py"):
|
||||
try:
|
||||
pydirs.remove(root) # otherwise it's a conflict
|
||||
except ValueError: # we run as standalone py.test
|
||||
pass
|
||||
roots.extend(pydirs)
|
||||
if root not in roots:
|
||||
roots.append(root)
|
||||
return roots
|
||||
|
||||
#
|
||||
|
||||
9
py/impl/test/dist/gwmanage.py
vendored
9
py/impl/test/dist/gwmanage.py
vendored
@@ -3,7 +3,7 @@
|
||||
"""
|
||||
|
||||
import py
|
||||
import sys, os
|
||||
import sys, os.path
|
||||
import execnet
|
||||
from execnet.gateway_base import RemoteError
|
||||
|
||||
@@ -35,7 +35,12 @@ class GatewayManager:
|
||||
gateways = []
|
||||
for gateway in self.group:
|
||||
spec = gateway.spec
|
||||
if spec.popen and not spec.chdir and not spec.python:
|
||||
if spec.popen and not spec.chdir:
|
||||
# XXX this assumes that sources are python-packages
|
||||
# and that adding the basedir does not hurt
|
||||
gateway.remote_exec("""
|
||||
import sys ; sys.path.insert(0, %r)
|
||||
""" % os.path.dirname(str(source))).waitclose()
|
||||
continue
|
||||
if spec not in seen:
|
||||
def finished():
|
||||
|
||||
@@ -246,7 +246,7 @@ class FunctionMixin(PyobjMixin):
|
||||
if ntraceback == traceback:
|
||||
ntraceback = ntraceback.cut(path=path)
|
||||
if ntraceback == traceback:
|
||||
ntraceback = ntraceback.cut(excludepath=py._dir)
|
||||
ntraceback = ntraceback.cut(excludepath=py._pydir)
|
||||
traceback = ntraceback.filter()
|
||||
return traceback
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ class TmpTestdir:
|
||||
assert hasattr(py.cmdline, cmdlinename), cmdlinename
|
||||
source = ("import sys ; sys.path.insert(0, %r); "
|
||||
"import py ; py.cmdline.%s()" %
|
||||
(str(py._dir.dirpath()), cmdlinename))
|
||||
(str(py._pydir.dirpath()), cmdlinename))
|
||||
return (sys.executable, "-c", source,)
|
||||
|
||||
def runpython(self, script):
|
||||
@@ -329,7 +329,7 @@ class TmpTestdir:
|
||||
|
||||
def _getsysprepend(self):
|
||||
if not self.request.config.getvalue("toolsonpath"):
|
||||
s = "import sys ; sys.path.insert(0, %r) ; " % str(py._dir.dirpath())
|
||||
s = "import sys ; sys.path.insert(0, %r) ; " % str(py._pydir.dirpath())
|
||||
else:
|
||||
s = ""
|
||||
return s
|
||||
|
||||
@@ -174,7 +174,7 @@ class ReSTSyntaxTest(py.test.collect.Item):
|
||||
'to the py package') % (text,)
|
||||
relpath = '/'.join(text.split('/')[1:])
|
||||
if check:
|
||||
pkgroot = py._impldir
|
||||
pkgroot = py._pydir
|
||||
abspath = pkgroot.join(relpath)
|
||||
assert pkgroot.join(relpath).check(), (
|
||||
'problem with linkrole :source:`%s`: '
|
||||
|
||||
Reference in New Issue
Block a user