[py-svn] r57358 - in py: build release/0.9.x/py/bin trunk/py/bin trunk/py/bin/win32

hpk at codespeak.net hpk at codespeak.net
Sun Aug 17 17:24:34 CEST 2008


Author: hpk
Date: Sun Aug 17 17:24:29 2008
New Revision: 57358

Added:
   py/build/_docgen.py
      - copied unchanged from r57348, py/release/0.9.x/py/bin/_docgen.py
   py/build/_makepyrelease.py
      - copied unchanged from r57348, py/release/0.9.x/py/bin/_makepyrelease.py
   py/build/_update_website.py
      - copied unchanged from r57348, py/release/0.9.x/py/bin/_update_website.py
Removed:
   py/release/0.9.x/py/bin/_docgen.py
   py/release/0.9.x/py/bin/_makepyrelease.py
   py/release/0.9.x/py/bin/_update_website.py
   py/release/0.9.x/py/bin/pytest.cmd
   py/trunk/py/bin/_docgen.py
   py/trunk/py/bin/_makepyrelease.py
   py/trunk/py/bin/_update_website.py
   py/trunk/py/bin/pytest.cmd
   py/trunk/py/bin/win32/
Modified:
   py/build/gensetup.py
Log:
move more scripts to build directory


Modified: py/build/gensetup.py
==============================================================================
--- py/build/gensetup.py	(original)
+++ py/build/gensetup.py	Sun Aug 17 17:24:29 2008
@@ -15,9 +15,10 @@
 class SetupWriter(object):
     EXCLUDES = ("MANIFEST.in",)
 
-    def __init__(self, wcbasedir, pkg):
+    def __init__(self, wcbasedir, pkg, setuptools=False):
         self.wcbasedir = wcbasedir
         self.basedir = wcbasedir.localpath
+        self.setuptools = setuptools
         assert self.basedir.check()
         self.pkg = pkg
         self.meta = pkg.__pkg__
