(extracted_wheel_dir)
| 241 | |
| 242 | |
| 243 | def _inject_scripts(extracted_wheel_dir): |
| 244 | # There are two directories generated by flit: |
| 245 | # 1) awscli/ |
| 246 | # 2) awscli-version.dist-info/ |
| 247 | # The easiest way to generate a data directory is to |
| 248 | # find the dist-info directory and replace dist-info with |
| 249 | # data. |
| 250 | # There shold be exactly one, if not then something has gone horribly wrong |
| 251 | # and crashing here is appropriate. |
| 252 | dist_info_dir = [ |
| 253 | d for d in os.listdir(extracted_wheel_dir) if "dist-info" in d |
| 254 | ][0] |
| 255 | data_dir = os.path.join( |
| 256 | extracted_wheel_dir, |
| 257 | dist_info_dir.replace("dist-info", "data"), |
| 258 | ) |
| 259 | _create_dir_if_not_exists(data_dir) |
| 260 | scripts_dir = os.path.join(data_dir, "scripts") |
| 261 | _create_dir_if_not_exists(scripts_dir) |
| 262 | for script in SCRIPTS: |
| 263 | target = os.path.join(scripts_dir, script) |
| 264 | print(f"Injecting script {script} -> {target}") |
| 265 | shutil.copy2( |
| 266 | os.path.join(BIN_DIR, script), |
| 267 | target, |
| 268 | ) |
| 269 | _rewrite_shebang(target) |
| 270 | _create_record_file(extracted_wheel_dir, dist_info_dir) |
| 271 | |
| 272 | |
| 273 | def _create_record_file(base_dir, dist_info_dir): |
no test coverage detected