Bundle setuptools-0.6c16dev (with Windows script changes, and the change to only warn if site.py wasn't generated by setuptools) instead of 0.6c15dev. addresses #565, #1073, #1074

This commit is contained in:
david-sarah 2010-08-01 23:06:02 -07:00
parent 907a7feeb8
commit c045241a55
43 changed files with 272 additions and 260 deletions

View File

@ -1,183 +0,0 @@
Metadata-Version: 1.0
Name: setuptools
Version: 0.6c15dev
Summary: Download, build, install, upgrade, and uninstall Python packages -- easily!
Home-page: http://pypi.python.org/pypi/setuptools
Author: Phillip J. Eby
Author-email: distutils-sig@python.org
License: PSF or ZPL
Description: ===============================
Installing and Using Setuptools
===============================
.. contents:: **Table of Contents**
-------------------------
Installation Instructions
-------------------------
Windows
=======
Install setuptools using the provided ``.exe`` installer. If you've previously
installed older versions of setuptools, please delete all ``setuptools*.egg``
and ``setuptools.pth`` files from your system's ``site-packages`` directory
(and any other ``sys.path`` directories) FIRST.
If you are upgrading a previous version of setuptools that was installed using
an ``.exe`` installer, please be sure to also *uninstall that older version*
via your system's "Add/Remove Programs" feature, BEFORE installing the newer
version.
Once installation is complete, you will find an ``easy_install.exe`` program in
your Python ``Scripts`` subdirectory. Be sure to add this directory to your
``PATH`` environment variable, if you haven't already done so.
RPM-Based Systems
=================
Install setuptools using the provided source RPM. The included ``.spec`` file
assumes you are installing using the default ``python`` executable, and is not
specific to a particular Python version. The ``easy_install`` executable will
be installed to a system ``bin`` directory such as ``/usr/bin``.
If you wish to install to a location other than the default Python
installation's default ``site-packages`` directory (and ``$prefix/bin`` for
scripts), please use the ``.egg``-based installation approach described in the
following section.
Cygwin, Mac OS X, Linux, Other
==============================
1. Download the appropriate egg for your version of Python (e.g.
``setuptools-0.6c9-py2.4.egg``). Do NOT rename it.
2. Run it as if it were a shell script, e.g. ``sh setuptools-0.6c9-py2.4.egg``.
Setuptools will install itself using the matching version of Python (e.g.
``python2.4``), and will place the ``easy_install`` executable in the
default location for installing Python scripts (as determined by the
standard distutils configuration files, or by the Python installation).
If you want to install setuptools to somewhere other than ``site-packages`` or
your default distutils installation locations for libraries and scripts, you
may include EasyInstall command-line options such as ``--prefix``,
``--install-dir``, and so on, following the ``.egg`` filename on the same
command line. For example::
sh setuptools-0.6c9-py2.4.egg --prefix=~
You can use ``--help`` to get a full options list, but we recommend consulting
the `EasyInstall manual`_ for detailed instructions, especially `the section
on custom installation locations`_.
.. _EasyInstall manual: http://peak.telecommunity.com/DevCenter/EasyInstall
.. _the section on custom installation locations: http://peak.telecommunity.com/DevCenter/EasyInstall#custom-installation-locations
Cygwin Note
-----------
If you are trying to install setuptools for the **Windows** version of Python
(as opposed to the Cygwin version that lives in ``/usr/bin``), you must make
sure that an appropriate executable (``python2.3``, ``python2.4``, or
``python2.5``) is on your **Cygwin** ``PATH`` when invoking the egg. For
example, doing the following at a Cygwin bash prompt will install setuptools
for the **Windows** Python found at ``C:\\Python24``::
ln -s /cygdrive/c/Python24/python.exe python2.4
PATH=.:$PATH sh setuptools-0.6c9-py2.4.egg
rm python2.4
Downloads
=========
All setuptools downloads can be found at `the project's home page in the Python
Package Index`_. Scroll to the very bottom of the page to find the links.
.. _the project's home page in the Python Package Index: http://pypi.python.org/pypi/setuptools#files
In addition to the PyPI downloads, the development version of ``setuptools``
is available from the `Python SVN sandbox`_, and in-development versions of the
`0.6 branch`_ are available as well.
.. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
.. _Python SVN sandbox: http://svn.python.org/projects/sandbox/trunk/setuptools/#egg=setuptools-dev
--------------------------------
Using Setuptools and EasyInstall
--------------------------------
Here are some of the available manuals, tutorials, and other resources for
learning about Setuptools, Python Eggs, and EasyInstall:
* `The EasyInstall user's guide and reference manual`_
* `The setuptools Developer's Guide`_
* `The pkg_resources API reference`_
* `Package Compatibility Notes`_ (user-maintained)
* `The Internal Structure of Python Eggs`_
Questions, comments, and bug reports should be directed to the `distutils-sig
mailing list`_. If you have written (or know of) any tutorials, documentation,
plug-ins, or other resources for setuptools users, please let us know about
them there, so this reference list can be updated. If you have working,
*tested* patches to correct problems or add features, you may submit them to
the `setuptools bug tracker`_.
.. _setuptools bug tracker: http://bugs.python.org/setuptools/
.. _Package Compatibility Notes: http://peak.telecommunity.com/DevCenter/PackageNotes
.. _The Internal Structure of Python Eggs: http://peak.telecommunity.com/DevCenter/EggFormats
.. _The setuptools Developer's Guide: http://peak.telecommunity.com/DevCenter/setuptools
.. _The pkg_resources API reference: http://peak.telecommunity.com/DevCenter/PkgResources
.. _The EasyInstall user's guide and reference manual: http://peak.telecommunity.com/DevCenter/EasyInstall
.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
-------
Credits
-------
* The original design for the ``.egg`` format and the ``pkg_resources`` API was
co-created by Phillip Eby and Bob Ippolito. Bob also implemented the first
version of ``pkg_resources``, and supplied the OS X operating system version
compatibility algorithm.
* Ian Bicking implemented many early "creature comfort" features of
easy_install, including support for downloading via Sourceforge and
Subversion repositories. Ian's comments on the Web-SIG about WSGI
application deployment also inspired the concept of "entry points" in eggs,
and he has given talks at PyCon and elsewhere to inform and educate the
community about eggs and setuptools.
* Jim Fulton contributed time and effort to build automated tests of various
aspects of ``easy_install``, and supplied the doctests for the command-line
``.exe`` wrappers on Windows.
* Phillip J. Eby is the principal author and maintainer of setuptools, and
first proposed the idea of an importable binary distribution format for
Python application plug-ins.
* Significant parts of the implementation of setuptools were funded by the Open
Source Applications Foundation, to provide a plug-in infrastructure for the
Chandler PIM application. In addition, many OSAF staffers (such as Mike
"Code Bear" Taylor) contributed their time and stress as guinea pigs for the
use of eggs and setuptools, even before eggs were "cool". (Thanks, guys!)
.. _files:
Keywords: CPAN PyPI distutils eggs package management
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Archiving :: Packaging
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities

