parent
							
								
									7a461a2f3b
								
							
						
					
					
						commit
						854f6a98ae
					
				|  | @ -1,39 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| 
 |  | ||||||
| # |  | ||||||
| # find and import a version of 'py' that exists in a parent dir |  | ||||||
| # of the current working directory. fall back to import a |  | ||||||
| # globally available version |  | ||||||
| # |  | ||||||
| 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__) |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| for /F "usebackq delims=" %%i in (`python "%~dp0\env.py"`) do %%i |  | ||||||
							
								
								
									
										33
									
								
								bin/env.py
								
								
								
								
							
							
						
						
									
										33
									
								
								bin/env.py
								
								
								
								
							|  | @ -1,33 +0,0 @@ | ||||||
| #!/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)) |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pycleanup() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pyconvert_unittest() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pycountloc() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pylookup() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pysvnwcrevert() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pytest() |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| #!/usr/bin/env python |  | ||||||
| from _findpy import py |  | ||||||
| py.cmdline.pywhich() |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.cleanup" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.convert_unittest" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.countloc" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.lookup" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.svnwcrevert" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.test" %* |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| @echo off |  | ||||||
| python "%~dp0\..\py.which" %* |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| docutils |  | ||||||
| pygments |  | ||||||
| pexpect |  | ||||||
| hg+http://bitbucket.org/hpk42/execnet#egg=execnet |  | ||||||
|  | @ -1,5 +0,0 @@ | ||||||
| docutils |  | ||||||
| pygments |  | ||||||
| pexpect |  | ||||||
| figleaf |  | ||||||
| execnet |  | ||||||
		Loading…
	
		Reference in New Issue