Permalink
Browse files

Merge branch 'ctbnew' into URL

Conflicts:
	client/pony_client.py
  • Loading branch information...
2 parents bc47723 + 42c63df commit 953965cf9451c2091c16b47466678293bd4c8ebf @mlaite mlaite committed Apr 10, 2010
View
@@ -0,0 +1,53 @@
+#! /usr/bin/env python
+import sys, os
+import pprint
+from pony_client import BuildCommand, TestCommand, do, send, \
+ VirtualenvContext, SetupCommand, GitClone, check, parse_cmdline, \
+ PythonPackageEgg
+
+options, args = parse_cmdline()
+
+python_exe = 'python2.5'
+if args:
+ python_exe = args[0]
+
+repo_url = 'git://github.com/ctb/Caper.git'
+
+# for installation by pip
+screed_repo = 'git+git://github.com/acr/screed.git'
+
+tags = [python_exe]
+name = 'caper'
+
+server_url = options.server_url
+
+if not options.force_build:
+ if not check(name, server_url, tags=tags):
+ print 'check build says no need to build; bye'
+ sys.exit(0)
+
+# requires pygr, which isn't pip-installable; include_site_packages.
+context = VirtualenvContext(dependencies=['nose', screed_repo],
+ include_site_packages=True,
+ python=python_exe,
+ always_cleanup=options.cleanup_temp)
+
+commands = [ GitClone(repo_url, name='checkout'),
+ BuildCommand(['make', 'clean', 'all'], run_cwd='Pyrex'),
+ BuildCommand(['make', 'tests'], run_cwd='Pyrex') ]
+
+results = do(name, commands, context=context)
+client_info, reslist, files = results
+
+if options.report:
+ print 'result: %s; sending' % (client_info['success'],)
+ send(server_url, results, tags=tags)
+else:
+ print 'build result:'
+ pprint.pprint(client_info)
+ pprint.pprint(reslist)
+
+ print '(NOT SENDING BUILD RESULT TO SERVER)'
+
+if not client_info['success']:
+ sys.exit(-1)
View
@@ -3,7 +3,7 @@ import sys
import distutils
import pprint
from pony_client import BuildCommand, TestCommand, do, send, \
- TempDirectoryContext, SetupCommand, SvnUpdate, check, parse_cmdline
+ TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
options, args = parse_cmdline()
if args:
@@ -29,7 +29,7 @@ if distutils.util.get_platform().startswith('macosx'):
built_exe = './python.exe'
context = TempDirectoryContext()
-commands = [ SvnUpdate('python27', repo_url, name='checkout'),
+commands = [ SvnCheckout('python27', repo_url, name='checkout'),
BuildCommand(['./configure'], name='configure'),
BuildCommand(['make'], name='make'),
TestCommand([built_exe, 'Lib/test/regrtest.py'], name='regrtest')
View
@@ -2,7 +2,7 @@
import sys
import distutils
from pony_client import BuildCommand, TestCommand, do, send, \
- Context, TempDirectoryContext, SetupCommand, SvnUpdate, check, parse_cmdline
+ Context, TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
options, args = parse_cmdline()
if args:
@@ -24,7 +24,7 @@ if not options.force_build:
context = Context()
-#SvnUpdate('python27', repo_url, name='checkout', cache_dir='~/.pony-build/python27'),
+#SvnCheckout('python27', repo_url, name='checkout', cache_dir='~/.pony-build/python27'),
commands = [
BuildCommand(['build.bat'], name='build.bat', run_cwd='pcbuild', subprocess_kwargs=dict(shell=True), ignore_failure=True, verbose=True),
View
@@ -3,7 +3,7 @@ import sys
import pprint
import distutils
from pony_client import BuildCommand, TestCommand, do, send, \
- TempDirectoryContext, SetupCommand, SvnUpdate, check, parse_cmdline
+ TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
options, args = parse_cmdline()
if args:
@@ -29,7 +29,7 @@ if distutils.util.get_platform().startswith('macosx'):
built_exe = './python.exe'
context = TempDirectoryContext()
-commands = [ SvnUpdate('python32', repo_url, name='checkout'),
+commands = [ SvnCheckout('python32', repo_url, name='checkout'),
BuildCommand(['./configure'], name='configure'),
BuildCommand(['make'], name='make'),
TestCommand([built_exe, 'Lib/test/regrtest.py'], name='regrtest')
View
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+import sys
+import pprint
+from pony_client import BuildCommand, TestCommand, do, send, \
+ VirtualenvContext, SetupCommand, GitClone, check, parse_cmdline, \
+ PythonPackageEgg
+
+options, args = parse_cmdline()
+
+python_exe = 'python2.5'
+if args:
+ python_exe = args[0]
+
+repo_url = 'git://github.com/ctb/screed.git'
+
+tags = [python_exe]
+name = 'screed'
+
+server_url = options.server_url
+
+if not options.force_build:
+ if not check(name, server_url, tags=tags):
+ print 'check build says no need to build; bye'
+ sys.exit(0)
+
+# requires pygr, which isn't pip-installable.
+context = VirtualenvContext(dependencies=['nose'], include_site_packages=True,
+ python=python_exe)
+commands = [ GitClone(repo_url, name='checkout'),
+ BuildCommand([python_exe, 'setup.py', 'install']),
+ TestCommand(['nosetests'], name='run tests'),
+ PythonPackageEgg(python_exe) ]
+
+results = do(name, commands, context=context)
+client_info, reslist, files = results
+
+if options.report:
+ print 'result: %s; sending' % (client_info['success'],)
+ send(server_url, results, tags=tags)
+else:
+ print 'build result:'
+ pprint.pprint(client_info)
+ pprint.pprint(reslist)
+
+ print '(NOT SENDING BUILD RESULT TO SERVER)'
+
+if not client_info['success']:
+ sys.exit(-1)
View
@@ -2,7 +2,7 @@
import sys
import pprint
from pony_client import BuildCommand, TestCommand, do, send, \
- TempDirectoryContext, SetupCommand, SvnUpdate, check, parse_cmdline
+ TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
options, args = parse_cmdline()
if args:
@@ -23,7 +23,7 @@ if not options.force_build:
print 'check build says no need to build; bye'
sys.exit(0)
-commands = [ SvnUpdate('twill', repo_url, name='checkout'),
+commands = [ SvnCheckout('twill', repo_url, name='checkout'),
BuildCommand([python_exe, 'setup.py', 'test'])
]
View
@@ -1,7 +1,7 @@
#! /usr/bin/env python
import sys
from pony_client import BuildCommand, TestCommand, do, send, check, \
- TempDirectoryContext, SetupCommand, SvnUpdate, parse_cmdline
+ TempDirectoryContext, SetupCommand, SvnCheckout, parse_cmdline
options, args = parse_cmdline()
@@ -22,7 +22,7 @@ if not options.force_build:
context = TempDirectoryContext()
-commands = [ SvnUpdate('Zope', repo_url, name='checkout'),
+commands = [ SvnCheckout('Zope', repo_url, name='checkout'),
BuildCommand(['python', 'setup.py', 'install']),
TestCommand([python_exe, 'src/Testing/tests/test_makerequest.py'], name='test')
]
View
@@ -26,7 +26,7 @@
}
pb_servers['default'] = pb_servers['pb-dev']
-error_state = False
+
###
DEBUG_LEVEL = 5
@@ -208,7 +208,7 @@ class VirtualenvContext(Context):
VirtualenvContext works by modifying the path to the Python executable.
"""
def __init__(self, always_cleanup=True, dependencies=[], optional=[],
- python='python'):
+ python='python', include_site_packages=False):
Context.__init__(self)
self.cleanup = always_cleanup
self.dependencies = dependencies
@@ -222,8 +222,16 @@ def __init__(self, always_cleanup=True, dependencies=[], optional=[],
self.tempdir = tempfile.mkdtemp()
log_info('creating virtualenv')
+
cmdlist = [python, '-m', 'virtualenv', '--no-site-packages',
self.tempdir]
+
+ cmdlist = list([python, '-m', 'virtualenv'])
+ if not include_site_packages:
+ cmdlist.append('--no-site-packages')
+
+ cmdlist.append(self.tempdir)
+
(ret, out, err) = _run_command(cmdlist)
if ret != 0:
@@ -237,10 +245,11 @@ def __init__(self, always_cleanup=True, dependencies=[], optional=[],
self.pip = os.path.join(bindir, 'pip')
os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH']
+ log_debug("modified PATH to include virtualenv bindir: '%s'" % bindir)
def initialize(self):
Context.initialize(self)
- global error_state
+
log_info('changing to temp directory:', self.tempdir)
self.cwd = os.getcwd()
@@ -259,10 +268,7 @@ def initialize(self):
dep])
if ret != 0:
- error_state = True
- print 'about to break'
- log_critical('pip could not install req dependency: %s' % dep)
- break
+ raise Exception("pip cannot install req dependency: %s" % dep)
for dep in self.optional:
log_info("installing optional dependency:", dep)
@@ -388,6 +394,33 @@ class TestCommand(BaseCommand):
command_type = 'test'
command_name = 'test'
+class CopyLocalDir(BuildCommand):
+ def __init__(self, fromdir, to_name):
+ self.ignore_failure = False
+ self.fromdir = fromdir
+ self.to_name = to_name
+ self.results_dict = dict(fromdir=fromdir, to_name=to_name)
+
+ def run(self, context):
+ self.results_dict['out'] = self.results_dict['errout'] = ''
+
+ try:
+ shutil.copytree(self.fromdir, self.to_name)
+ context.build_dir = os.path.join(os.getcwd(), 'Caper')
+ self.status = 0
+ except Exception, e:
+ self.errout = str(e)
+ self.status = 1
+
+ def get_results(self):
+ self.results_dict['status'] = self.status
+ self.results_dict['type'] = self.command_type
+ self.results_dict['name'] = self.command_name
+
+ return self.results_dict
+
+
+
class PythonPackageEgg(BaseCommand):
command_type = 'package'
command_name = 'package_egg'
@@ -667,7 +700,10 @@ def get_dirname(self):
return self.dirname
def update_repository(self):
- cmdlist = ['svn', 'update', '--accept', 'theirs-full']
+ # adding '--accept', 'theirs-full' is a good idea for newer versions
+ # of svn; this automatically accepts dodgy security certs.
+ cmdlist = ['svn', 'update']
+
(ret, out, err) = _run_command(cmdlist)
self.results_dict['svn update'] = dict(status=ret, output=out,
@@ -757,18 +793,7 @@ def do(name, commands, context=None, arch=None, stop_if_failure=True):
if context:
context.initialize()
- print 'error_state:',error_state
- if error_state:
- context.finish()
- success = False
- arch = get_arch()
- client_info = dict(package=name, arch=arch, success=success)
- print 'client_info:',client_info
- context.update_client_info(client_info)
- files_to_upload = None
- return (client_info, reslist, files_to_upload)
-
for c in commands:
log_debug('running:', str(c))
if context:
@@ -874,6 +899,10 @@ def parse_cmdline(argv=[]):
action='store_true', default=False,
help='set verbose reporting')
+ cmdline.add_option('--debug', dest='debug',
+ action='store_true', default=False,
+ help='set debug reporting')
+
cmdline.add_option('-e', '--python-executable', dest='python_executable',
action='store', default='python',
help='override the version of python used to build with')
@@ -896,9 +925,18 @@ def parse_cmdline(argv=[]):
# there should be nothing in args.
# if there is, print a warning, then crash and burn.
- if args:
- print "Error--unknown arguments detected. Failing..."
- sys.exit(0)
+ #if args:
+ # print "Error--unknown arguments detected. Failing..."
+ # sys.exit(0)
+
+ if options.verbose:
+ set_log_level(INFO_LEVEL)
+
+ if options.debug:
+ set_log_level(DEBUG_LEVEL)
+
+ if not options.report:
+ options.force_build = True
return options, args
Oops, something went wrong.

0 comments on commit 953965c

Please sign in to comment.