From 69eaa20b12ea1020438f645ec834f47ac9d3c3a7 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Wed, 12 May 2021 23:49:58 +0200 Subject: [PATCH 01/14] extract pre-conda before extracting conda packages --- constructor/header.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/constructor/header.sh b/constructor/header.sh index 52a88bfee..6578255c6 100644 --- a/constructor/header.sh +++ b/constructor/header.sh @@ -443,12 +443,12 @@ printf "Unpacking payload ...\n" extract_range $boundary1 $boundary2 | \ "$CONDA_EXEC" constructor --extract-tarball --prefix "$PREFIX" -"$CONDA_EXEC" constructor --prefix "$PREFIX" --extract-conda-pkgs || exit 1 - PRECONDA="$PREFIX/preconda.tar.bz2" "$CONDA_EXEC" constructor --prefix "$PREFIX" --extract-tarball < "$PRECONDA" || exit 1 rm -f "$PRECONDA" +"$CONDA_EXEC" constructor --prefix "$PREFIX" --extract-conda-pkgs || exit 1 + #The templating doesn't support nested if statements #if has_pre_install if [ "$SKIP_SCRIPTS" = "1" ]; then From 7fc163e173bca4058553827cd9d0c8296debb273 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sun, 1 Aug 2021 11:24:09 +0100 Subject: [PATCH 02/14] Pass root_prefix to menuinst.install() to be used by conda-standalone --- constructor/nsis/_nsis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/constructor/nsis/_nsis.py b/constructor/nsis/_nsis.py index b5b7cbf4a..fa1d57868 100644 --- a/constructor/nsis/_nsis.py +++ b/constructor/nsis/_nsis.py @@ -104,7 +104,7 @@ def get(self, name): return None -def mk_menus(remove=False, prefix=None, pkg_names=[]): +def mk_menus(remove=False, prefix=None, pkg_names=[], root_prefix=None): try: import menuinst except (ImportError, OSError): @@ -121,7 +121,8 @@ def mk_menus(remove=False, prefix=None, pkg_names=[]): continue shortcut = join(menu_dir, fn) try: - menuinst.install(shortcut, remove, prefix=prefix) + menuinst.install(shortcut, remove, prefix=prefix, + root_prefix=root_prefix) except Exception as e: out("Failed to process %s...\n" % shortcut) err("Error: %s\n" % str(e)) From c17eeca95f25e2624b054ee72e09f85251be8325 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Mon, 2 Aug 2021 15:58:06 +0100 Subject: [PATCH 03/14] Fix behaviour of creating shortcut menu: create menu shortcut only when the packages is explicitly listed in the "menu_packages" entry --- constructor/nsis/_nsis.py | 13 +++++++++---- constructor/nsis/main.nsi.tmpl | 4 +++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/constructor/nsis/_nsis.py b/constructor/nsis/_nsis.py index fa1d57868..9624d8d58 100644 --- a/constructor/nsis/_nsis.py +++ b/constructor/nsis/_nsis.py @@ -104,20 +104,25 @@ def get(self, name): return None -def mk_menus(remove=False, prefix=None, pkg_names=[], root_prefix=None): +def mk_menus(remove=False, prefix=None, pkg_names=None, root_prefix=None): try: import menuinst except (ImportError, OSError): return if prefix is None: prefix = sys.prefix + if root_prefix is None: + root_prefix = sys.prefix menu_dir = join(prefix, 'Menu') if not os.path.isdir(menu_dir): return for fn in os.listdir(menu_dir): if not fn.endswith('.json'): continue - if pkg_names and fn[:-5] not in pkg_names: + if pkg_names is not None and fn[:-5] not in pkg_names: + # skip when not in the list of menus to create + # when installing, the pkg_names list is specified, otherwise not + # and we don't skip to try to remove shortcuts continue shortcut = join(menu_dir, fn) try: @@ -151,7 +156,7 @@ def get_conda_envs_from_python_api(): get_conda_envs = get_conda_envs_from_python_api -def rm_menus(prefix=None): +def rm_menus(prefix=None, root_prefix=None): try: import menuinst from conda.base.context import context @@ -176,7 +181,7 @@ def rm_menus(prefix=None): # `envs_dirs` to avoid picking up environment from other # distributions. Not perfect but better than no checking if envs_dir in env: - mk_menus(remove=True, prefix=env) + mk_menus(remove=True, prefix=env, root_prefix=root_prefix) def run_post_install(): diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index 315f4abe5..e08536c6c 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -881,7 +881,9 @@ Section "Install" SetDetailsPrint TextOnly DetailPrint "Setting up the base environment ..." - nsExec::ExecToLog '"$INSTDIR\_conda.exe" install --offline -yp "$INSTDIR" --file "$INSTDIR\pkgs\env.txt"' + # Need to use `--no-shortcuts` because the shortcuts are created in the following steps. The reason is that `conda install` + # doesn't support `menu_packages` entry of `construct.yaml` and will therefore create possible shorcuts + nsExec::ExecToLog '"$INSTDIR\_conda.exe" install --offline -yp "$INSTDIR" --file "$INSTDIR\pkgs\env.txt" --no-shortcuts' Pop $0 SetDetailsPrint both From 4ca414b112122abfd6bff6fc7337cdb42c89655a Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Sat, 11 Sep 2021 17:35:35 -0400 Subject: [PATCH 04/14] Add tests for header template subsititutes and fix initialize by dfeault --- constructor/header.sh | 25 +++++++------------------ tests/test_header.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 tests/test_header.py diff --git a/constructor/header.sh b/constructor/header.sh index 6578255c6..e94f0bc1c 100644 --- a/constructor/header.sh +++ b/constructor/header.sh @@ -43,12 +43,8 @@ Installs __NAME__ __VERSION__ #if batch_mode -i run install in interactive mode #else - #if has_license -b run install in batch mode (without manual intervention), - it is expected the license terms are agreed upon - #else --b run install in batch mode (without manual intervention) - #endif + it is expected the license terms (if any) are agreed upon #endif -f no error if install prefix already exists -h print this help message and exit @@ -551,21 +547,14 @@ if [ "$PYTHONPATH" != "" ]; then fi if [ "$BATCH" = "0" ]; then -#if has_conda - # Interactive mode. - #if osx - BASH_RC="$HOME"/.bash_profile +#if initialize_by_default is True DEFAULT=yes - #else - BASH_RC="$HOME"/.bashrc - DEFAULT=no - #endif - #if initialize_by_default is True - DEFAULT=yes - #endif - #if initialize_by_default is False +#else DEFAULT=no - #endif +#endif + +#if has_conda + # Interactive mode. printf "Do you wish the installer to initialize __NAME__\\n" printf "by running conda init? [yes|no]\\n" diff --git a/tests/test_header.py b/tests/test_header.py new file mode 100644 index 000000000..65f8f72f9 --- /dev/null +++ b/tests/test_header.py @@ -0,0 +1,40 @@ +from constructor.shar import read_header_template, preprocess +import pytest + + +@pytest.mark.parametrize('direct_execute_post_install', [False, True]) +@pytest.mark.parametrize('direct_execute_pre_install', [False, True]) +@pytest.mark.parametrize('batch_mode', [False, True]) +@pytest.mark.parametrize('keep_pkgs', [False, True]) +@pytest.mark.parametrize('has_conda', [False, True]) +@pytest.mark.parametrize('has_license', [False, True]) +@pytest.mark.parametrize('initialize_by_default', [False, True]) +@pytest.mark.parametrize('has_post_install', [False, True]) +@pytest.mark.parametrize('has_pre_install', [False, True]) +@pytest.mark.parametrize('arch', ['x86', 'x86_64', ' ppc64le', 's390x', 'aarch64']) +def test_linux_template_processing( + arch, has_pre_install, has_post_install, + initialize_by_default, has_license, has_conda, keep_pkgs, batch_mode, + direct_execute_pre_install, direct_execute_post_install): + template = read_header_template() + processed = preprocess(template, { + 'has_license': has_license, + 'osx': False, + 'batch_mode': batch_mode, + 'keep_pkgs': keep_pkgs, + 'has_conda': has_conda, + 'x86': arch == 'x86', + 'x86_64': arch == 'x86_64', + 'ppc64le': arch == 'ppc64le', + 's390x': arch == 's390x', + 'aarch64': arch == 'aarch64', + 'linux': True, + 'has_pre_install': has_pre_install, + 'direct_execute_pre_install': direct_execute_pre_install, + 'has_post_install': has_post_install, + 'direct_execute_post_install': direct_execute_post_install, + 'initialize_by_default': initialize_by_default, + }) + assert '#if' not in processed + assert '#else' not in processed + assert '#endif' not in processed From c755701944ba280871f581bde3905e5ef0883f0b Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Sat, 11 Sep 2021 17:38:31 -0400 Subject: [PATCH 05/14] Add osx to the test matrix --- tests/test_header.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_header.py b/tests/test_header.py index 65f8f72f9..6ea24f87d 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -2,6 +2,7 @@ import pytest +@pytest.mark.parametrize('osx', [False, True]) @pytest.mark.parametrize('direct_execute_post_install', [False, True]) @pytest.mark.parametrize('direct_execute_pre_install', [False, True]) @pytest.mark.parametrize('batch_mode', [False, True]) @@ -13,13 +14,13 @@ @pytest.mark.parametrize('has_pre_install', [False, True]) @pytest.mark.parametrize('arch', ['x86', 'x86_64', ' ppc64le', 's390x', 'aarch64']) def test_linux_template_processing( - arch, has_pre_install, has_post_install, + osx, arch, has_pre_install, has_post_install, initialize_by_default, has_license, has_conda, keep_pkgs, batch_mode, direct_execute_pre_install, direct_execute_post_install): template = read_header_template() processed = preprocess(template, { 'has_license': has_license, - 'osx': False, + 'osx': osx, 'batch_mode': batch_mode, 'keep_pkgs': keep_pkgs, 'has_conda': has_conda, From c05f1251d0571588f93befa9b889837de4552c9d Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Tue, 28 Sep 2021 13:22:15 -0400 Subject: [PATCH 06/14] ensure that Linux and osx are not set at the same time --- tests/test_header.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_header.py b/tests/test_header.py index 6ea24f87d..46604d493 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -29,7 +29,7 @@ def test_linux_template_processing( 'ppc64le': arch == 'ppc64le', 's390x': arch == 's390x', 'aarch64': arch == 'aarch64', - 'linux': True, + 'linux': not osx, 'has_pre_install': has_pre_install, 'direct_execute_pre_install': direct_execute_pre_install, 'has_post_install': has_post_install, From a3ce718d5460eaccec0cb63f8d4a4fe474552cfb Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Thu, 30 Sep 2021 19:30:09 +0100 Subject: [PATCH 07/14] Add /NoShortcuts argument to the NSIS installer. --- constructor/nsis/main.nsi.tmpl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index e08536c6c..d9f0f3ddb 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -53,6 +53,7 @@ var /global ARGV_KeepPkgCache var /global ARGV_RegisterPython var /global ARGV_NoRegistry var /global ARGV_NoScripts +var /global ARGV_NoShortcuts var /global ARGV_CheckPathLength var /global IsDomainUser @@ -187,6 +188,7 @@ FunctionEnd /RegisterPython=[0|1] [default: AllUsers: 1, JustMe: 0]$\n$\n\ /NoRegistry=[0|1] [default: AllUsers: 0, JustMe: 0]$\n$\n\ /NoScripts=[0|1] [default: 0]$\n$\n\ + /NoShortcuts=[0|1] [default: 0]$\n$\n\ /CheckPathLength=[0|1] [default: 1]$\n$\n\ Examples:$\n\ Install for all users, but don't add to PATH env var:$\n\ @@ -250,6 +252,12 @@ FunctionEnd ${EndIf} ${EndIf} + ClearErrors + ${GetOptions} $ARGV "/NoShortcuts=" $ARGV_NoShortcuts + ${If} ${Errors} + StrCpy $ARGV_NoShortcuts "0" + ${EndIf} + ClearErrors ${GetOptions} $ARGV "/CheckPathLength=" $ARGV_CheckPathLength ${IfNot} ${Errors} @@ -900,10 +908,12 @@ Section "Install" SetOutPath "$INSTDIR\conda-meta" File __CONDA_HISTORY__ - DetailPrint "Creating @NAME@ menus..." - push '"$INSTDIR\_conda.exe" constructor --prefix "$INSTDIR" --make-menus @MENU_PKGS@' - push 'Failed to create menus' - call AbortRetryNSExecWait + ${If} $ARGV_NoShortcuts == "0" + DetailPrint "Creating @NAME@ menus..." + push '"$INSTDIR\_conda.exe" constructor --prefix "$INSTDIR" --make-menus @MENU_PKGS@' + push 'Failed to create menus' + call AbortRetryNSExecWait + ${EndIf} push '"$INSTDIR\pythonw.exe" -E -s "$INSTDIR\Lib\_nsis.py" mkdirs' push 'Failed to initialize Anaconda directories' From 49f469c79c0fd3896970f166f1e66da34b9040f4 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Fri, 1 Oct 2021 16:26:13 +0100 Subject: [PATCH 08/14] Add option to installer dialog not to create start menu shortcuts --- constructor/nsis/OptionsDialog.nsh | 19 +++++++++++++++++++ constructor/nsis/main.nsi.tmpl | 11 ++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/constructor/nsis/OptionsDialog.nsh b/constructor/nsis/OptionsDialog.nsh index 55307cd39..505958039 100644 --- a/constructor/nsis/OptionsDialog.nsh +++ b/constructor/nsis/OptionsDialog.nsh @@ -10,12 +10,14 @@ Var mui_AnaCustomOptions.AddToPath Var mui_AnaCustomOptions.RegisterSystemPython Var mui_AnaCustomOptions.PostInstall Var mui_AnaCustomOptions.ClearPkgCache +Var mui_AnaCustomOptions.CreateShortcuts # These are the checkbox states, to be used by the installer Var Ana_AddToPath_State Var Ana_RegisterSystemPython_State Var Ana_PostInstall_State Var Ana_ClearPkgCache_State +Var Ana_CreateShortcuts_State Var Ana_AddToPath_Label Var Ana_RegisterSystemPython_Label @@ -37,6 +39,9 @@ Function mui_AnaCustomOptions_InitDefaults ${Else} StrCpy $Ana_RegisterSystemPython_State ${BST_CHECKED} ${EndIf} + ${If} $Ana_CreateShortcuts_State == "" + StrCpy $Ana_CreateShortcuts_State ${BST_CHECKED} + ${EndIf} ${EndIf} FunctionEnd @@ -60,6 +65,14 @@ Function mui_AnaCustomOptions_Show "Advanced Installation Options" \ "Customize how ${NAME} integrates with Windows" + + ${If} "${MENU_PKGS}" != "" + ${NSD_CreateCheckbox} 0 0u 100% 11u "Create start menu shortcuts." + Pop $mui_AnaCustomOptions.CreateShortcuts + ${NSD_SetState} $mui_AnaCustomOptions.CreateShortcuts $Ana_CreateShortcuts_State + ${NSD_OnClick} $mui_AnaCustomOptions.CreateShortcuts CreateShortcuts_OnClick + ${EndIf} + ${If} $InstMode = ${JUST_ME} StrCpy $1 "my" ${Else} @@ -188,3 +201,9 @@ Function ClearPkgCache_OnClick ${EndIf} ShowWindow $Ana_ClearPkgCache_Label ${SW_SHOW} FunctionEnd + +Function CreateShortcuts_OnClick + Pop $0 + ${NSD_GetState} $0 $Ana_CreateShortcuts_State + +FunctionEnd diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index d9f0f3ddb..bf4d93f80 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -33,6 +33,7 @@ Unicode "true" !define DEFAULT_PREFIX_DOMAIN_USER __DEFAULT_PREFIX_DOMAIN_USER__ !define DEFAULT_PREFIX_ALL_USERS __DEFAULT_PREFIX_ALL_USERS__ !define POST_INSTALL_DESC __POST_INSTALL_DESC__ +!define MENU_PKGS "@MENU_PKGS@" !define PRODUCT_NAME "${NAME} ${VERSION} (${ARCH})" !define UNINSTALL_NAME "@UNINSTALL_NAME@" !define UNINSTREG "SOFTWARE\Microsoft\Windows\CurrentVersion\ @@ -254,8 +255,12 @@ FunctionEnd ClearErrors ${GetOptions} $ARGV "/NoShortcuts=" $ARGV_NoShortcuts - ${If} ${Errors} - StrCpy $ARGV_NoShortcuts "0" + ${IfNot} ${Errors} + ${If} $ARGV_NoShortcuts = "1" + StrCpy $Ana_CreateShortcuts_State ${BST_UNCHECKED} + ${ElseIf} $ARGV_NoShortcuts = "0" + StrCpy $Ana_CreateShortcuts_State ${BST_CHECKED} + ${EndIf} ${EndIf} ClearErrors @@ -908,7 +913,7 @@ Section "Install" SetOutPath "$INSTDIR\conda-meta" File __CONDA_HISTORY__ - ${If} $ARGV_NoShortcuts == "0" + ${If} $Ana_CreateShortcuts_State = ${BST_CHECKED} DetailPrint "Creating @NAME@ menus..." push '"$INSTDIR\_conda.exe" constructor --prefix "$INSTDIR" --make-menus @MENU_PKGS@' push 'Failed to create menus' From 91112d0ae3260e8a64cb181bfd10a4f8397fb8bb Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 2 Oct 2021 11:41:34 +0100 Subject: [PATCH 09/14] Fix creating all possible menu shortcuts when `menu_packages` is not specified --- constructor/nsis/OptionsDialog.nsh | 4 +--- constructor/nsis/_nsis.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/constructor/nsis/OptionsDialog.nsh b/constructor/nsis/OptionsDialog.nsh index 505958039..c75788eb0 100644 --- a/constructor/nsis/OptionsDialog.nsh +++ b/constructor/nsis/OptionsDialog.nsh @@ -66,12 +66,10 @@ Function mui_AnaCustomOptions_Show "Customize how ${NAME} integrates with Windows" - ${If} "${MENU_PKGS}" != "" - ${NSD_CreateCheckbox} 0 0u 100% 11u "Create start menu shortcuts." + ${NSD_CreateCheckbox} 0 0u 100% 11u "Create start menu shortcuts (supported packages only)." Pop $mui_AnaCustomOptions.CreateShortcuts ${NSD_SetState} $mui_AnaCustomOptions.CreateShortcuts $Ana_CreateShortcuts_State ${NSD_OnClick} $mui_AnaCustomOptions.CreateShortcuts CreateShortcuts_OnClick - ${EndIf} ${If} $InstMode = ${JUST_ME} StrCpy $1 "my" diff --git a/constructor/nsis/_nsis.py b/constructor/nsis/_nsis.py index 9624d8d58..5c9708bdc 100644 --- a/constructor/nsis/_nsis.py +++ b/constructor/nsis/_nsis.py @@ -119,7 +119,7 @@ def mk_menus(remove=False, prefix=None, pkg_names=None, root_prefix=None): for fn in os.listdir(menu_dir): if not fn.endswith('.json'): continue - if pkg_names is not None and fn[:-5] not in pkg_names: + if pkg_names is not None and len(pkg_names) > 0 and fn[:-5] not in pkg_names: # skip when not in the list of menus to create # when installing, the pkg_names list is specified, otherwise not # and we don't skip to try to remove shortcuts From 74ccab580ea05f1783f87eb64728e166f9ba7447 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 2 Oct 2021 15:52:57 +0100 Subject: [PATCH 10/14] Use nsExec:Exec to remove files and folders instead of using python subprocess, which errors most likely when trying to remove python executable. --- constructor/nsis/main.nsi.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index e08536c6c..1b7bbd192 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -993,8 +993,12 @@ Section "Uninstall" !insertmacro ExecWaitLibNsisCmd "pre_uninstall" !insertmacro ExecWaitLibNsisCmd "rmpath" !insertmacro ExecWaitLibNsisCmd "rmreg" - !insertmacro ExecWaitLibNsisCmd 'del "$INSTDIR"' + DetailPrint "Removing files..." + nsExec::Exec 'cmd.exe /k DEL /F/Q/S "$INSTDIR"\*.*' + DetailPrint "Removing folders..." + nsExec::Exec 'cmd.exe /k RD /S/Q "$INSTDIR"' + # In case the last two commands fail, fall back to slow method to remove leftover RMDir /r /REBOOTOK "$INSTDIR" DeleteRegKey SHCTX "${UNINSTREG}" From d06f36512965f89994c9bc547ad146c17f724bbb Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 2 Oct 2021 16:35:00 +0100 Subject: [PATCH 11/14] Use RMDIR /S/Q instead of DEL followed by RD. --- constructor/nsis/main.nsi.tmpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index 1b7bbd192..9717a59d5 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -993,12 +993,10 @@ Section "Uninstall" !insertmacro ExecWaitLibNsisCmd "pre_uninstall" !insertmacro ExecWaitLibNsisCmd "rmpath" !insertmacro ExecWaitLibNsisCmd "rmreg" - DetailPrint "Removing files..." - nsExec::Exec 'cmd.exe /k DEL /F/Q/S "$INSTDIR"\*.*' - DetailPrint "Removing folders..." - nsExec::Exec 'cmd.exe /k RD /S/Q "$INSTDIR"' + DetailPrint "Removing files and folders..." + nsExec::Exec 'cmd.exe /k RMDIR /Q/S "$INSTDIR"' - # In case the last two commands fail, fall back to slow method to remove leftover + # In case the last command fails, run the slow method to remove leftover RMDir /r /REBOOTOK "$INSTDIR" DeleteRegKey SHCTX "${UNINSTREG}" From add70349c5bc1d8cc0f392636d60505060ee8cc8 Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Thu, 28 Oct 2021 15:49:35 +0800 Subject: [PATCH 12/14] Unset `DYLD_FALLBACK_LIBRARY_PATH` in header on macOS --- constructor/header.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constructor/header.sh b/constructor/header.sh index 6578255c6..eaa53cf6e 100644 --- a/constructor/header.sh +++ b/constructor/header.sh @@ -6,7 +6,7 @@ # MD5: __MD5__ #if osx -unset DYLD_LIBRARY_PATH +unset DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH #else export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH unset LD_LIBRARY_PATH From 07b1cfb759f1b5784b19f02ddee13ffab22d2841 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 11 Nov 2021 10:49:10 -0500 Subject: [PATCH 13/14] Avoid yaml warnings (and ensure compatibility with pyyaml 6) --- constructor/construct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constructor/construct.py b/constructor/construct.py index d6222f415..6f316b43c 100644 --- a/constructor/construct.py +++ b/constructor/construct.py @@ -375,7 +375,7 @@ def yamlize(data, directory, content_filter): except ImportError as ex: raise UnableToParseMissingJinja2(original=ex) data = render_jinja(data, directory, content_filter) - return yaml.load(data) + return yaml.load(data, Loader=yaml.FullLoader) def parse(path, platform): From 9da46de2d83eda164403784ad69663dedb8878e4 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 18 Nov 2021 18:50:40 -0500 Subject: [PATCH 14/14] Avoid arbitrary code execution --- constructor/construct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constructor/construct.py b/constructor/construct.py index 6f316b43c..2f37a1acb 100644 --- a/constructor/construct.py +++ b/constructor/construct.py @@ -375,7 +375,7 @@ def yamlize(data, directory, content_filter): except ImportError as ex: raise UnableToParseMissingJinja2(original=ex) data = render_jinja(data, directory, content_filter) - return yaml.load(data, Loader=yaml.FullLoader) + return yaml.load(data, Loader=yaml.SafeLoader) def parse(path, platform):