MCPcopy Index your code
hub / github.com/aws/aws-cli / _inject_scripts

Function _inject_scripts

backends/pep517.py:243–270  ·  view source on GitHub ↗
(extracted_wheel_dir)

Source from the content-addressed store, hash-verified

241
242
243def _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
273def _create_record_file(base_dir, dist_info_dir):

Callers 2

_inject_wheel_extrasFunction · 0.85

Calls 3

_rewrite_shebangFunction · 0.85
_create_record_fileFunction · 0.70

Tested by

no test coverage detected