[Python-checkins] devinabox: Re-arrange executable discovery code.
brett.cannon
python-checkins at python.org
Mon Feb 28 23:03:51 CET 2011
brett.cannon pushed 817d54b6da18 to devinabox:
http://hg.python.org/devinabox/rev/817d54b6da18
changeset: 28:817d54b6da18
user: Brett Cannon <brett at python.org>
date: Sat Feb 26 21:13:55 2011 -0800
summary:
Re-arrange executable discovery code.
files:
build_cpython.py
make_a_box.py
run_all_tests.py
diff --git a/build_cpython.py b/build_cpython.py
--- a/build_cpython.py
+++ b/build_cpython.py
@@ -5,6 +5,25 @@
import subprocess
import sys
+
+def executable():
+ directory = 'cpython'
+ cmd = os.path.join(directory, 'python')
+ # UNIX
+ if not os.path.isfile(cmd):
+ # OS X
+ cmd += '.exe'
+ if not os.path.isfile(cmd):
+ # 32-bit Windows
+ cmd = os.path.join(directory, 'PCBuild', 'python_d.exe')
+ if not os.path.isfile(cmd):
+ # 64-bit Windows
+ cmd = os.path.join(directory, 'PCBuild', 'AMD64', 'python_d.exe')
+ if not os.path.isfile(cmd):
+ return None
+ return os.path.abspath(cmd)
+
+
def main():
if sys.platform == 'win32':
print("See the devguide's Getting Set Up guide for building under "
@@ -23,6 +42,9 @@
subprocess.call(make_cmd)
finally:
os.chdir(cwd)
+ return executable
if __name__ == '__main__':
- main()
+ if not main():
+ print('No executable found')
+ sys.exit(1)
diff --git a/make_a_box.py b/make_a_box.py
--- a/make_a_box.py
+++ b/make_a_box.py
@@ -25,7 +25,6 @@
import webbrowser
import xmlrpc.client
import build_cpython
-import run_all_tests
def rename(new_name):
@@ -123,6 +122,7 @@
url, self.directory))
+# XXX test
@rename('coverage.py')
class CoveragePy(HgProvider):
@@ -135,9 +135,8 @@
def build(self):
"""Run coverage over CPython."""
# Build Python
- build_cpython.main()
+ executable = build_cpython.main()
# Run coverage
- executable = run_all_tests.executable()
if not executable:
print('No CPython executable found')
sys.exit(1)
diff --git a/run_all_tests.py b/run_all_tests.py
--- a/run_all_tests.py
+++ b/run_all_tests.py
@@ -1,29 +1,12 @@
#!/usr/bin/env python
"""Run CPython's test suite in the most rigorous way possible."""
import multiprocessing
-import os
import subprocess
import sys
+import build_cpython
-def executable():
- directory = 'cpython'
- cmd = os.path.join(directory, 'python')
- # UNIX
- if not os.path.isfile(cmd):
- # OS X
- cmd += '.exe'
- if not os.path.isfile(cmd):
- # 32-bit Windows
- cmd = os.path.join(directory, 'PCBuild', 'python_d.exe')
- if not os.path.isfile(cmd):
- # 64-bit Windows
- cmd = os.path.join(directory, 'PCBuild', 'AMD64', 'python_d.exe')
- if not os.path.isfile(cmd):
- return None
- return os.path.abspath(cmd)
-
-if __name__ == '__main__':
+def main():
cmd = executable()
if cmd is None:
print('CPython is not built')
@@ -31,3 +14,7 @@
subprocess.call([cmd, '-W', 'default', '-bb', '-E', '-m', 'test', '-r',
'-w', '-u', 'all', '-j',
str(multiprocessing.cpu_count())])
+
+
+if __name__ == '__main__':
+ main()
--
Repository URL: http://hg.python.org/devinabox
More information about the Python-checkins
mailing list