@@ -66,9 +67,11 @@
                 autogenerated by %(toolname)s, %(toolrevision)s, %(tooltime)s
             """
             import os, sys
-            from distutils.core import setup, Extension
-            from distutils import sysconfig
         ''' % locals())
+        if self.setuptools:
+            self.lines.append("from setuptools import setup, Extension")
+        else:
+            self.lines.append("from distutils.core import setup, Extension")
 
     def setup_trailer(self):
         self.append('''
@@ -211,5 +214,5 @@
     if not wcbasedir.check(versioned=True):
         error("not a svn working copy:%s" % basedir)
     
-    writer = SetupWriter(wcbasedir, py)
+    writer = SetupWriter(wcbasedir, py, setuptools=True)
     writer.write_all()

Deleted: /py/release/0.9.x/py/bin/_docgen.py
==============================================================================
--- /py/release/0.9.x/py/bin/_docgen.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-""" quick tool to get documentation + apigen docs generated
-
-    given a certain targetpath, apigen docs will be placed in 'apigen',
-
-    user can choose to only build either docs or apigen docs: in this case,
-    the navigation bar will be adjusted
-"""
-
-from _findpy import py
-import py
-pypath = py.__pkg__.getpath()
-
-def run_tests(path, envvars='', args=''):
-    pytestpath = pypath.join('bin/py.test')
-    cmd = ('PYTHONPATH="%s" %s python "%s" %s "%s"' %
-            (pypath.dirpath(), envvars, pytestpath, args, path))
-    print cmd
-    py.process.cmdexec(cmd)
-
-def build_apigen_docs(targetpath, testargs=''):
-    run_tests(pypath,
-              'APIGEN_TARGET="%s/apigen" APIGEN_DOCRELPATH="../"' % (
-               targetpath,),
-              '%s --apigen="%s/apigen/apigen.py"' % (testargs, pypath))
-
-def build_docs(targetpath, testargs):
-    docpath = pypath.join('doc')
-    run_tests(docpath, '',
-              testargs + ' --forcegen --apigen="%s/apigen/apigen.py"' % (pypath,))
-    docpath.copy(targetpath)
-
-def build_nav(targetpath, docs=True, api=True):
-    pass
-
-def build(targetpath, docs=True, api=True, testargs=''):
-    targetpath.ensure(dir=True)
-    if docs:
-        print 'building docs'
-        build_docs(targetpath, testargs)
-    if api:
-        print 'building api'
-        build_apigen_docs(targetpath, testargs)
-        
-if __name__ == '__main__':
-    import sys
-    if len(sys.argv) == 1:
-        print 'usage: %s <targetdir> [options]'
-        print
-        print '  targetdir: a path to a directory (created if it doesn\'t'
-        print '             exist) where the docs are put'
-        print '  options: options passed to py.test when running the tests'
-        sys.exit(1)
-    targetpath = py.path.local(sys.argv[1])
-    args = ' '.join(sys.argv[2:])
-    build(targetpath, True, True, args)
-

Deleted: /py/release/0.9.x/py/bin/_makepyrelease.py
==============================================================================
--- /py/release/0.9.x/py/bin/_makepyrelease.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,184 +0,0 @@
-#!/usr/bin/env python 
-
-from _findpy import py
-import sys
-
-pydir = py.path.local(py.__file__).dirpath()
-rootdir = pydir.dirpath()
-
-def gen_manifest(): 
-    pywc = py.path.svnwc(pydir)
-    status = pywc.status(rec=True)
-    #assert not status.modified 
-    #assert not status.deleted  
-    #assert not status.added  
-    versioned = dict([(x.localpath,1) for x in status.allpath()])
-
-    l = []
-    for x in rootdir.visit(None, lambda x: x.basename != '.svn'): 
-        if x.check(file=1): 
-            names = [y.basename for y in x.parts()]
-            if '.svn' in names: 
-                l.append(x) 
-            elif x in versioned: 
-                l.append(x) 
-    l.append(rootdir / "setup.py")
-    l = [x.relto(rootdir) for x in l]
-    l.append("")
-    s = "\n".join(l) 
-    return s 
-
-def trace(arg): 
-    lines = str(arg).split('\n') 
-    prefix = "[trace] "
-    prefix = "* " 
-    indent = len(prefix)  
-    ispace = " " * indent
-    lines = [ispace + line for line in lines]
-    if lines: 
-        lines[0] = prefix + lines[0][indent:]
-    for line in lines: 
-        print >>py.std.sys.stdout, line 
-
-def make_distfiles(tmpdir): 
-    """ return distdir with tar.gz and zipfile. """ 
-    manifest = tmpdir.join('MANIFEST')
-    trace("generating %s" %(manifest,))
-    content = gen_manifest() 
-    manifest.write(content) 
-    trace("wrote %d files into manifest file" %len(content.split('\n')))
-
-    distdir = tmpdir.ensure('dist', dir=1)
-    oldir = rootdir.chdir()
-    try: 
-        from py.__.misc._dist import setup 
-        trace("invoking sdist, generating into %s" % (distdir,)) 
-        setup(py, script_name="setup.py", 
-              script_args=('-q', 'sdist', '--no-prune', 
-                           '-m', str(manifest), 
-                           '--formats=gztar,zip',  
-                           '-d', str(distdir)))
-        setup(py, script_name="setup.py", 
-              script_args=('-q', 'bdist_wininst', 
-                           #'-m', str(manifest), 
-                           '-d', str(distdir)))
-    finally: 
-        oldir.chdir()
-    return distdir 
-
-
-def pytest(unpacked): 
-    trace("py-testing %s" % unpacked)
-    old = unpacked.chdir()
-    try: 
-        import os
-        os.system("python py/bin/py.test py") 
-    finally: 
-        old.chdir()
-    
-def unpackremotetar(tmpdir, strurl): 
-    import tarfile, urllib
-    f = urllib.urlopen(strurl)
-    basename = strurl.split('/')[-1]
-    target = tmpdir.join(basename)
-    trace("downloading %r to %s" %(strurl, target,))
-    target.write(f.read())
-
-    trace("extracting to %s" %(target,))
-    old = tmpdir.chdir()
-    try: 
-        py.process.cmdexec("tar zxf %s" %(target,))
-    finally: 
-        old.chdir()
-    prefix = '.tar.gz'
-    assert basename.endswith(prefix) 
-    stripped = basename[:-len(prefix)]
-    unpacked = tmpdir.join(stripped) 
-    assert unpacked
-    return unpacked 
-       
-def checksvnworks(unpacked): 
-    pywc = py.path.svnwc(unpacked.join('py'))
-    trace("checking versioning works: %s" %(pywc,))
-    status = pywc.status(rec=True)
-    assert not status.modified 
-    assert not status.deleted 
-    assert not status.unknown 
-
-def pytest_remote(address, url): 
-    gw = py.execnet.SshGateway(address)
-    basename = url[url.rfind('/')+1:]
-    purebasename = basename[:-len('.tar.gz')]
-
-    def mytrace(x, l=[]): 
-        l.append(x)
-        if x.endswith('\n'): 
-            trace("".join(l))
-            l[:] = []
-            
-    channel = gw.remote_exec(stdout=mytrace, stderr=sys.stderr, source="""
-        url = %(url)r
-        basename = %(basename)r
-        purebasename = %(purebasename)r
-        import os, urllib
-        f = urllib.urlopen(url) 
-        print "reading from", url 
-        s = f.read()
-        f.close()
-        f = open(basename, 'w')
-        f.write(s) 
-        f.close()
-        if os.path.exists(purebasename):
-            import shutil 
-            shutil.rmtree(purebasename) 
-        os.system("tar zxf %%s" %% (basename,))
-        print "unpacked", purebasename 
-        os.chdir(purebasename)
-        print "testing at %(address)s ..."
-        #os.system("python py/bin/py.test py")
-        import commands
-        status, output = commands.getstatusoutput("python py/bin/py.test py")
-        #print output 
-        print "status:", status
-
-    """ % locals())
-    channel.waitclose(200.0)
-    
-if __name__ == '__main__': 
-    py.magic.invoke(assertion=True) 
-    version = py.std.sys.argv[1]
-    assert py.__pkg__.version == version, (
-            "py package has version %s\nlocation: %s" % 
-            (py.__pkg__.version, pydir))
-
-    tmpdir = py.path.local.get_temproot().join('makepyrelease-%s' % version) 
-    if tmpdir.check(): 
-        trace("removing %s" %(tmpdir,))
-        tmpdir.remove()
-    tmpdir.mkdir() 
-    trace("using tmpdir %s" %(tmpdir,))
-
-    distdir = make_distfiles(tmpdir) 
-    targz = distdir.join('py-%s.tar.gz' % version)
-    zip = distdir.join('py-%s.zip' % version)
-    files = distdir.listdir() 
-    for fn in files: 
-        assert fn.check(file=1) 
-
-    remotedir = 'codespeak.net://www/codespeak.net/htdocs/download/py/' 
-    source = distdir  # " ".join([str(x) for x in files]) 
-    trace("rsyncing %(source)s to %(remotedir)s" % locals())
-    py.process.cmdexec("rsync -avz %(source)s/ %(remotedir)s" % locals())
-
-    ddir = tmpdir.ensure('download', dir=1)
-    URL = py.__pkg__.download_url # 'http://codespeak.net/download/py/' 
-    unpacked = unpackremotetar(ddir, URL)
-    assert unpacked == ddir.join("py-%s" % (version,))
-
-    #checksvnworks(unpacked) 
-    #pytest(unpacked)
-
-    pytest_remote('test at codespeak.net', py.__pkg__.download_url)
-
-
-

Deleted: /py/release/0.9.x/py/bin/_update_website.py
==============================================================================
--- /py/release/0.9.x/py/bin/_update_website.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-
-""" run py.test with the --apigen option and rsync the results to a host
-
-    rsyncs the whole package (with all the ReST docs converted to HTML) as well
-    as the apigen docs to a given remote host and path
-"""
-from _findpy import py
-import py
-import sys
-
-def rsync(pkgpath, apidocspath, gateway, remotepath):
-    """ copy the code and docs to the remote host """
-    # copy to a temp dir first, even though both paths (normally) share the
-    # same parent dir, that may contain other stuff that we don't want to
-    # copy...
-    tempdir = py.test.ensuretemp('update_website_rsync_temp')
-    pkgpath.copy(tempdir.ensure(pkgpath.basename, dir=True))
-    apidocspath.copy(tempdir.ensure(apidocspath.basename, dir=True))
-
-    rs = py.execnet.RSync(tempdir)
-    rs.add_target(gateway, remotepath, delete=True)
-    rs.send()
-
-def run_tests(pkgpath, apigenpath, args='', captureouterr=False):
-    """ run the unit tests and build the docs """
-    pypath = py.__pkg__.getpath()
-    pytestpath = pypath.join('bin/py.test')
-    # XXX this would need a Windows specific version if we want to allow
-    # running this script on that platform, but currently --apigen doesn't
-    # work there anyway...
-    apigenscript = pkgpath.join('apigen/apigen.py') # XXX be more general here?
-    if not apigenscript.check(file=True):
-        apigenscript = pypath.join('apigen/apigen.py')
-    cmd = ('APIGENPATH="%s" PYTHONPATH="%s:%s" python '
-           '"%s" %s --apigen="%s" "%s"' % (apigenpath, pypath.dirpath(),
-                                           pkgpath.dirpath(), pytestpath,
-                                           args, apigenscript,
-                                           pkgpath))
-    if captureouterr:
-        cmd += ' > /dev/null 2>&1'
-    try:
-        output = py.process.cmdexec(cmd)
-    except py.error.Error, e:
-        return e.err or str(e)
-    return None
-
-def main(pkgpath, apidocspath, rhost, rpath, args='', ignorefail=False):
-    print 'running tests'
-    errors = run_tests(pkgpath, apidocspath, args)
-    if errors:
-        print >>sys.stderr, \
-              'Errors while running the unit tests: %s' % (errors,)
-        if not ignorefail:
-            print >>sys.stderr, ('if you want to continue the update '
-                                 'regardless of failures, use --ignorefail')
-            sys.exit(1)
-    
-    print 'rsyncing'
-    gateway = py.execnet.SshGateway(rhost)
-    errors = rsync(pkgpath, apidocspath, gateway, rpath)
-    if errors:
-        print >>sys.stderr, 'Errors while rsyncing: %s'
-        sys.exit(1)
-
-if __name__ == '__main__':
-    args = sys.argv[1:]
-    if '--help' in args or '-h' in args:
-        print 'usage: %s [options]'
-        print
-        print 'run the py lib tests and update the py lib website'
-        print 'options:'
-        print '    --ignorefail: ignore errors in the unit tests and always'
-        print '                  try to rsync'
-        print '    --help: show this message'
-        print
-        print 'any additional arguments are passed on as-is to the py.test'
-        print 'child process'
-        sys.exit()
-    ignorefail = False
-    if '--ignorefail' in args:
-        args.remove('--ignorefail')
-        ignorefail = True
-    args = ' '.join(sys.argv[1:])
-    pkgpath = py.__pkg__.getpath()
-    apidocspath = pkgpath.dirpath().join('apigen')
-    main(pkgpath, apidocspath, 'codespeak.net',
-         '/home/guido/rsynctests', args, ignorefail)
-

Deleted: /py/release/0.9.x/py/bin/pytest.cmd
==============================================================================
--- /py/release/0.9.x/py/bin/pytest.cmd	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,3 +0,0 @@
- at echo off
-python "%~dp0\py.test" %* 
-

Deleted: /py/trunk/py/bin/_docgen.py
==============================================================================
--- /py/trunk/py/bin/_docgen.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-""" quick tool to get documentation + apigen docs generated
-
-    given a certain targetpath, apigen docs will be placed in 'apigen',
-
-    user can choose to only build either docs or apigen docs: in this case,
-    the navigation bar will be adjusted
-"""
-
-from _findpy import py
-import py
-pypath = py.__pkg__.getpath()
-
-def run_tests(path, envvars='', args=''):
-    pytestpath = pypath.join('bin/py.test')
-    cmd = ('PYTHONPATH="%s" %s python "%s" %s "%s"' %
-            (pypath.dirpath(), envvars, pytestpath, args, path))
-    print cmd
-    py.process.cmdexec(cmd)
-
-def build_apigen_docs(targetpath, testargs=''):
-    run_tests(pypath,
-              'APIGEN_TARGET="%s/apigen" APIGEN_DOCRELPATH="../"' % (
-               targetpath,),
-              '%s --apigen="%s/apigen/apigen.py"' % (testargs, pypath))
-
-def build_docs(targetpath, testargs):
-    docpath = pypath.join('doc')
-    run_tests(docpath, '',
-              testargs + ' --forcegen --apigen="%s/apigen/apigen.py"' % (pypath,))
-    docpath.copy(targetpath)
-
-def build_nav(targetpath, docs=True, api=True):
-    pass
-
-def build(targetpath, docs=True, api=True, testargs=''):
-    targetpath.ensure(dir=True)
-    if docs:
-        print 'building docs'
-        build_docs(targetpath, testargs)
-    if api:
-        print 'building api'
-        build_apigen_docs(targetpath, testargs)
-        
-if __name__ == '__main__':
-    import sys
-    if len(sys.argv) == 1:
-        print 'usage: %s <targetdir> [options]'
-        print
-        print '  targetdir: a path to a directory (created if it doesn\'t'
-        print '             exist) where the docs are put'
-        print '  options: options passed to py.test when running the tests'
-        sys.exit(1)
-    targetpath = py.path.local(sys.argv[1])
-    args = ' '.join(sys.argv[2:])
-    build(targetpath, True, True, args)
-

Deleted: /py/trunk/py/bin/_makepyrelease.py
==============================================================================
--- /py/trunk/py/bin/_makepyrelease.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,184 +0,0 @@
-#!/usr/bin/env python 
-
-from _findpy import py
-import sys
-
-pydir = py.path.local(py.__file__).dirpath()
-rootdir = pydir.dirpath()
-
-def gen_manifest(): 
-    pywc = py.path.svnwc(pydir)
-    status = pywc.status(rec=True)
-    #assert not status.modified 
-    #assert not status.deleted  
-    #assert not status.added  
-    versioned = dict([(x.localpath,1) for x in status.allpath()])
-
-    l = []
-    for x in rootdir.visit(None, lambda x: x.basename != '.svn'): 
-        if x.check(file=1): 
-            names = [y.basename for y in x.parts()]
-            if '.svn' in names: 
-                l.append(x) 
-            elif x in versioned: 
-                l.append(x) 
-    l.append(rootdir / "setup.py")
-    l = [x.relto(rootdir) for x in l]
-    l.append("")
-    s = "\n".join(l) 
-    return s 
-
-def trace(arg): 
-    lines = str(arg).split('\n') 
-    prefix = "[trace] "
-    prefix = "* " 
-    indent = len(prefix)  
-    ispace = " " * indent
-    lines = [ispace + line for line in lines]
-    if lines: 
-        lines[0] = prefix + lines[0][indent:]
-    for line in lines: 
-        print >>py.std.sys.stdout, line 
-
-def make_distfiles(tmpdir): 
-    """ return distdir with tar.gz and zipfile. """ 
-    manifest = tmpdir.join('MANIFEST')
-    trace("generating %s" %(manifest,))
-    content = gen_manifest() 
-    manifest.write(content) 
-    trace("wrote %d files into manifest file" %len(content.split('\n')))
-
-    distdir = tmpdir.ensure('dist', dir=1)
-    oldir = rootdir.chdir()
-    try: 
-        from py.__.misc._dist import setup 
-        trace("invoking sdist, generating into %s" % (distdir,)) 
-        setup(py, script_name="setup.py", 
-              script_args=('-q', 'sdist', '--no-prune', 
-                           '-m', str(manifest), 
-                           '--formats=gztar,zip',  
-                           '-d', str(distdir)))
-        setup(py, script_name="setup.py", 
-              script_args=('-q', 'bdist_wininst', 
-                           #'-m', str(manifest), 
-                           '-d', str(distdir)))
-    finally: 
-        oldir.chdir()
-    return distdir 
-
-
-def pytest(unpacked): 
-    trace("py-testing %s" % unpacked)
-    old = unpacked.chdir()
-    try: 
-        import os
-        os.system("python py/bin/py.test py") 
-    finally: 
-        old.chdir()
-    
-def unpackremotetar(tmpdir, strurl): 
-    import tarfile, urllib
-    f = urllib.urlopen(strurl)
-    basename = strurl.split('/')[-1]
-    target = tmpdir.join(basename)
-    trace("downloading %r to %s" %(strurl, target,))
-    target.write(f.read())
-
-    trace("extracting to %s" %(target,))
-    old = tmpdir.chdir()
-    try: 
-        py.process.cmdexec("tar zxf %s" %(target,))
-    finally: 
-        old.chdir()
-    prefix = '.tar.gz'
-    assert basename.endswith(prefix) 
-    stripped = basename[:-len(prefix)]
-    unpacked = tmpdir.join(stripped) 
-    assert unpacked
-    return unpacked 
-       
-def checksvnworks(unpacked): 
-    pywc = py.path.svnwc(unpacked.join('py'))
-    trace("checking versioning works: %s" %(pywc,))
-    status = pywc.status(rec=True)
-    assert not status.modified 
-    assert not status.deleted 
-    assert not status.unknown 
-
-def pytest_remote(address, url): 
-    gw = py.execnet.SshGateway(address)
-    basename = url[url.rfind('/')+1:]
-    purebasename = basename[:-len('.tar.gz')]
-
-    def mytrace(x, l=[]): 
-        l.append(x)
-        if x.endswith('\n'): 
-            trace("".join(l))
-            l[:] = []
-            
-    channel = gw.remote_exec(stdout=mytrace, stderr=sys.stderr, source="""
-        url = %(url)r
-        basename = %(basename)r
-        purebasename = %(purebasename)r
-        import os, urllib
-        f = urllib.urlopen(url) 
-        print "reading from", url 
-        s = f.read()
-        f.close()
-        f = open(basename, 'w')
-        f.write(s) 
-        f.close()
-        if os.path.exists(purebasename):
-            import shutil 
-            shutil.rmtree(purebasename) 
-        os.system("tar zxf %%s" %% (basename,))
-        print "unpacked", purebasename 
-        os.chdir(purebasename)
-        print "testing at %(address)s ..."
-        #os.system("python py/bin/py.test py")
-        import commands
-        status, output = commands.getstatusoutput("python py/bin/py.test py")
-        #print output 
-        print "status:", status
-
-    """ % locals())
-    channel.waitclose(200.0)
-    
-if __name__ == '__main__': 
-    py.magic.invoke(assertion=True) 
-    version = py.std.sys.argv[1]
-    assert py.__pkg__.version == version, (
-            "py package has version %s\nlocation: %s" % 
-            (py.__pkg__.version, pydir))
-
-    tmpdir = py.path.local.get_temproot().join('makepyrelease-%s' % version) 
-    if tmpdir.check(): 
-        trace("removing %s" %(tmpdir,))
-        tmpdir.remove()
-    tmpdir.mkdir() 
-    trace("using tmpdir %s" %(tmpdir,))
-
-    distdir = make_distfiles(tmpdir) 
-    targz = distdir.join('py-%s.tar.gz' % version)
-    zip = distdir.join('py-%s.zip' % version)
-    files = distdir.listdir() 
-    for fn in files: 
-        assert fn.check(file=1) 
-
-    remotedir = 'codespeak.net://www/codespeak.net/htdocs/download/py/' 
-    source = distdir  # " ".join([str(x) for x in files]) 
-    trace("rsyncing %(source)s to %(remotedir)s" % locals())
-    py.process.cmdexec("rsync -avz %(source)s/ %(remotedir)s" % locals())
-
-    ddir = tmpdir.ensure('download', dir=1)
-    URL = py.__pkg__.download_url # 'http://codespeak.net/download/py/' 
-    unpacked = unpackremotetar(ddir, URL)
-    assert unpacked == ddir.join("py-%s" % (version,))
-
-    #checksvnworks(unpacked) 
-    #pytest(unpacked)
-
-    pytest_remote('test at codespeak.net', py.__pkg__.download_url)
-
-
-

Deleted: /py/trunk/py/bin/_update_website.py
==============================================================================
--- /py/trunk/py/bin/_update_website.py	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-
-""" run py.test with the --apigen option and rsync the results to a host
-
-    rsyncs the whole package (with all the ReST docs converted to HTML) as well
-    as the apigen docs to a given remote host and path
-"""
-from _findpy import py
-import py
-import sys
-
-def rsync(pkgpath, apidocspath, gateway, remotepath):
-    """ copy the code and docs to the remote host """
-    # copy to a temp dir first, even though both paths (normally) share the
-    # same parent dir, that may contain other stuff that we don't want to
-    # copy...
-    tempdir = py.test.ensuretemp('update_website_rsync_temp')
-    pkgpath.copy(tempdir.ensure(pkgpath.basename, dir=True))
-    apidocspath.copy(tempdir.ensure(apidocspath.basename, dir=True))
-
-    rs = py.execnet.RSync(tempdir)
-    rs.add_target(gateway, remotepath, delete=True)
-    rs.send()
-
-def run_tests(pkgpath, apigenpath, args='', captureouterr=False):
-    """ run the unit tests and build the docs """
-    pypath = py.__pkg__.getpath()
-    pytestpath = pypath.join('bin/py.test')
-    # XXX this would need a Windows specific version if we want to allow
-    # running this script on that platform, but currently --apigen doesn't
-    # work there anyway...
-    apigenscript = pkgpath.join('apigen/apigen.py') # XXX be more general here?
-    if not apigenscript.check(file=True):
-        apigenscript = pypath.join('apigen/apigen.py')
-    cmd = ('APIGENPATH="%s" PYTHONPATH="%s:%s" python '
-           '"%s" %s --apigen="%s" "%s"' % (apigenpath, pypath.dirpath(),
-                                           pkgpath.dirpath(), pytestpath,
-                                           args, apigenscript,
-                                           pkgpath))
-    if captureouterr:
-        cmd += ' > /dev/null 2>&1'
-    try:
-        output = py.process.cmdexec(cmd)
-    except py.error.Error, e:
-        return e.err or str(e)
-    return None
-
-def main(pkgpath, apidocspath, rhost, rpath, args='', ignorefail=False):
-    print 'running tests'
-    errors = run_tests(pkgpath, apidocspath, args)
-    if errors:
-        print >>sys.stderr, \
-              'Errors while running the unit tests: %s' % (errors,)
-        if not ignorefail:
-            print >>sys.stderr, ('if you want to continue the update '
-                                 'regardless of failures, use --ignorefail')
-            sys.exit(1)
-    
-    print 'rsyncing'
-    gateway = py.execnet.SshGateway(rhost)
-    errors = rsync(pkgpath, apidocspath, gateway, rpath)
-    if errors:
-        print >>sys.stderr, 'Errors while rsyncing: %s'
-        sys.exit(1)
-
-if __name__ == '__main__':
-    args = sys.argv[1:]
-    if '--help' in args or '-h' in args:
-        print 'usage: %s [options]'
-        print
-        print 'run the py lib tests and update the py lib website'
-        print 'options:'
-        print '    --ignorefail: ignore errors in the unit tests and always'
-        print '                  try to rsync'
-        print '    --help: show this message'
-        print
-        print 'any additional arguments are passed on as-is to the py.test'
-        print 'child process'
-        sys.exit()
-    ignorefail = False
-    if '--ignorefail' in args:
-        args.remove('--ignorefail')
-        ignorefail = True
-    args = ' '.join(sys.argv[1:])
-    pkgpath = py.__pkg__.getpath()
-    apidocspath = pkgpath.dirpath().join('apigen')
-    main(pkgpath, apidocspath, 'codespeak.net',
-         '/home/guido/rsynctests', args, ignorefail)
-

Deleted: /py/trunk/py/bin/pytest.cmd
==============================================================================
--- /py/trunk/py/bin/pytest.cmd	Sun Aug 17 17:24:29 2008
+++ (empty file)
@@ -1,3 +0,0 @@
- at echo off
-python "%~dp0\py.test" %* 
-



More information about the pytest-commit mailing list