Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into k_test1

  • Loading branch information...
commit 45fe10b3727da6e9e09655c218dafa1be83d3986 2 parents 0b6ee3c + a2add04
@ctb authored
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
48 client/pony_client.py
@@ -17,10 +17,12 @@
from optparse import OptionParser
import pprint
import glob
+import datetime
+import signal
pb_servers = {
'pb-dev' : 'http://lyorn.idyll.org/ctb/pb-dev/xmlrpc',
- 'local' : 'http://localhost:8000/xmlrpc'
+ 'local' : 'http://localhost:8080/xmlrpc'
}
pb_servers['default'] = pb_servers['pb-dev']
@@ -91,7 +93,10 @@ def _replace_variables(cmd, variables_d):
cmd = variables_d[cmd[3:]]
return cmd
-def _run_command(command_list, cwd=None, variables=None, extra_kwargs={}):
+
+def _run_command(command_list, timeout=None, cwd=None, variables=None, extra_kwargs={},
+ verbose=False):
+
if variables:
x = []
for cmd in command_list:
@@ -839,6 +844,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()
@@ -848,12 +855,18 @@ 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):
try_url = urlparse.urlparse(server_name)
if try_url[0]: # urlparse -> scheme
+ server_name = urlparse.urljoin(server_name, 'xmlrpc')
server_url = server_name
else: # not a URL?
server_url = pb_servers[server_name]
@@ -882,7 +895,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',
@@ -930,13 +943,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)
Please sign in to comment.
Something went wrong with that request. Please try again.