Skip to content

Commit

Permalink
Merge branch 'main' of github.com:conda/constructor into menuinst-cep
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Jul 10, 2023
2 parents 72baca8 + 8f04c2a commit 5974931
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
rev: v3.8.0
hooks:
- id: pyupgrade
args: ["--py37-plus", "--keep-percent-format"]
Expand Down
53 changes: 47 additions & 6 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Unicode "true"
\Uninstall\${UNINSTALL_NAME}"

var /global INSTDIR_JUSTME
var /global INSTALLER_VERSION
var /global INSTALLER_NAME_FULL

# UAC shield overlay
!ifndef BCM_SETSHIELD
Expand Down Expand Up @@ -1199,10 +1201,36 @@ Section "Uninstall"
# carefully. More info at https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#solution
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_DLL_SEARCH_MODIFICATION_ENABLE", "1").r0'

# Read variables the uninstaller needs from the registry
StrCpy $R0 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
StrLen $R1 "Uninstall-${NAME}.exe"
IntOp $R1 $R1 + 3
StrCpy $0 0
loop_path:
EnumRegKey $1 SHCTX $R0 $0
StrCmp $1 "" endloop_path
StrCpy $2 "$R0\$1"
ReadRegStr $4 SHCTX $2 "UninstallString"
StrLen $5 $4
IntOp $5 $5 - $R1
StrCpy $4 $4 $5 1
${If} $4 == $INSTDIR
StrCpy $INSTALLER_NAME_FULL $1
ReadRegStr $INSTALLER_VERSION SHCTX $2 "DisplayVersion"
goto endloop_path
${EndIf}
IntOp $0 $0 + 1
goto loop_path
endloop_path:

# Extra info for pre_uninstall scripts
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("PREFIX", "$INSTDIR").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_NAME", "${NAME}").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_VER", "${VERSION}").r0'
StrCpy $0 ${VERSION}
${If} $INSTALLER_VERSION != ""
StrCpy $0 $INSTALLER_VERSION
${EndIf}
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_VER", "$0").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_PLAT", "${PLATFORM}").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_TYPE", "EXE").r0'

Expand All @@ -1216,13 +1244,26 @@ Section "Uninstall"
# In case the last command fails, run the slow method to remove leftover
RMDir /r /REBOOTOK "$INSTDIR"

DeleteRegKey SHCTX "${UNINSTREG}"
${If} $INSTALLER_NAME_FULL != ""
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTALLER_NAME_FULL"
${EndIf}

# If Anaconda was registered as the official Python for this version,
# remove it from the registry
ReadRegStr $0 SHCTX "Software\Python\PythonCore\${PY_VER}\InstallPath" ""
${If} $0 == "$INSTDIR"
DeleteRegKey SHCTX "Software\Python\PythonCore\${PY_VER}"
${EndIf}
StrCpy $R0 "SOFTWARE\Python\PythonCore"
StrCpy $0 0
loop_py:
EnumRegKey $1 SHCTX $R0 $0
StrCmp $1 "" endloop_py
ReadRegStr $2 SHCTX "$R0\$1\InstallPath" ""
${If} $2 == $INSTDIR
StrCpy $R1 $1
DeleteRegKey SHCTX "$R0\$1"
goto endloop_py
${EndIf}
IntOp $0 $0 + 1
goto loop_py
endloop_py:
SectionEnd

!if '@SIGNTOOL_COMMAND@' != ''
Expand Down
14 changes: 11 additions & 3 deletions constructor/preconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ def write_files(info, dst_dir):

with open(join(dst_dir, 'urls'), 'w') as fo:
for url, md5 in all_final_urls_md5s:
url = ensure_transmuted_ext(info, url)
fo.write('%s#%s\n' % (url, md5))
maybe_different_url = ensure_transmuted_ext(info, url)
if maybe_different_url != url: # transmuted, no md5
fo.write(f"{maybe_different_url}\n")
else:
fo.write(f"{url}#{md5}\n")

with open(join(dst_dir, 'urls.txt'), 'w') as fo:
for url, _ in all_final_urls_md5s:
Expand Down Expand Up @@ -247,7 +250,12 @@ def write_env_txt(info, dst_dir, urls):
).lstrip()
with open(join(dst_dir, "env.txt"), "w") as envf:
envf.write(header)
envf.write('\n'.join([f"{url}#{md5}" for url, md5 in urls]))
for url, md5 in urls:
maybe_different_url = ensure_transmuted_ext(info, url)
if maybe_different_url != url: # transmuted, no md5
envf.write(f"{maybe_different_url}\n")
else:
envf.write(f"{url}#{md5}\n")


def write_channels_txt(info, dst_dir, env_config):
Expand Down
19 changes: 19 additions & 0 deletions news/684-uninstaller-check-registry
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* The Windows uninstaller will check the registry for `$INSTDIR` before deleting hardcoded registry keys (#684)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
19 changes: 19 additions & 0 deletions news/692-micromamba-transmutation
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Adjust `@EXPLICIT` input file so that `micromamba` correctly finds the cache entries of transmuted packages. (#674 via #692)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>

0 comments on commit 5974931

Please sign in to comment.