|
21 | 21 | build.py VERSION [--rebuild-cpp] [--fast] [--clean] [--kivy] |
22 | 22 |
|
23 | 23 | Options: |
24 | | - VERSION Version number eg. 50.0 |
25 | | - --rebuild-cpp Force rebuild of C++ projects |
26 | | - --fast Fast mode |
27 | | - --clean Clean C++ projects build files (.o .a etc) |
28 | | - --kivy Run only Kivy example |
| 24 | + VERSION Version number eg. 50.0 |
| 25 | + --no-run-examples Do not run examples after build, only unit tests |
| 26 | + --rebuild-cpp Force rebuild of .vcproj C++ projects (DISABLED) |
| 27 | + --fast Fast mode |
| 28 | + --clean Clean C++ projects build files on Linux/Mac |
| 29 | + --kivy Run only Kivy example |
29 | 30 | """ |
30 | 31 |
|
31 | 32 | # How to debug on Linux: |
|
59 | 60 | pass |
60 | 61 |
|
61 | 62 | # Command line args variables |
| 63 | +VERSION = "" |
| 64 | +NO_RUN_EXAMPLES = False |
62 | 65 | DEBUG_FLAG = False |
63 | 66 | FAST_FLAG = False |
64 | 67 | CLEAN_FLAG = False |
65 | 68 | KIVY_FLAG = False |
66 | 69 | REBUILD_CPP = False |
67 | | -VERSION = "" |
68 | 70 |
|
69 | 71 | # First run |
70 | 72 | FIRST_RUN = False |
@@ -102,39 +104,44 @@ def main(): |
102 | 104 |
|
103 | 105 | def command_line_args(): |
104 | 106 | global DEBUG_FLAG, FAST_FLAG, CLEAN_FLAG, KIVY_FLAG,\ |
105 | | - REBUILD_CPP, VERSION |
| 107 | + REBUILD_CPP, VERSION, NO_RUN_EXAMPLES |
106 | 108 |
|
107 | | - VERSION = get_version_from_command_line_args() |
| 109 | + VERSION = get_version_from_command_line_args(__file__) |
108 | 110 | if not VERSION: |
109 | 111 | print(__doc__) |
110 | 112 | sys.exit(1) |
111 | 113 |
|
112 | 114 | print("[build.py] Parse command line arguments") |
113 | 115 |
|
114 | | - # -- debug flag |
115 | | - if len(sys.argv) > 1 and "--debug" in sys.argv: |
| 116 | + # --no-run-examples |
| 117 | + if "--no-run-examples" in sys.argv: |
| 118 | + NO_RUN_EXAMPLES = True |
| 119 | + print("[build.py] Running examples disabled (--no-run-examples)") |
| 120 | + |
| 121 | + # -- debug |
| 122 | + if "--debug" in sys.argv: |
116 | 123 | DEBUG_FLAG = True |
117 | 124 | print("[build.py] DEBUG mode On") |
118 | 125 |
|
119 | | - # --fast flag |
120 | | - if len(sys.argv) > 1 and "--fast" in sys.argv: |
| 126 | + # --fast |
| 127 | + if "--fast" in sys.argv: |
121 | 128 | # Fast mode doesn't delete C++ .o .a files. |
122 | 129 | # Fast mode also disables optimization flags in setup/setup.py . |
123 | 130 | FAST_FLAG = True |
124 | 131 | print("[build.py] FAST mode On") |
125 | 132 |
|
126 | | - # --clean flag |
127 | | - if len(sys.argv) > 1 and "--clean" in sys.argv: |
| 133 | + # --clean |
| 134 | + if "--clean" in sys.argv: |
128 | 135 | CLEAN_FLAG = True |
129 | 136 |
|
130 | | - # --kivy flag |
131 | | - if len(sys.argv) > 1 and "--kivy" in sys.argv: |
| 137 | + # --kivy |
| 138 | + if "--kivy" in sys.argv: |
132 | 139 | KIVY_FLAG = True |
133 | 140 | print("[build.py] KIVY mode enabled") |
134 | 141 |
|
135 | | - # --rebuild-cpp flag |
| 142 | + # --rebuild-cpp |
136 | 143 | # Rebuild c++ projects |
137 | | - if len(sys.argv) > 1 and "--rebuild-cpp" in sys.argv: |
| 144 | + if "--rebuild-cpp" in sys.argv: |
138 | 145 | REBUILD_CPP = True |
139 | 146 | print("[build.py] REBUILD_CPP mode enabled") |
140 | 147 |
|
@@ -825,17 +832,18 @@ def install_and_run(): |
825 | 832 | sys.exit(ret) |
826 | 833 |
|
827 | 834 | # Run examples |
828 | | - print("[build.py] Run examples") |
829 | | - os.chdir(EXAMPLES_DIR) |
830 | | - kivy_flag = "--kivy" if KIVY_FLAG else "" |
831 | | - run_examples = os.path.join(TOOLS_DIR, "run_examples.py") |
832 | | - ret = os.system("\"{python}\" {run_examples} {kivy_flag}" |
833 | | - .format(python=sys.executable, |
834 | | - run_examples=run_examples, |
835 | | - kivy_flag=kivy_flag)) |
836 | | - if ret != 0: |
837 | | - print("[build.py] ERROR while running examples") |
838 | | - sys.exit(1) |
| 835 | + if not NO_RUN_EXAMPLES: |
| 836 | + print("[build.py] Run examples") |
| 837 | + os.chdir(EXAMPLES_DIR) |
| 838 | + kivy_flag = "--kivy" if KIVY_FLAG else "" |
| 839 | + run_examples = os.path.join(TOOLS_DIR, "run_examples.py") |
| 840 | + ret = os.system("\"{python}\" {run_examples} {kivy_flag}" |
| 841 | + .format(python=sys.executable, |
| 842 | + run_examples=run_examples, |
| 843 | + kivy_flag=kivy_flag)) |
| 844 | + if ret != 0: |
| 845 | + print("[build.py] ERROR while running examples") |
| 846 | + sys.exit(1) |
839 | 847 |
|
840 | 848 | print("[build.py] Everything OK") |
841 | 849 |
|
|
0 commit comments