View File

@ -0,0 +1,100 @@
Metadata-Version: 1.0
Name: setuptools
Version: 0.6c16dev
Summary: Download, build, install, upgrade, and uninstall Python packages -- easily! (zetuptoolz fork)
Home-page: http://pypi.python.org/pypi/setuptools
Author: Phillip J. Eby
Author-email: distutils-sig@python.org
License: PSF or ZPL
Description: ======================
This is not Setuptools
======================
This is the ``zetuptoolz`` fork of setuptools, which is used to install
`Tahoe-LAFS`_. It has a `darcs source repository`_ and `issue tracker`_.
For a list of differences between this fork and setuptools, see zetuptoolz.txt.
Note that, to avoid interfering with any setuptools installation, zetuptoolz
does not install a script called ``easy_install``. There is an ``easy_install_z``
script, but that is intended only for developers to test differences between
setuptools and zetuptoolz.
.. _Tahoe-LAFS: http://tahoe-lafs.org/
.. _darcs source repository: http://tahoe-lafs.org/source/zetuptoolz/trunk
.. _issue tracker: http://tahoe-lafs.org/trac/zetuptoolz
--------------------------------
Using Setuptools and EasyInstall
--------------------------------
Here are some of the available manuals, tutorials, and other resources for
learning about Setuptools, Python Eggs, and EasyInstall:
* `The EasyInstall user's guide and reference manual`_
* `The setuptools Developer's Guide`_
* `The pkg_resources API reference`_
* `Package Compatibility Notes`_ (user-maintained)
* `The Internal Structure of Python Eggs`_
Questions, comments, and bug reports should be directed to the `distutils-sig
mailing list`_. If you have written (or know of) any tutorials, documentation,
plug-ins, or other resources for setuptools users, please let us know about
them there, so this reference list can be updated. If you have working,
*tested* patches to correct problems or add features, you may submit them to
the `setuptools bug tracker`_.
.. _setuptools bug tracker: http://bugs.python.org/setuptools/
.. _Package Compatibility Notes: http://peak.telecommunity.com/DevCenter/PackageNotes
.. _The Internal Structure of Python Eggs: http://peak.telecommunity.com/DevCenter/EggFormats
.. _The setuptools Developer's Guide: http://peak.telecommunity.com/DevCenter/setuptools
.. _The pkg_resources API reference: http://peak.telecommunity.com/DevCenter/PkgResources
.. _The EasyInstall user's guide and reference manual: http://peak.telecommunity.com/DevCenter/EasyInstall
.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
-------
Credits
-------
* The original design for the ``.egg`` format and the ``pkg_resources`` API was
co-created by Phillip Eby and Bob Ippolito. Bob also implemented the first
version of ``pkg_resources``, and supplied the OS X operating system version
compatibility algorithm.
* Ian Bicking implemented many early "creature comfort" features of
easy_install, including support for downloading via Sourceforge and
Subversion repositories. Ian's comments on the Web-SIG about WSGI
application deployment also inspired the concept of "entry points" in eggs,
and he has given talks at PyCon and elsewhere to inform and educate the
community about eggs and setuptools.
* Jim Fulton contributed time and effort to build automated tests of various
aspects of ``easy_install``, and supplied the doctests for the command-line
``.exe`` wrappers on Windows.
* Phillip J. Eby is the principal author and maintainer of setuptools, and
first proposed the idea of an importable binary distribution format for
Python application plug-ins.
* Significant parts of the implementation of setuptools were funded by the Open
Source Applications Foundation, to provide a plug-in infrastructure for the
Chandler PIM application. In addition, many OSAF staffers (such as Mike
"Code Bear" Taylor) contributed their time and stress as guinea pigs for the
use of eggs and setuptools, even before eggs were "cool". (Thanks, guys!)
.. _files:
Keywords: CPAN PyPI distutils eggs package management
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Archiving :: Packaging
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities

