MCPcopy Create free account
hub / github.com/conda/constructor / create

Function create

constructor/winexe.py:363–415  ·  view source on GitHub ↗
(info, verbose=False)

Source from the content-addressed store, hash-verified

361
362
363def create(info, verbose=False):
364 verify_nsis_install()
365 signing_tool = create_windows_signing_tool(info)
366 tmp_dir = tempfile.mkdtemp()
367 preconda_write_files(info, tmp_dir)
368 copied_extra_files = copy_extra_files(info.get("extra_files", []), tmp_dir)
369 copied_temp_extra_files = copy_extra_files(info.get("temp_extra_files", []), tmp_dir)
370 extra_conda_exe_files = copy_conda_exe(tmp_dir, "_conda.exe", info["_conda_exe"])
371
372 pre_dst = join(tmp_dir, "pre_install.bat")
373 pre_install_script = info.get("pre_install")
374 if pre_install_script:
375 shutil.copy(pre_install_script, pre_dst)
376
377 post_dst = join(tmp_dir, "post_install.bat")
378 try:
379 shutil.copy(info["post_install"], post_dst)
380 except KeyError:
381 with open(post_dst, "w") as fo:
382 fo.write(":: this is an empty post install .bat script\n")
383
384 preun_dst = join(tmp_dir, "pre_uninstall.bat")
385 try:
386 shutil.copy(info["pre_uninstall"], preun_dst)
387 except KeyError:
388 with open(preun_dst, "w") as fo:
389 fo.write(":: this is an empty pre uninstall .bat script\n")
390
391 write_images(info, tmp_dir)
392 nsi = make_nsi(
393 info,
394 tmp_dir,
395 extra_files=extra_conda_exe_files + copied_extra_files,
396 temp_extra_files=copied_temp_extra_files,
397 signing_tool=signing_tool,
398 )
399 verbosity = f"{'/' if sys.platform == 'win32' else '-'}V{4 if verbose else 2}"
400 args = [MAKENSIS_EXE, verbosity, nsi]
401 logger.info("Calling: %s", args)
402 process = run(args, capture_output=True, text=True)
403 if process.returncode:
404 logger.info("makensis stdout:\n'%s'", process.stdout)
405 logger.error("makensis stderr:\n'%s'", process.stderr)
406 sys.exit(f"Failed to run {args}. Exit code: {process.returncode}.")
407 else:
408 logger.debug("makensis stdout:\n'%s'", process.stdout)
409 logger.debug("makensis stderr:\n'%s'", process.stderr)
410
411 if signing_tool:
412 signing_tool.verify_signature(info["_outpath"])
413
414 if not info.get("_debug"):
415 shutil.rmtree(tmp_dir)
416
417
418if __name__ == "__main__":

Callers

nothing calls this directly

Calls 8

verify_nsis_installFunction · 0.85
copy_extra_filesFunction · 0.85
copy_conda_exeFunction · 0.85
write_imagesFunction · 0.85
make_nsiFunction · 0.85
getMethod · 0.80
verify_signatureMethod · 0.45

Tested by

no test coverage detected