[Python-checkins] devinabox: Modularize build_cpython.py.

brett.cannon python-checkins at python.org
Mon Feb 28 23:03:51 CET 2011


brett.cannon pushed 2396229f0a74 to devinabox:

http://hg.python.org/devinabox/rev/2396229f0a74
changeset:   13:2396229f0a74
user:        Brett Cannon <brett at python.org>
date:        Sat Feb 26 13:04:19 2011 -0800
summary:
  Modularize build_cpython.py.

files:
  build_cpython.py

diff --git a/build_cpython.py b/build_cpython.py
--- a/build_cpython.py
+++ b/build_cpython.py
@@ -5,19 +5,24 @@
 import subprocess
 import sys
 
-if sys.platform == 'win32':
-    print("See the devguide's Getting Set Up guide for building under Windows")
+def main():
+    if sys.platform == 'win32':
+        print("See the devguide's Getting Set Up guide for building under "
+              "Windows")
 
-directory = 'cpython'
-cwd = os.getcwd()
-os.chdir(directory)
-try:
-    if os.path.isfile('Makefile'):
-        print('Makefile already exists; skipping ./configure')
-    else:
-        subprocess.check_call(['./configure', '--prefix=/dev/null',
-                               '--with-pydebug'])
-    make_cmd = ['make', '-s', '-j', str(multiprocessing.cpu_count())]
-    subprocess.call(make_cmd)
-finally:
-    os.chdir(cwd)
+    directory = 'cpython'
+    cwd = os.getcwd()
+    os.chdir(directory)
+    try:
+        if os.path.isfile('Makefile'):
+            print('Makefile already exists; skipping ./configure')
+        else:
+            subprocess.check_call(['./configure', '--prefix=/dev/null',
+                                   '--with-pydebug'])
+        make_cmd = ['make', '-s', '-j', str(multiprocessing.cpu_count())]
+        subprocess.call(make_cmd)
+    finally:
+        os.chdir(cwd)
+
+if __name__ == '__main__':
+    main()

--
Repository URL: http://hg.python.org/devinabox


More information about the Python-checkins mailing list