View File

@ -34,6 +34,7 @@ setuptools/command/install_scripts.py
setuptools/command/register.py
setuptools/command/rotate.py
setuptools/command/saveopts.py
setuptools/command/scriptsetup.py
setuptools/command/sdist.py
setuptools/command/setopt.py
setuptools/command/test.py

View File

@ -4,6 +4,7 @@ rotate = setuptools.command.rotate:rotate
develop = setuptools.command.develop:develop
setopt = setuptools.command.setopt:setopt
build_py = setuptools.command.build_py:build_py
scriptsetup = setuptools.command.scriptsetup:scriptsetup
saveopts = setuptools.command.saveopts:saveopts
egg_info = setuptools.command.egg_info:egg_info
register = setuptools.command.register:register
@ -30,8 +31,8 @@ entry_points.txt = setuptools.command.egg_info:write_entries
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
[console_scripts]
easy_install = setuptools.command.easy_install:main
easy_install-2.5 = setuptools.command.easy_install:main
easy_install_z-2.6 = setuptools.command.easy_install:main
easy_install_z = setuptools.command.easy_install:main
[setuptools.file_finders]
svn_cvs = setuptools.command.sdist:_default_revctrl

View File

@ -13,7 +13,7 @@ The package resource API is designed to work with normal filesystem packages,
method.
"""
import sys, os, zipimport, time, re, imp, new, pkgutil # XXX
import sys, os, zipimport, time, re, imp
try:
frozenset

View File

@ -7,7 +7,7 @@ from distutils.core import Command as _Command
from distutils.util import convert_path
import os.path
__version__ = '0.6c15'
__version__ = '0.6c16dev'
__all__ = [
'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require',
'find_packages'

View File

@ -2,7 +2,7 @@ __all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
'sdist', 'setopt', 'test', 'upload', 'install_egg_info', 'install_scripts',
'register', 'bdist_wininst',
'register', 'bdist_wininst', 'scriptsetup',
]
import sys

View File

@ -19,6 +19,12 @@ class build_py(_build_py):
if 'data_files' in self.__dict__: del self.__dict__['data_files']
def run(self):
self.old_run()
if sys.platform == "win32":
from setuptools.command.scriptsetup import do_scriptsetup
do_scriptsetup()
def old_run(self):
"""Build modules, packages, and copy data files to build directory"""
if not self.py_modules and not self.packages:
return

View File

@ -12,6 +12,7 @@ __ http://peak.telecommunity.com/DevCenter/EasyInstall
import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random
from glob import glob
from setuptools import Command
from setuptools import __version__ as setuptools_version
from setuptools.sandbox import run_setup
from distutils import log, dir_util
from distutils.sysconfig import get_python_lib
@ -573,7 +574,7 @@ Please make the appropriate changes for your system and try again.
def install_wrapper_scripts(self, dist):
if not self.exclude_scripts:
for args in get_script_args(dist):
for args in get_script_args(dist, script_dir=self.script_dir):
self.write_script(*args)
@ -1086,10 +1087,13 @@ these changes you will not be able to run the installed code.
log.debug("Checking existing site.py in %s", self.install_dir)
current = open(sitepy,'rb').read()
if not current.startswith('def __boot():'):
raise DistutilsError(
"%s is not a setuptools-generated site.py; please"
" remove it." % sitepy
)
print ("**********************************************************************\n"
"Warning: %s is not a setuptools-generated site.py\n"
"It will not be overwritten.\n"
"**********************************************************************\n"
) % (sitepy,)
self.sitepy_installed = True
return
if current != source:
log.info("Creating %s", sitepy)
@ -1564,86 +1568,85 @@ def fix_jython_executable(executable, options):
return executable
def get_script_args(dist, executable=sys_executable, wininst=False):
def get_script_args(dist, executable=sys_executable, wininst=False, script_dir=None):
"""Yield write_script() argument tuples for a distribution's entrypoints"""
spec = str(dist.as_requirement())
header = get_script_header("", executable, wininst)
generated_by = "# generated by zetuptoolz %s" % (setuptools_version,)
for group in 'console_scripts', 'gui_scripts':
for name,ep in dist.get_entry_map(group).items():
script_text = (
for name, ep in dist.get_entry_map(group).items():
script_head, script_tail = ((
"# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n"
"%(generated_by)s\n"
"__requires__ = %(spec)r\n"
"import sys\n"
"from pkg_resources import load_entry_point\n"
"\n"
) % locals(), (
"sys.exit(\n"
" load_entry_point(%(spec)r, %(group)r, %(name)r)()\n"
")\n"
) % locals()
if sys.platform=='win32' or wininst:
# On Windows/wininst, add a .py extension and an .exe launcher
if group=='gui_scripts':
ext, launcher = '-script.pyw', 'gui.exe'
old = ['.pyw']
new_header = re.sub('(?i)python.exe','pythonw.exe',header)
else:
ext, launcher = '-script.py', 'cli.exe'
old = ['.py','.pyc','.pyo']
new_header = re.sub('(?i)pythonw.exe','python.exe',header)
) % locals())
if os.path.exists(new_header[2:-1]) or sys.platform!='win32':
if wininst or sys.platform == "win32":
# On Windows/wininst, add a .py[w] extension. Delete any existing
# -script.py[w], .exe, and .exe.manifest.
if group=='gui_scripts':
ext = '.pyw'
old = ['','.pyw','-script.pyw','.exe','.exe.manifest']
which_python = 'pythonw.exe'
new_header = re.sub('(?i)python.exe', which_python, header)
else:
ext = '.pyscript'
old = ['','.pyscript','.py','.pyc','.pyo','-script.py','.exe','.exe.manifest']
which_python = 'python.exe'
new_header = re.sub('(?i)pythonw.exe', which_python, header)
len_ext = len(ext)
script_head += (
"# If this script doesn't work for you, make sure that the %(ext)s\n"
"# extension is included in the PATHEXT environment variable, and is\n"
"# associated with %(which_python)s in the registry.\n"
"\n"
"if sys.argv[0].endswith(%(ext)r):\n"
" sys.argv[0] = sys.argv[0][:-%(len_ext)r]\n"
"\n"
) % locals()
if os.path.exists(new_header[2:-1]) or sys.platform != 'win32':
hdr = new_header
else:
hdr = header
yield (name+ext, hdr+script_text, 't', [name+x for x in old])
yield (
name+'.exe', resource_string('setuptools', launcher),
'b') # write in binary mode
yield (name+'.exe.manifest', _launcher_manifest % (name,), 't')
yield (name+ext, hdr + script_head + script_tail, 't', [name+x for x in old])
# Also write a shell script that runs the .pyscript, for cygwin.
#
# We can't use a Python script, because the Python interpreter that we want
# to use is the native Windows one, which won't understand a cygwin path.
# Windows paths written with forward slashes are universally understood
# (by native Python, cygwin Python, and bash), so we'll use 'cygpath -m' to
# get the directory from which the script was run in that form. This makes
# the cygwin script and .pyscript position-independent, provided they are
# in the same directory.
def quote_path(s):
return "\\'".join("'" + p.replace('\\', '/') + "'" for p in s.split("'"))
pyscript = quote_path("/"+name+ext)
python_path = quote_path(sys.executable)
shell_script_text = (
'#!/bin/sh\n'
'%(generated_by)s\n'
'\n'
'ScriptDir=`cygpath -m "$0/.."`\n'
'%(python_path)s "${ScriptDir}"%(pyscript)s "$@"\n'
) % locals()
yield (name, shell_script_text, 'b')
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)
_launcher_manifest = """
<?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="%s.exe"
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>"""
yield (name, header + script_head + script_tail)
def rmtree(path, ignore_errors=False, onerror=auto_chmod):

