(template)
| 137 | return True |
| 138 | |
| 139 | def generate_sample(template): |
| 140 | def func(args): |
| 141 | output_dir = ( |
| 142 | args.output_dir |
| 143 | if args.output_dir |
| 144 | else os.path.join(ROOT_DIR, "samples", args.category) |
| 145 | ) |
| 146 | |
| 147 | if not which("cmake"): |
| 148 | print("Missing cmake") |
| 149 | sys.exit(1) |
| 150 | |
| 151 | if not prompt_if_path_exists(output_dir, args.name): |
| 152 | return |
| 153 | |
| 154 | print( |
| 155 | terminal_colors.INFO |
| 156 | + "Generating sample project " |
| 157 | + args.name |
| 158 | + terminal_colors.END |
| 159 | ) |
| 160 | |
| 161 | check_output( |
| 162 | [ |
| 163 | "cmake", |
| 164 | "-DSAMPLE_NAME={}".format(args.name), |
| 165 | "-DTEMPLATE_NAME={}".format(template), |
| 166 | "-DOUTPUT_DIR={}".format(output_dir), |
| 167 | "-P", |
| 168 | os.path.join(ROOT_DIR, "bldsys", "cmake", "create_sample_project.cmake"), |
| 169 | ] |
| 170 | ) |
| 171 | |
| 172 | return func |
| 173 | |
| 174 | |
| 175 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected