Permalink
Browse files

Merge branch 'jack'

  • Loading branch information...
ctb committed Apr 17, 2010
2 parents 5efa07d + 33d19eb commit 15c5add9011c2fbd8b2cf3ac8923f7149dd72ac7
Showing with 35 additions and 14 deletions.
  1. +3 −6 client/build-quixote
  2. +23 −8 client/pony_client.py
  3. +9 −0 client/test_client/__init__.py
View
@@ -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
@@ -22,7 +22,7 @@
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']
@@ -887,7 +887,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='local',
help='set pony-build server URL for reporting results')
cmdline.add_option('-v', '--verbose', dest='verbose',
@@ -935,13 +935,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()
###
@@ -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)

0 comments on commit 15c5add

Please sign in to comment.