View File

@ -49,8 +49,13 @@ class install(_install):
self.path_file = None
self.extra_dirs = ''
def run(self):
self.old_run()
if sys.platform == "win32":
from setuptools.command.scriptsetup import do_scriptsetup
do_scriptsetup()
def old_run(self):
# Explicit request for old-style install? Just do it
if self.old_and_unmanageable or self.single_version_externally_managed:
return _install.run(self)
@ -75,11 +80,6 @@ class install(_install):
else:
self.do_egg_install()
def do_egg_install(self):
easy_install = self.distribution.get_command_class('easy_install')

View File

@ -0,0 +1,84 @@
This is the "zetuptoolz" fork of setuptools. This version is forked from
setuptools trunk r80621 (which is current as of 2010-08-31), with the following
differences:
* Zooko's patches for the following bugs and features have been applied:
<http://bugs.python.org/setuptools/issue17>
"easy_install will install a package that is already there"
<http://bugs.python.org/setuptools/issue54>
"be more like distutils with regard to --prefix="
<http://bugs.python.org/setuptools/issue53>
"respect the PYTHONPATH"
* The following patch to setuptools introduced bugs, and has been reverted
in zetuptoolz:
$ svn log -r 45514
------------------------------------------------------------------------
r45514 | phillip.eby | 2006-04-18 04:03:16 +0100 (Tue, 18 Apr 2006) | 9 lines
Backport pkgutil, pydoc, and doctest from the 2.5 trunk to setuptools
0.7 trunk. (Sideport?) Setuptools 0.7 will install these in place of
the 2.3/2.4 versions (at least of pydoc and doctest) to let them work
properly with eggs. pkg_resources now depends on the 2.5 pkgutil, which
is included here as _pkgutil, to work around the fact that some system
packagers will install setuptools without overriding the stdlib modules.
But users who install their own setuptools will get them, and the system
packaged people probably don't need them.
------------------------------------------------------------------------
* The scripts written by zetuptoolz have the following extra line:
# generated by zetuptoolz <version number>
after the header.
* Windows-specific changes (native Python):
Python distributions may have command-line or GUI scripts.
On Windows, setuptools creates an executable wrapper to run each
script. zetuptools uses a different approach that does not require
an .exe wrapper. It writes approximately the same script file that
is used on other platforms, but with a .pyscript extension.
It also writes a shell-script wrapper (without any extension) that
is only used when the command is run from a Cygwin shell.
Some of the advantages of this approach are:
* Unicode arguments are preserved (although the program will
need to use some Windows-specific code to get at them in
current versions of Python);
* it works correctly on 64-bit Windows;
* the zetuptoolz distribution need not contain either any
binary executables, or any C code that needs to be compiled.
See setuptools\tests\win_script_wrapper.txt for further details.
Installing or building any distribution on Windows will automatically
associate .pyscript with the native Python interpreter for the current
user. It will also add .pyscript and .pyw to the PATHEXT variable for
the current user, which is needed to allow scripts to be run without
typing any extension.
There is an additional setup.py command that can be used to perform
these steps separately (which isn't normally needed, but might be
useful for debugging):
python setup.py scriptsetup
Adding the --allusers option, i.e.
python setup.py scriptsetup --allusers
will make the .pyscript association and changes to the PATHEXT variable
for all users of this Windows installation, except those that have it
overridden in their per-user environment. In this case setup.py must be
run with Administrator privileges, e.g. from a Command Prompt whose
shortcut has been set to run as Administrator.