Skip to content
Browse files

Merge branch 'master' into URL

Conflicts:
	client/pony_client.py
  • Loading branch information...
2 parents 3bc8b9a + b06aea9 commit 9c75629bdb6e402ceab39a870d4bff62cc027c98 @ctb committed Apr 17, 2010
View
45 client/build-mechanize.py
@@ -0,0 +1,45 @@
+#! /usr/bin/env python
+import sys
+import pprint
+from pony_client import BuildCommand, TestCommand, do, send, \
+ TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
+
+options, args = parse_cmdline()
+if args:
+ print 'ignoring command line args: ', args
+
+repo_url = 'http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.1.11.tar.gz'
+
+python_exe = 'python'
+if args:
+ python_exe = args[0]
+
+name = 'mechanize'
+tags = ['mechanize']
+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)
+
+commands = [ SvnCheckout('mechanize', repo_url, name='checkout'),
+ BuildCommand([python_exe, 'setup.py', 'test'])
+ ]
+
+context = TempDirectoryContext()
+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
5 client/build-nose.py → client/build-nose
@@ -14,7 +14,7 @@
repo_url = 'http://bitbucket.org/jpellerin/nose/'
tags = ['nose']
-name = 'build-nose'
+name = 'nose'
server_url = options.server_url
@@ -44,5 +44,4 @@
print '(NOT SENDING BUILD RESULT TO SERVER)'
if not client_info['success']:
- sys.exit(-1)
-
+ sys.exit(-1)
View
9 client/build-quixote
@@ -3,19 +3,16 @@ import sys
import pprint
from pony_client import BuildCommand, TestCommand, do, send, \
TempDirectoryContext, SetupCommand, GitClone, check, parse_cmdline, \
- PythonPackageEgg, test_python_version
+ PythonPackageEgg, get_python_version
options, _ = parse_cmdline()
python_exe = options.python_executable
-if not test_python_version(python_exe):
- print "Unable to find " + python_exe + ". Failing..."
- sys.exit(1)
-
repo_url = 'git://quixote.ca/quixote'
-tags = [python_exe] + options.tagset
+python_ver = 'python' + get_python_version(python_exe)
+tags = [python_ver] + options.tagset
name = 'quixote'
server_url = options.server_url
View
2 client/build-twill
@@ -5,8 +5,6 @@ from pony_client import BuildCommand, TestCommand, do, send, \
TempDirectoryContext, SetupCommand, SvnCheckout, check, parse_cmdline
options, args = parse_cmdline()
-if args:
- print 'ignoring command line args: ', args
repo_url = 'http://twill.googlecode.com/svn/branches/0.9.2-dev/twill'
View
44 client/pony_client.py
@@ -223,9 +223,6 @@ def __init__(self, always_cleanup=True, dependencies=[], optional=[],
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')
@@ -849,6 +846,8 @@ def send(server_url, x, hostname=None, tags=()):
_upload_file(server_url, fileobj, auth_key)
def check(name, server_url, tags=(), hostname=None, arch=None, reserve_time=0):
+ import socket
+
if hostname is None:
hostname = get_hostname()
@@ -858,7 +857,12 @@ def check(name, server_url, tags=(), hostname=None, arch=None, reserve_time=0):
client_info = dict(package=name, host=hostname, arch=arch, tags=tags)
server_url = get_server_url(server_url)
s = xmlrpclib.ServerProxy(server_url, allow_none=True)
- (flag, reason) = s.check_should_build(client_info, True, reserve_time)
+ try:
+ (flag, reason) = s.check_should_build(client_info, True, reserve_time)
+ except socket.error:
+ log_critical('cannot connect to pony-build server: %s' % server_url)
+ sys.exit(-1)
+
return flag
def get_server_url(server_name):
@@ -892,7 +896,7 @@ def parse_cmdline(argv=[]):
help='do not clean up the temp directory')
cmdline.add_option('-s', '--server-url', dest='server_url',
- action='store', default='default',
+ action='store', default='pb-dev',
help='set pony-build server URL for reporting results')
cmdline.add_option('-v', '--verbose', dest='verbose',
@@ -910,9 +914,6 @@ def parse_cmdline(argv=[]):
cmdline.add_option('-t', '--tagset', dest='tagset',
action='store', default=[],
help='comma-delimited list of tags to be applied')
- cmdline.add_option('-l', '--log-level', dest='log_level',
- action='store', default='WARNING_LEVEL',
- help='Change the amount of output you get during build process.')
if not argv:
(options, args) = cmdline.parse_args()
@@ -943,13 +944,28 @@ def parse_cmdline(argv=[]):
###
+class PythonVersionNotFound(Exception):
+ def __init__(self, python_exe):
+ self.python_exe = python_exe
+ def __str__(self):
+ return repr(self.python_exe + " not found on system.")
+
-def test_python_version(python_exe):
- result = subprocess.Popen(python_exe + " -c \"print 'hello, world'\"", shell=True, \
- stdout=subprocess.PIPE).communicate()
- if result[0] != "hello, world\n":
- return False
- return True
+def get_python_version(python_exe='python'):
+ """
+ Return the major.minor number for the given Python executable.
+ """
+
+ cmd = python_exe + " -c \"import sys \nprint" \
+ " str(sys.version_info[0]) + '.' + str(sys.version_info[1])\""
+
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+
+ if not stdout:
+ raise PythonVersionNotFound(python_exe)
+
+ return stdout.strip()
###
View
9 client/test_client/__init__.py
@@ -1,4 +1,13 @@
+import sys
import pony_client
def setup():
pony_client.set_log_level(pony_client.DEBUG_LEVEL)
+
+def test_python_version():
+ my_version = "%d.%d" % (sys.version_info[:2])
+
+ reported_version = pony_client.get_python_version(sys.executable)
+ reported_version = reported_version
+
+ assert my_version == reported_version, (my_version, reported_version)
View
6 pony_build/web/run.py
@@ -11,6 +11,9 @@
help='interface to bind', default='localhost')
parser.add_option('-p', '--port', dest='port', help='port to bind',
type='int', default='5000')
+ parser.add_option('-f', '--dbfile', dest='dbfile',
+ help='database filename', type='string',
+ default=':memory:')
parser.add_option('-u', '--url', dest='url', help='public URL',
default=None)
parser.add_option('-P', '--use-pubsubhubbub', dest='use_pubsubhubbub',
@@ -22,11 +25,10 @@
(options, args) = parser.parse_args()
- dbfile=args[0]
push_server = None
if options.use_pubsubhubbub:
push_server = options.push_server
- qx_web.run(options.interface, options.port, dbfile, public_url=options.url,
+ qx_web.run(options.interface, options.port, options.dbfile, public_url=options.url,
pubsubhubbub_server=push_server)

0 comments on commit 9c75629

Please sign in to comment.
Something went wrong with that request. Please try again.