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

Function create

constructor/osxpkg.py:572–733  ·  view source on GitHub ↗
(info, verbose=False)

Source from the content-addressed store, hash-verified

570
571
572def create(info, verbose=False):
573 # Do some configuration checks
574 if info.get("check_path_spaces", True) is True:
575 for key in "default_location_pkg", "pkg_name":
576 if " " in info.get(key, ""):
577 sys.exit(
578 f"ERROR: 'check_path_spaces' is enabled, but '{key}' "
579 "contains spaces. This will always result in a failed "
580 "installation! Aborting!"
581 )
582
583 global CACHE_DIR, PACKAGE_ROOT, PACKAGES_DIR, PLUGINS_DIR, SCRIPTS_DIR
584
585 CACHE_DIR = info["_download_dir"]
586 SCRIPTS_DIR = join(CACHE_DIR, "scripts")
587 PACKAGE_ROOT = join(CACHE_DIR, "package_root")
588 PACKAGES_DIR = join(CACHE_DIR, "built_pkgs")
589 PLUGINS_DIR = join(CACHE_DIR, "plugins")
590
591 fresh_dir(PACKAGES_DIR)
592 prefix = join(PACKAGE_ROOT, info.get("pkg_name", info["name"]).lower())
593
594 # We need to split tasks in sub-PKGs so the GUI allows the user to enable/disable
595 # the ones marked as optional. Optionality is controlled in modify_xml() by
596 # patching the XML blocks corresponding to each sub-PKG name.
597 # See http://stackoverflow.com/a/11487658/161801 for how all this works.
598
599 # 1. Prepare installation
600 # The 'prepare_installation' package contains the prepopulated package cache, the modified
601 # conda-meta metadata staged into pkgs/conda-meta, _conda (conda-standalone, [--conda-exe]),
602 # Optionally, extra files and the user-provided scripts.
603 # We first populate PACKAGE_ROOT with everything needed, and then run pkg build on that dir
604 fresh_dir(PACKAGE_ROOT)
605 fresh_dir(SCRIPTS_DIR)
606 pkgs_dir = join(prefix, "pkgs")
607 os.makedirs(pkgs_dir)
608 preconda.write_files(info, prefix)
609 preconda.copy_extra_files(info.get("extra_files", []), prefix)
610
611 # Add potential license file
612 if license_file := info.get("license_file"):
613 preconda.copy_extra_files([license_file], prefix)
614 # These are the user-provided scripts, maybe patched to have a shebang
615 # They will be called by a wrapping script added later, if present
616 if info.get("pre_install"):
617 move_script(
618 abspath(info["pre_install"]),
619 abspath(join(pkgs_dir, "user_pre_install")),
620 info,
621 ensure_shebang=True,
622 )
623 if info.get("post_install"):
624 move_script(
625 abspath(info["post_install"]),
626 abspath(join(pkgs_dir, "user_post_install")),
627 info,
628 ensure_shebang=True,
629 )

Callers

nothing calls this directly

Calls 12

fresh_dirFunction · 0.85
move_scriptFunction · 0.85
format_conda_exe_nameFunction · 0.85
copy_conda_exeFunction · 0.85
CodeSignClass · 0.85
sign_standalone_binaryFunction · 0.85
pkgbuild_scriptFunction · 0.85
explained_check_callFunction · 0.85
modify_xmlFunction · 0.85
create_pluginsFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected