diff --git a/menuinst/_legacy/__init__.py b/menuinst/_legacy/__init__.py index 18968f42..9726eabf 100644 --- a/menuinst/_legacy/__init__.py +++ b/menuinst/_legacy/__init__.py @@ -14,7 +14,7 @@ except ImportError: __version__ = "dev" -from ..utils import DEFAULT_BASE_PREFIX, DEFAULT_PREFIX +from ..utils import DEFAULT_BASE_PREFIX, DEFAULT_PREFIX, python_executable if sys.platform == 'win32': from ..platforms.win_utils.win_elevate import isUserAdmin, runAsAdmin @@ -59,9 +59,7 @@ def install(path, remove=False, prefix=None, recursing=False, root_prefix=None): if not sys.platform == 'win32': raise RuntimeError("menuinst._legacy is only supported on Windows.") - # this root_prefix is intentional. We want to reflect the state of the root installation. - - if not exists(join(root_prefix, '.nonadmin')): + if not exists(join(prefix, ".nonadmin")) and not exists(join(root_prefix, ".nonadmin")): if isUserAdmin(): _install(path, remove, prefix, mode='system', root_prefix=root_prefix) else: @@ -70,7 +68,7 @@ def install(path, remove=False, prefix=None, recursing=False, root_prefix=None): if not recursing: retcode = runAsAdmin( [ - join(root_prefix, 'python'), + *python_executable(), '-c', "import menuinst; menuinst.install(%r, %r, %r, %r, %r)" % (path, bool(remove), prefix, True, root_prefix), diff --git a/news/260-backport-v2-admin-to-v1 b/news/260-backport-v2-admin-to-v1 new file mode 100644 index 00000000..7947d50c --- /dev/null +++ b/news/260-backport-v2-admin-to-v1 @@ -0,0 +1,19 @@ +### Enhancements + +* Partially backport privilege elevation logic from v2 to v1. (#260) + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +*