From jan at codespeak.net Tue May 2 13:28:40 2006 From: jan at codespeak.net (jan at codespeak.net) Date: Tue, 2 May 2006 13:28:40 +0200 (CEST) Subject: [py-svn] r26656 - py/dist/py/execnet/testing Message-ID: <20060502112840.2212A100B5@code0.codespeak.net> Author: jan Date: Tue May 2 13:28:39 2006 New Revision: 26656 Modified: py/dist/py/execnet/testing/test_gateway.py Log: checkin of a (disabled) failing test Modified: py/dist/py/execnet/testing/test_gateway.py ============================================================================== --- py/dist/py/execnet/testing/test_gateway.py (original) +++ py/dist/py/execnet/testing/test_gateway.py Tue May 2 13:28:39 2006 @@ -1,4 +1,4 @@ -import os, sys, time +import os, sys, time, signal import py from py.__.execnet import gateway from py.__.conftest import option @@ -344,6 +344,30 @@ channel = channels.pop() ret = channel.receive() assert ret == 42 + + def disabled_test_remote_is_killed_while_sending(self): + gw = py.execnet.PopenGateway() + channel = gw.remote_exec(""" + import os + import time + channel.send(os.getppid()) + channel.send(os.getpid()) + while 1: + channel.send('#'*1000) + time.sleep(10) + """) + parent = channel.receive() + remote = channel.receive() + assert parent == os.getpid() + time.sleep(0.5) + os.kill(remote, signal.SIGKILL) + time.sleep(1) + channel.waitclose(1.0) + py.test.raises(EOFError, channel.receive) + #channel.waitclose(1.0) + #channel.send('#') + + class SocketGatewaySetup: def setup_class(cls): From jan at codespeak.net Sat May 6 10:47:49 2006 From: jan at codespeak.net (jan at codespeak.net) Date: Sat, 6 May 2006 10:47:49 +0200 (CEST) Subject: [py-svn] r26847 - in py/dist/py: . bin/win32 Message-ID: <20060506084749.A7C231007F@code0.codespeak.net> Author: jan Date: Sat May 6 10:47:46 2006 New Revision: 26847 Added: py/dist/py/env.cmd (contents, props changed) Modified: py/dist/py/bin/win32/py.cleanup.cmd (contents, props changed) py/dist/py/bin/win32/py.countloc.cmd (contents, props changed) py/dist/py/bin/win32/py.lookup.cmd (contents, props changed) py/dist/py/bin/win32/py.rest.cmd (contents, props changed) py/dist/py/bin/win32/py.test.cmd (contents, props changed) py/dist/py/env.py Log: Integrated a patch from Geert Jansen. Patch description: the attached patch improves win32 support for some of the command line utilities in the py library. - add support for CMD.EXE in env.py - add "env.cmd" that behaves like "eval `python env.py`" on Unix - add proper quoting for the various scripts in bin/win32 - end scripts in bin/win32 with newlines - set svn:eol-style native on bin/win32 scripts Modified: py/dist/py/bin/win32/py.cleanup.cmd ============================================================================== --- py/dist/py/bin/win32/py.cleanup.cmd (original) +++ py/dist/py/bin/win32/py.cleanup.cmd Sat May 6 10:47:46 2006 @@ -1,2 +1,2 @@ - at echo off -python %~dp0\..\py.cleanup %* \ No newline at end of file + at echo off +python "%~dp0\..\py.cleanup" %* Modified: py/dist/py/bin/win32/py.countloc.cmd ============================================================================== --- py/dist/py/bin/win32/py.countloc.cmd (original) +++ py/dist/py/bin/win32/py.countloc.cmd Sat May 6 10:47:46 2006 @@ -1,2 +1,2 @@ - at echo off -python %~dp0\..\py.countloc %* \ No newline at end of file + at echo off +python "%~dp0\..\py.countloc" %* Modified: py/dist/py/bin/win32/py.lookup.cmd ============================================================================== --- py/dist/py/bin/win32/py.lookup.cmd (original) +++ py/dist/py/bin/win32/py.lookup.cmd Sat May 6 10:47:46 2006 @@ -1,2 +1,2 @@ - at echo off -python %~dp0\..\py.lookup %* \ No newline at end of file + at echo off +python "%~dp0\..\py.lookup" %* Modified: py/dist/py/bin/win32/py.rest.cmd ============================================================================== --- py/dist/py/bin/win32/py.rest.cmd (original) +++ py/dist/py/bin/win32/py.rest.cmd Sat May 6 10:47:46 2006 @@ -1,2 +1,2 @@ - at echo off -python %~dp0\..\py.rest %* \ No newline at end of file + at echo off +python "%~dp0\..\py.rest" %* Modified: py/dist/py/bin/win32/py.test.cmd ============================================================================== --- py/dist/py/bin/win32/py.test.cmd (original) +++ py/dist/py/bin/win32/py.test.cmd Sat May 6 10:47:46 2006 @@ -1,2 +1,2 @@ - at echo off -python %~dp0\..\py.test %* \ No newline at end of file + at echo off +python "%~dp0\..\py.test" %* Added: py/dist/py/env.cmd ============================================================================== --- (empty file) +++ py/dist/py/env.cmd Sat May 6 10:47:46 2006 @@ -0,0 +1,2 @@ + at echo off +for /F "usebackq delims=" %%i in (`python "%~dp0\env.py"`) do %%i Modified: py/dist/py/env.py ============================================================================== --- py/dist/py/env.py (original) +++ py/dist/py/env.py Sat May 6 10:47:46 2006 @@ -1,21 +1,33 @@ #!/usr/bin/env python -import sys, os +import sys, os, os.path progpath = sys.argv[0] packagedir = os.path.abspath(os.path.dirname(progpath)) packagename = os.path.basename(packagedir) bindir = os.path.join(packagedir, 'bin') +if sys.platform == 'win32': + bindir = os.path.join(bindir, 'win32') rootdir = os.path.dirname(packagedir) -def prepend_unixpath(VAR, strpath): - value = "%r:$%s" % (strpath, VAR) - shell = os.getenv('SHELL') - if shell and shell.endswith('csh'): - return "setenv %s %s" % (VAR, value) +def prepend_path(name, value): + sep = os.path.pathsep + curpath = os.environ.get(name, '') + newpath = [value] + [ x for x in curpath.split(sep) if x and x != value ] + return setenv(name, sep.join(newpath)) + +def setenv(name, value): + shell = os.environ.get('SHELL', '') + comspec = os.environ.get('COMSPEC', '') + if shell.endswith('csh'): + cmd = 'setenv %s "%s"' % (name, value) + elif shell.endswith('sh'): + cmd = '%s="%s"; export %s' % (name, value, name) + elif comspec.endswith('cmd.exe'): + cmd = 'set %s=%s' % (name, value) else: - return "%s=%s; export %s" % (VAR, value, VAR) + assert False, 'Shell not supported.' + return cmd -if sys.platform != 'win32': - print prepend_unixpath('PATH', bindir) - print prepend_unixpath('PYTHONPATH', rootdir) +print prepend_path('PATH', bindir) +print prepend_path('PYTHONPATH', rootdir) From jan at codespeak.net Tue May 9 17:38:57 2006 From: jan at codespeak.net (jan at codespeak.net) Date: Tue, 9 May 2006 17:38:57 +0200 (CEST) Subject: [py-svn] r26999 - in py/dist/py: . log Message-ID: <20060509153857.70C9810072@code0.codespeak.net> Author: jan Date: Tue May 9 17:38:55 2006 New Revision: 26999 Modified: py/dist/py/__init__.py py/dist/py/log/consumer.py Log: added simple implementation of py.log.Syslog Modified: py/dist/py/__init__.py ============================================================================== --- py/dist/py/__init__.py (original) +++ py/dist/py/__init__.py Tue May 9 17:38:55 2006 @@ -115,6 +115,7 @@ '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) Modified: py/dist/py/log/consumer.py ============================================================================== --- py/dist/py/log/consumer.py (original) +++ py/dist/py/log/consumer.py Tue May 9 17:38:55 2006 @@ -33,7 +33,20 @@ print >>sys.stdout, str(msg) def STDERR(msg): - print >>sys.stderr, str(msg) + print >>sys.stderr, str(msg) + +class Syslog: + for priority in "LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG".split(): + exec("%s = py.std.syslog.%s" % (priority, priority)) + + def __init__(self, priority = None): + self.priority = self.LOG_INFO + if priority is not None: + self.priority = priority + + def __call__(self, msg): + py.std.syslog.syslog(self.priority, str(msg)) + def setconsumer(keywords, consumer): # normalize to tuples From tismer at codespeak.net Thu May 11 15:46:01 2006 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 11 May 2006 15:46:01 +0200 (CEST) Subject: [py-svn] r27079 - py/dist/py/log Message-ID: <20060511134601.998E710082@code0.codespeak.net> Author: tismer Date: Thu May 11 15:46:00 2006 New Revision: 27079 Modified: py/dist/py/log/consumer.py Log: no idea how this is meant to work. Please change that, I just caught AttributeError. I don't think we should patch things easily, where pypy is completely depending on. Modified: py/dist/py/log/consumer.py ============================================================================== --- py/dist/py/log/consumer.py (original) +++ py/dist/py/log/consumer.py Thu May 11 15:46:00 2006 @@ -37,7 +37,10 @@ class Syslog: for priority in "LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG".split(): - exec("%s = py.std.syslog.%s" % (priority, priority)) + try: + exec("%s = py.std.syslog.%s" % (priority, priority)) + except AttributeError: + pass def __init__(self, priority = None): self.priority = self.LOG_INFO From jan at codespeak.net Tue May 30 20:45:27 2006 From: jan at codespeak.net (jan at codespeak.net) Date: Tue, 30 May 2006 20:45:27 +0200 (CEST) Subject: [py-svn] r27939 - in py/dist/py/path/svn: . testing Message-ID: <20060530184527.ED8E310057@code0.codespeak.net> Author: jan Date: Tue May 30 20:45:26 2006 New Revision: 27939 Modified: py/dist/py/path/svn/testing/svntestbase.py py/dist/py/path/svn/urlcommand.py py/dist/py/path/svn/wccommand.py Log: added simple shell escaping for names in svn repositories Modified: py/dist/py/path/svn/testing/svntestbase.py ============================================================================== --- py/dist/py/path/svn/testing/svntestbase.py (original) +++ py/dist/py/path/svn/testing/svntestbase.py Tue May 30 20:45:26 2006 @@ -11,14 +11,14 @@ # cache previously obtained wcs! # def getrepowc(): - repo = py.test.ensuretemp('repo') + repo = py.test.ensuretemp('repo$*hehe') wcdir = py.test.ensuretemp('wc') if not repo.listdir(): #assert not wcdir.check() repo.ensure(dir=1) try: - py.process.cmdexec('svnadmin create "%s"' % repo) - py.process.cmdexec('svnadmin load -q "%s" <"%s"' % (repo, repodump)) + py.process.cmdexec('svnadmin create "%s"' % str(repo).replace('$', '\$')) + py.process.cmdexec('svnadmin load -q "%s" <"%s"' % (str(repo).replace('$', '\$'), repodump)) except py.process.cmdexec.Error: raise repo.remove() Modified: py/dist/py/path/svn/urlcommand.py ============================================================================== --- py/dist/py/path/svn/urlcommand.py (original) +++ py/dist/py/path/svn/urlcommand.py Tue May 30 20:45:26 2006 @@ -25,6 +25,9 @@ self.rev = rev return self + def _escape(self, cmd): + return str(cmd).replace('$', '\$') + def __repr__(self): if self.rev == -1: return 'svnurl(%r)' % self.strpath @@ -47,7 +50,7 @@ def _svnwrite(self, cmd, *args): l = ['svn %s' % cmd] - args = map(lambda x: '"%s"' % str(x), args) + args = map(lambda x: '"%s"' % str(x).replace('$', '\$'), args) l.extend(args) l.append('"%s"' % self._encodedurl()) # fixing the locale because we can't otherwise parse @@ -75,10 +78,10 @@ return os.popen(cmd) if self.rev is None: return popen(svncommon.fixlocale() + - 'svn cat "%s"' % (self.strpath, )) + 'svn cat "%s"' % (self._escape(self.strpath), )) else: return popen(svncommon.fixlocale() + - 'svn cat -r %s "%s"' % (self.rev, self.strpath)) + 'svn cat -r %s "%s"' % (self.rev, self._escape(self.strpath))) def dirpath(self, *args, **kwargs): """ return the directory Path of the current Path joined @@ -104,21 +107,21 @@ if getattr(target, 'rev', None) is not None: raise py.error.EINVAL(target, "revisions are immutable") process.cmdexec('svn copy -m "%s" "%s" "%s"' %(msg, - str(self), str(target))) + self._escape(self), self._escape(target))) self._lsnorevcache.delentry(target.dirpath().strpath) def rename(self, target, msg="renamed by py lib invocation"): if getattr(self, 'rev', None) is not None: raise py.error.EINVAL(self, "revisions are immutable") py.process.cmdexec('svn move -m "%s" --force "%s" "%s"' %( - msg, self, target)) + msg, self._escape(self), self._escape(target))) self._lsnorevcache.delentry(self.dirpath().strpath) self._lsnorevcache.delentry(self.strpath) def remove(self, rec=1, msg='removed by py lib invocation'): if self.rev is not None: raise py.error.EINVAL(self, "revisions are immutable") - process.cmdexec('svn rm -m "%s" "%s"' %(msg, self)) + process.cmdexec('svn rm -m "%s" "%s"' %(msg, self._escape(self))) self._lsnorevcache.delentry(self.dirpath().strpath) def ensure(self, *args, **kwargs): @@ -145,8 +148,8 @@ try: tempdir.ensure(tocreate, dir=dir) cmd = 'svn import -m "%s" "%s" "%s"' % ( - "ensure %s" % tocreate, - tempdir.join(basename), + "ensure %s" % self._escape(tocreate), + self._escape(tempdir.join(basename)), x.join(basename)._encodedurl()) process.cmdexec(cmd) self._lsnorevcache.delentry(x.strpath) # !!! Modified: py/dist/py/path/svn/wccommand.py ============================================================================== --- py/dist/py/path/svn/wccommand.py (original) +++ py/dist/py/path/svn/wccommand.py Tue May 30 20:45:26 2006 @@ -58,9 +58,9 @@ def _svn(self, cmd, *args): l = ['svn %s' % cmd] - args = map(lambda x: '"%s"' % x, args) + args = map(lambda x: '"%s"' % str(x).replace('$', '\$'), args) l.extend(args) - l.append("%s" % self.strpath) + l.append("%s" % self.strpath.replace('$', '\$')) # try fixing the locale because we can't otherwise parse string = svncommon.fixlocale() + " ".join(l) if DEBUG: From jan at codespeak.net Tue May 30 22:04:14 2006 From: jan at codespeak.net (jan at codespeak.net) Date: Tue, 30 May 2006 22:04:14 +0200 (CEST) Subject: [py-svn] r27943 - py/dist/py/path/svn/testing Message-ID: <20060530200414.B2CF410057@code0.codespeak.net> Author: jan Date: Tue May 30 22:04:13 2006 New Revision: 27943 Modified: py/dist/py/path/svn/testing/svntestbase.py Log: make the tests pass again on windows by changing the testdata back to the old state Modified: py/dist/py/path/svn/testing/svntestbase.py ============================================================================== --- py/dist/py/path/svn/testing/svntestbase.py (original) +++ py/dist/py/path/svn/testing/svntestbase.py Tue May 30 22:04:13 2006 @@ -11,7 +11,8 @@ # cache previously obtained wcs! # def getrepowc(): - repo = py.test.ensuretemp('repo$*hehe') + #repo = py.test.ensuretemp('repo$*hehe') + repo = py.test.ensuretemp('repo') wcdir = py.test.ensuretemp('wc') if not repo.listdir(): #assert not wcdir.check()