[svn r57536] get the py.path fixes of 0.9.x release branch back to trunk
--HG-- branch : trunk
This commit is contained in:
parent
5f666c99b7
commit
37a41ed0b7
|
@ -142,7 +142,11 @@ class PathBase(object):
|
|||
#assert strrelpath[-1] == self.sep
|
||||
#assert strrelpath[-2] != self.sep
|
||||
strself = str(self)
|
||||
if strself.startswith(strrelpath):
|
||||
if sys.platform == "win32":
|
||||
if os.path.normcase(strself).startswith(
|
||||
os.path.normcase(strrelpath)):
|
||||
return strself[len(strrelpath):]
|
||||
elif strself.startswith(strrelpath):
|
||||
return strself[len(strrelpath):]
|
||||
return ""
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class PathServer:
|
|||
|
||||
def command_GET(self, id, spec):
|
||||
path = self.C2P[id]
|
||||
self.channel.send(path._getbyspec(spec))
|
||||
self.channel.send(path.get(spec))
|
||||
|
||||
def command_READ(self, id):
|
||||
path = self.C2P[id]
|
||||
|
@ -53,7 +53,7 @@ class PathServer:
|
|||
if __name__ == '__main__':
|
||||
import py
|
||||
gw = py.execnet.PopenGateway()
|
||||
channel = gw._channelfactory.new()
|
||||
channel = gw.channelfactory.new()
|
||||
srv = PathServer(channel)
|
||||
c = gw.remote_exec("""
|
||||
import remotepath
|
||||
|
|
|
@ -13,9 +13,8 @@ channel.send(srv.p2c(py.path.local("/tmp")))
|
|||
|
||||
#gw = py.execnet.SshGateway('codespeak.net')
|
||||
gw = py.execnet.PopenGateway()
|
||||
gw.remote_init_threads(5)
|
||||
c = gw.remote_exec(SRC, stdout=py.std.sys.stdout, stderr=py.std.sys.stderr)
|
||||
subchannel = gw._channelfactory.new()
|
||||
c = gw.remote_exec(SRC)
|
||||
subchannel = gw.channelfactory.new()
|
||||
c.send(subchannel)
|
||||
|
||||
p = RemotePath(subchannel, c.receive())
|
||||
|
|
|
@ -33,7 +33,7 @@ class RemotePath(common.FSPathBase):
|
|||
self._channel.send(('JOIN', self._id, id) + args)
|
||||
return RemotePath(self._channel, id)
|
||||
|
||||
def _getbyspec(self, spec):
|
||||
def get(self, spec):
|
||||
parts = spec.split(',')
|
||||
ask = [x for x in parts if x not in self._specs]
|
||||
if ask:
|
||||
|
|
|
@ -390,10 +390,6 @@ class LocalPath(common.FSPathBase, PlatformMixin):
|
|||
#print "trying to import", self
|
||||
pkgpath = None
|
||||
if modname is None:
|
||||
#try:
|
||||
# return self._module
|
||||
#except AttributeError:
|
||||
# pass
|
||||
pkgpath = self.pypkgpath()
|
||||
if pkgpath is not None:
|
||||
if ensuresyspath:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import py
|
||||
import sys
|
||||
from py.path import local
|
||||
from py.__.path.common import checker
|
||||
from py.__.path.testing.fscommon import CommonFSTests, setuptestfs
|
||||
|
@ -178,6 +179,10 @@ class TestLocalPath(LocalSetup, CommonFSTests):
|
|||
assert not hasattr(l3, 'commit')
|
||||
|
||||
def test_long_filenames(self):
|
||||
if sys.platform == "win32":
|
||||
py.test.skip("win32: work around needed for path length limit")
|
||||
# see http://codespeak.net/pipermail/py-dev/2008q2/000922.html
|
||||
|
||||
tmpdir = self.tmpdir
|
||||
# testing paths > 260 chars (which is Windows' limitation, but
|
||||
# depending on how the paths are used), but > 4096 (which is the
|
||||
|
|
|
@ -29,6 +29,11 @@ class TestWINLocalPath:
|
|||
t2 = self.root.join("A_path")
|
||||
assert t1 == t1
|
||||
assert t1 == t2
|
||||
|
||||
def test_relto_with_mixed_case(self):
|
||||
t1 = self.root.join("a_path", "fiLe")
|
||||
t2 = self.root.join("A_path")
|
||||
assert t1.relto(t2) == "fiLe"
|
||||
|
||||
def test_allow_unix_style_paths(self):
|
||||
t1 = self.root.join('a_path')
|
||||
|
|
Loading…
Reference in New Issue