[pypy-svn] r41423 - in pypy/build/buildtool/testproject: . bin
guido at codespeak.net
guido at codespeak.net
Mon Mar 26 21:39:23 CEST 2007
Author: guido
Date: Mon Mar 26 21:39:21 2007
New Revision: 41423
Modified:
pypy/build/buildtool/testproject/bin/autopath.py
pypy/build/buildtool/testproject/bin/buildserver.py
pypy/build/buildtool/testproject/bin/metaserver.py
pypy/build/buildtool/testproject/bin/startcompile.py
pypy/build/buildtool/testproject/config.py
Log:
Adjusted paths after the SVN move.
Modified: pypy/build/buildtool/testproject/bin/autopath.py
==============================================================================
--- pypy/build/buildtool/testproject/bin/autopath.py (original)
+++ pypy/build/buildtool/testproject/bin/autopath.py Mon Mar 26 21:39:21 2007
@@ -1,114 +1,3 @@
-"""
-self cloning, automatic path configuration
-
-copy this into any subdirectory of pypy from which scripts need
-to be run, typically all of the test subdirs.
-The idea is that any such script simply issues
-
- import autopath
-
-and this will make sure that the parent directory containing "pypy"
-is in sys.path.
-
-If you modify the master "autopath.py" version (in pypy/tool/autopath.py)
-you can directly run it which will copy itself on all autopath.py files
-it finds under the pypy root directory.
-
-This module always provides these attributes:
-
- pypydir pypy root directory path
- this_dir directory where this autopath.py resides
-
-"""
-
-
-def __dirinfo(part):
- """ return (partdir, this_dir) and insert parent of partdir
- into sys.path. If the parent directories don't have the part
- an EnvironmentError is raised."""
-
- import sys, os
- try:
- head = this_dir = os.path.realpath(os.path.dirname(__file__))
- except NameError:
- head = this_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
-
- while head:
- partdir = head
- head, tail = os.path.split(head)
- if tail == part:
- break
- else:
- raise EnvironmentError, "'%s' missing in '%r'" % (partdir, this_dir)
-
- pypy_root = os.path.join(head, '')
- try:
- sys.path.remove(head)
- except ValueError:
- pass
- sys.path.insert(0, head)
-
- munged = {}
- for name, mod in sys.modules.items():
- if '.' in name:
- continue
- fn = getattr(mod, '__file__', None)
- if not isinstance(fn, str):
- continue
- newname = os.path.splitext(os.path.basename(fn))[0]
- if not newname.startswith(part + '.'):
- continue
- path = os.path.join(os.path.dirname(os.path.realpath(fn)), '')
- if path.startswith(pypy_root) and newname != part:
- modpaths = os.path.normpath(path[len(pypy_root):]).split(os.sep)
- if newname != '__init__':
- modpaths.append(newname)
- modpath = '.'.join(modpaths)
- if modpath not in sys.modules:
- munged[modpath] = mod
-
- for name, mod in munged.iteritems():
- if name not in sys.modules:
- sys.modules[name] = mod
- if '.' in name:
- prename = name[:name.rfind('.')]
- postname = name[len(prename)+1:]
- if prename not in sys.modules:
- __import__(prename)
- if not hasattr(sys.modules[prename], postname):
- setattr(sys.modules[prename], postname, mod)
-
- return partdir, this_dir
-
-def __clone():
- """ clone master version of autopath.py into all subdirs """
- from os.path import join, walk
- if not this_dir.endswith(join('pypy','tool')):
- raise EnvironmentError("can only clone master version "
- "'%s'" % join(pypydir, 'tool',_myname))
-
-
- def sync_walker(arg, dirname, fnames):
- if _myname in fnames:
- fn = join(dirname, _myname)
- f = open(fn, 'rwb+')
- try:
- if f.read() == arg:
- print "checkok", fn
- else:
- print "syncing", fn
- f = open(fn, 'w')
- f.write(arg)
- finally:
- f.close()
- s = open(join(pypydir, 'tool', _myname), 'rb').read()
- walk(pypydir, sync_walker, s)
-
-_myname = 'autopath.py'
-
-# set guaranteed attributes
-
-pypydir, this_dir = __dirinfo('pypy')
-
-if __name__ == '__main__':
- __clone()
+import sys
+import py
+sys.path.append(py.magic.autopath().dirpath().dirpath().dirpath().dirpath().strpath)
Modified: pypy/build/buildtool/testproject/bin/buildserver.py
==============================================================================
--- pypy/build/buildtool/testproject/bin/buildserver.py (original)
+++ pypy/build/buildtool/testproject/bin/buildserver.py Mon Mar 26 21:39:21 2007
@@ -3,7 +3,7 @@
import autopath
import py
from py.execnet import PopenGateway
-from pypy.tool.build import outputbuffer
+from buildtool import outputbuffer
def compile(wc, compileinfo, buildpath):
code = """\
@@ -44,9 +44,9 @@
if __name__ == '__main__':
# main bit
- from pypy.tool.build.bin import path
- from pypy.tool.build.testproject import config
- from pypy.tool.build.buildserver import main
+ from buildtool.bin import path
+ from buildtool.testproject import config
+ from buildtool.buildserver import main
main(config, path, compile)
Modified: pypy/build/buildtool/testproject/bin/metaserver.py
==============================================================================
--- pypy/build/buildtool/testproject/bin/metaserver.py (original)
+++ pypy/build/buildtool/testproject/bin/metaserver.py Mon Mar 26 21:39:21 2007
@@ -1,8 +1,8 @@
#!/usr/bin/env python
import autopath
-from pypy.tool.build.testproject import config
-from pypy.tool.build.metaserver import main
+from buildtool.testproject import config
+from buildtool.metaserver import main
print 'buildpath:', config.buildpath
Modified: pypy/build/buildtool/testproject/bin/startcompile.py
==============================================================================
--- pypy/build/buildtool/testproject/bin/startcompile.py (original)
+++ pypy/build/buildtool/testproject/bin/startcompile.py Mon Mar 26 21:39:21 2007
@@ -1,8 +1,8 @@
#!/usr/bin/env python
import autopath
-from pypy.tool.build.testproject import config
-from pypy.tool.build.compile import main, getrequest
+from buildtool.testproject import config
+from buildtool.compile import main, getrequest
from py.execnet import SshGateway, PopenGateway
request, foreground = getrequest(config)
Modified: pypy/build/buildtool/testproject/config.py
==============================================================================
--- pypy/build/buildtool/testproject/config.py (original)
+++ pypy/build/buildtool/testproject/config.py Mon Mar 26 21:39:21 2007
@@ -1,6 +1,6 @@
import py
-packageparent = py.magic.autopath().dirpath().dirpath().dirpath().dirpath().dirpath()
+packageparent = py.magic.autopath().dirpath().dirpath().dirpath()
# general settings, used by both server and client
server = 'localhost'
@@ -32,14 +32,14 @@
# settings for the server
projectname = 'testproject'
-buildpath = packageparent.ensure('/pypy/tool/build/testproject/builds',
+buildpath = packageparent.ensure('buildtool/testproject/builds',
dir=True)
mailhost = 'localhost'
mailport = 25
mailfrom = 'guido at codespeak.net'
# this var is only used below
-svnroot = 'http://codespeak.net/svn/pypy/dist/pypy/tool/build/testproject'
+svnroot = 'http://codespeak.net/svn/pypy/build/buildtool/testproject'
# when considering a compile job, the checkers below will be called (with
# request as only arg), if one of them returns False the compilation will
@@ -63,5 +63,5 @@
return 'http://localhost/testproject/%s/data.zip' % (
p.relto(py.magic.autopath().dirpath()),)
-configpath = 'pypy.tool.build.testproject.config'
+configpath = 'buildtool.testproject.config'
More information about the Pypy-commit
mailing list