aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-05-04 22:05:52 -0400
committerJason R. Coombs <jaraco@jaraco.com>2013-05-04 22:05:52 -0400
commitaa5a03972360fdd48530183a60171ecbf477d1e6 (patch)
treeee75ce76e37ca199ea8f4ec64056530c07154f1a
parentdb6d5f7ac474fa0605213514e793f98a0157a2ab (diff)
downloadexternal_python_setuptools-aa5a03972360fdd48530183a60171ecbf477d1e6.tar.gz
external_python_setuptools-aa5a03972360fdd48530183a60171ecbf477d1e6.tar.bz2
external_python_setuptools-aa5a03972360fdd48530183a60171ecbf477d1e6.zip
Include a launcher manifest for console scripts to prevent undesirable UAC elevation for scripts detected as installers (such as easy_install). Fixes #143.
--HG-- branch : distribute extra : rebase_source : be6f65eea9c10ce78b6698d8c220b6e5de577292
-rw-r--r--CHANGES.txt10
-rwxr-xr-xsetuptools/command/easy_install.py13
-rw-r--r--setuptools/command/launcher manifest.xml15
3 files changed, 38 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 16461a21..69d370cb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,16 @@ CHANGES
=======
------
+0.6.37
+------
+
+* Issue #143: Launcher scripts, including easy_install itself, are now
+ accompanied by a manifest on 32-bit Windows environments to avoid the
+ Installer Detection Technology and thus undesirable UAC elevation described
+ in `this Microsoft article
+ <http://technet.microsoft.com/en-us/library/cc709628%28WS.10%29.aspx>`_.
+
+------
0.6.36
------
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 98af2620..7281d92d 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -20,6 +20,7 @@ import re
import stat
import random
from glob import glob
+import pkg_resources
from setuptools import Command, _dont_write_bytecode
from setuptools.sandbox import run_setup
from distutils import log, dir_util
@@ -1851,11 +1852,23 @@ def get_script_args(dist, executable=sys_executable, wininst=False):
name+'.exe', resource_string('setuptools', launcher),
'b' # write in binary mode
)
+ if not is_64bit():
+ # install a manifest for the launcher to prevent Windows
+ # from detecting it as an installer (which it will for
+ # launchers like easy_install.exe). Consider only
+ # adding a manifest for launchers detected as installers.
+ # See Distribute #143 for details.
+ m_name = name + '.exe.manifest'
+ yield (m_name, load_launcher_manifest(name), 't')
else:
# On other platforms, we assume the right thing to do is to
# just write the stub with no extension.
yield (name, header+script_text)
+def load_launcher_manifest(name):
+ manifest = pkg_resources.resource_string(__name__, 'launcher manifest.xml')
+ return manifest % vars()
+
def rmtree(path, ignore_errors=False, onerror=auto_chmod):
"""Recursively delete a directory tree.
diff --git a/setuptools/command/launcher manifest.xml b/setuptools/command/launcher manifest.xml
new file mode 100644
index 00000000..844d2264
--- /dev/null
+++ b/setuptools/command/launcher manifest.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity version="1.0.0.0"
+ processorArchitecture="X86"
+ name="%(name)s"
+ type="win32"/>
+ <!-- Identify the application security requirements. -->
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>