[pypy-svn] r69148 - in pypy/branch/py11/py/bin: . win32

hpk at codespeak.net hpk at codespeak.net
Wed Nov 11 11:28:15 CET 2009


Author: hpk
Date: Wed Nov 11 11:28:15 2009
New Revision: 69148

Added:
   pypy/branch/py11/py/bin/
   pypy/branch/py11/py/bin/_findpy.py   (contents, props changed)
   pypy/branch/py11/py/bin/env.cmd
   pypy/branch/py11/py/bin/env.py   (contents, props changed)
   pypy/branch/py11/py/bin/py.cleanup   (contents, props changed)
   pypy/branch/py11/py/bin/py.convert_unittest   (contents, props changed)
   pypy/branch/py11/py/bin/py.countloc   (contents, props changed)
   pypy/branch/py11/py/bin/py.lookup   (contents, props changed)
   pypy/branch/py11/py/bin/py.svnwcrevert   (contents, props changed)
   pypy/branch/py11/py/bin/py.test   (contents, props changed)
   pypy/branch/py11/py/bin/py.which   (contents, props changed)
   pypy/branch/py11/py/bin/win32/
   pypy/branch/py11/py/bin/win32/py.cleanup.cmd
   pypy/branch/py11/py/bin/win32/py.convert_unittest.cmd
   pypy/branch/py11/py/bin/win32/py.countloc.cmd
   pypy/branch/py11/py/bin/win32/py.lookup.cmd
   pypy/branch/py11/py/bin/win32/py.svnwcrevert.cmd
   pypy/branch/py11/py/bin/win32/py.test.cmd
   pypy/branch/py11/py/bin/win32/py.which.cmd
Log:
adding bin directory of pytest-1.1.0 checkout to pypy's inlined py directory


Added: pypy/branch/py11/py/bin/_findpy.py
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/_findpy.py	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,37 @@
+#!/usr/bin/env python 
+
+#
+# find and import a version of 'py'
+#
+import sys
+import os
+from os.path import dirname as opd, exists, join, basename, abspath
+
+def searchpy(current):
+    while 1:
+        last = current
+        initpy = join(current, '__init__.py')
+        if not exists(initpy):
+            pydir = join(current, 'py')
+            # recognize py-package and ensure it is importable
+            if exists(pydir) and exists(join(pydir, '__init__.py')):
+                #for p in sys.path:
+                #    if p == current:
+                #        return True
+                if current != sys.path[0]:  # if we are already first, then ok
+                    sys.stderr.write("inserting into sys.path: %s\n" % current)
+                    sys.path.insert(0, current)
+                return True
+        current = opd(current)
+        if last == current:
+            return False
+
+if not searchpy(abspath(os.curdir)):
+    if not searchpy(opd(abspath(sys.argv[0]))):
+        if not searchpy(opd(__file__)):
+            pass # let's hope it is just on sys.path 
+
+import py
+
+if __name__ == '__main__': 
+    print ("py lib is at %s" % py.__file__)

Added: pypy/branch/py11/py/bin/env.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/env.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+for /F "usebackq delims=" %%i in (`python "%~dp0\env.py"`) do %%i

Added: pypy/branch/py11/py/bin/env.py
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/env.py	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import sys, os, os.path
+
+progpath = sys.argv[0]
+packagedir = os.path.dirname(os.path.dirname(os.path.abspath(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_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:
+        assert False, 'Shell not supported.'
+    return cmd
+
+print(prepend_path('PATH', bindir))
+print(prepend_path('PYTHONPATH', rootdir))

Added: pypy/branch/py11/py/bin/py.cleanup
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.cleanup	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pycleanup()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.convert_unittest
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.convert_unittest	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pyconvert_unittest()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.countloc
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.countloc	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pycountloc()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.lookup
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.lookup	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pylookup()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.svnwcrevert
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.svnwcrevert	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pysvnwcrevert()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.test
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.test	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pytest()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/py.which
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/py.which	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+from _findpy import py
+py.cmdline.pywhich()
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.cleanup.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.cleanup.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.cleanup" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.convert_unittest.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.convert_unittest.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.convert_unittest" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.countloc.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.countloc.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.countloc" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.lookup.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.lookup.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.lookup" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.svnwcrevert.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.svnwcrevert.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.svnwcrevert" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.test.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.test.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.test" %*
\ No newline at end of file

Added: pypy/branch/py11/py/bin/win32/py.which.cmd
==============================================================================
--- (empty file)
+++ pypy/branch/py11/py/bin/win32/py.which.cmd	Wed Nov 11 11:28:15 2009
@@ -0,0 +1,2 @@
+ at echo off
+python "%~dp0\..\py.which" %*
\ No newline at end of file



More information about the Pypy-commit mailing list