Permalink
Browse files

Merge git://github.com/ctb/pony-build into ctbnew

  • Loading branch information...
2 parents f094493 + 95d0911 commit 42c63df05ebd3689b4d1be54364d86a79d974b8d @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
@@ -223,7 +223,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
@@ -236,9 +236,14 @@ def __init__(self, always_cleanup=True, dependencies=[], optional=[],
self.tempdir = tempfile.mkdtemp()
- log_inf('creating virtualenv')
- cmdlist = [python, '-m', 'virtualenv', '--no-site-packages',
- self.tempdir]
+ log_info('creating virtualenv')
+
+ 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:
@@ -252,6 +257,7 @@ 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)
@@ -399,6 +405,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'
@@ -678,7 +711,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,
@@ -874,6 +910,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')
@@ -893,9 +933,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 42c63df

Please sign in to comment.