summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgtags2
-rw-r--r--CHANGES.txt610
-rw-r--r--docs/easy_install.txt14
-rw-r--r--docs/setuptools.txt591
-rw-r--r--ez_setup.py120
-rw-r--r--pkg_resources.py358
-rw-r--r--setuptools.egg-info/entry_points.txt124
-rw-r--r--setuptools.egg-info/requires.txt8
-rwxr-xr-xsetuptools/command/easy_install.py177
-rw-r--r--setuptools/dist.py25
-rw-r--r--setuptools/ssl_support.py6
-rw-r--r--setuptools/tests/test_easy_install.py4
-rw-r--r--setuptools/tests/test_resources.py133
-rw-r--r--setuptools/version.py2
-rw-r--r--tests/api_tests.txt8
-rw-r--r--tests/manual_test.py23
16 files changed, 1126 insertions, 1079 deletions
diff --git a/.hgtags b/.hgtags
index 21e59929..27fca8d4 100644
--- a/.hgtags
+++ b/.hgtags
@@ -89,3 +89,5 @@ e3d70539e79f39a97f69674ab038661961a1eb43 0.8
acc6c5d61d0f82040c237ac7ea010c0fc9e67d66 0.9.6
19965a03c1d5231c894e0fabfaf45af1fd99f484 0.9.7
e0a6e225ad6b28471cd42cfede6e8a334bb548fb 0.9.8
+7b91ff93a30ef78634b7bb34f4a6229a5de281ee 1.0b1
+aba16323ec9382da7bc77c633990ccb3bd58d050 1.0b2
diff --git a/CHANGES.txt b/CHANGES.txt
index 34bdf651..be1061e9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,32 @@
CHANGES
=======
+---
+1.0
+---
+
+* On Windows, Setuptools supports deferring to Vinay Sajip's `pylauncher
+ <https://bitbucket.org/pypa/pylauncher>`_ (included with Python 3.3) to
+ launch console and GUI scripts and not install its own launcher
+ executables. This experimental functionality is currently only enabled if
+ the ``SETUPTOOLS_USE_PYLAUNCHER`` environment variable is set (to anything).
+ In the future, this behavior may become default, but only after it has
+ matured and seen substantial adoption.
+* Issue #50: Normalized API of environment marker support. Specifically,
+ removed line number and filename from SyntaxErrors when returned from
+ `pkg_resources.invalid_marker`. Any clients depending on the specific
+ string representation of exceptions returned by that function may need to
+ be updated to account for this change.
+* Issue #50: SyntaxErrors generated by `pkg_resources.invalid_marker` are
+ normalized for cross-implementation consistency.
+* Issue #63: Bootstrap script (ez_setup.py) now prefers Powershell, curl, or
+ wget for retrieving the Setuptools tarball for improved security of the
+ install. The script will still fall back to a simple ``urlopen`` on
+ platforms that do not have these tools.
+* Issue #65: Deprecated the ``Features`` functionality.
+* Issue #52: In ``VerifyingHTTPSConn``, handle a tunnelled (proxied)
+ connection.
+
-----
0.9.8
-----
@@ -755,3 +781,587 @@ easy_install
* Immediately close all file handles. This closes Distribute #3.
+-----
+0.6c9
+-----
+
+ * Fixed a missing files problem when using Windows source distributions on
+ non-Windows platforms, due to distutils not handling manifest file line
+ endings correctly.
+
+ * Updated Pyrex support to work with Pyrex 0.9.6 and higher.
+
+ * Minor changes for Jython compatibility, including skipping tests that can't
+ work on Jython.
+
+ * Fixed not installing eggs in ``install_requires`` if they were also used for
+ ``setup_requires`` or ``tests_require``.
+
+ * Fixed not fetching eggs in ``install_requires`` when running tests.
+
+ * Allow ``ez_setup.use_setuptools()`` to upgrade existing setuptools
+ installations when called from a standalone ``setup.py``.
+
+ * Added a warning if a namespace package is declared, but its parent package
+ is not also declared as a namespace.
+
+ * Support Subversion 1.5
+
+ * Removed use of deprecated ``md5`` module if ``hashlib`` is available
+
+ * Fixed ``bdist_wininst upload`` trying to upload the ``.exe`` twice
+
+ * Fixed ``bdist_egg`` putting a ``native_libs.txt`` in the source package's
+ ``.egg-info``, when it should only be in the built egg's ``EGG-INFO``.
+
+ * Ensure that _full_name is set on all shared libs before extensions are
+ checked for shared lib usage. (Fixes a bug in the experimental shared
+ library build support.)
+
+ * Fix to allow unpacked eggs containing native libraries to fail more
+ gracefully under Google App Engine (with an ``ImportError`` loading the
+ C-based module, instead of getting a ``NameError``).
+
+-----
+0.6c7
+-----
+
+ * Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and
+ ``egg_info`` command failing on new, uncommitted SVN directories.
+
+ * Fix import problems with nested namespace packages installed via
+ ``--root`` or ``--single-version-externally-managed``, due to the
+ parent package not having the child package as an attribute.
+
+-----
+0.6c6
+-----
+
+ * Added ``--egg-path`` option to ``develop`` command, allowing you to force
+ ``.egg-link`` files to use relative paths (allowing them to be shared across
+ platforms on a networked drive).
+
+ * Fix not building binary RPMs correctly.
+
+ * Fix "eggsecutables" (such as setuptools' own egg) only being runnable with
+ bash-compatible shells.
+
+ * Fix ``#!`` parsing problems in Windows ``.exe`` script wrappers, when there
+ was whitespace inside a quoted argument or at the end of the ``#!`` line
+ (a regression introduced in 0.6c4).
+
+ * Fix ``test`` command possibly failing if an older version of the project
+ being tested was installed on ``sys.path`` ahead of the test source
+ directory.
+
+ * Fix ``find_packages()`` treating ``ez_setup`` and directories with ``.`` in
+ their names as packages.
+
+-----
+0.6c5
+-----
+
+ * Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg``
+ packages under Python versions less than 2.5.
+
+ * Fix uploaded ``bdist_wininst`` packages being described as suitable for
+ "any" version by Python 2.5, even if a ``--target-version`` was specified.
+
+-----
+0.6c4
+-----
+
+ * Overhauled Windows script wrapping to support ``bdist_wininst`` better.
+ Scripts installed with ``bdist_wininst`` will always use ``#!python.exe`` or
+ ``#!pythonw.exe`` as the executable name (even when built on non-Windows
+ platforms!), and the wrappers will look for the executable in the script's
+ parent directory (which should find the right version of Python).
+
+ * Fix ``upload`` command not uploading files built by ``bdist_rpm`` or
+ ``bdist_wininst`` under Python 2.3 and 2.4.
+
+ * Add support for "eggsecutable" headers: a ``#!/bin/sh`` script that is
+ prepended to an ``.egg`` file to allow it to be run as a script on Unix-ish
+ platforms. (This is mainly so that setuptools itself can have a single-file
+ installer on Unix, without doing multiple downloads, dealing with firewalls,
+ etc.)
+
+ * Fix problem with empty revision numbers in Subversion 1.4 ``entries`` files
+
+ * Use cross-platform relative paths in ``easy-install.pth`` when doing
+ ``develop`` and the source directory is a subdirectory of the installation
+ target directory.
+
+ * Fix a problem installing eggs with a system packaging tool if the project
+ contained an implicit namespace package; for example if the ``setup()``
+ listed a namespace package ``foo.bar`` without explicitly listing ``foo``
+ as a namespace package.
+
+-----
+0.6c3
+-----
+
+ * Fixed breakages caused by Subversion 1.4's new "working copy" format
+
+-----
+0.6c2
+-----
+
+ * The ``ez_setup`` module displays the conflicting version of setuptools (and
+ its installation location) when a script requests a version that's not
+ available.
+
+ * Running ``setup.py develop`` on a setuptools-using project will now install
+ setuptools if needed, instead of only downloading the egg.
+
+-----
+0.6c1
+-----
+
+ * Fixed ``AttributeError`` when trying to download a ``setup_requires``
+ dependency when a distribution lacks a ``dependency_links`` setting.
+
+ * Made ``zip-safe`` and ``not-zip-safe`` flag files contain a single byte, so
+ as to play better with packaging tools that complain about zero-length
+ files.
+
+ * Made ``setup.py develop`` respect the ``--no-deps`` option, which it
+ previously was ignoring.
+
+ * Support ``extra_path`` option to ``setup()`` when ``install`` is run in
+ backward-compatibility mode.
+
+ * Source distributions now always include a ``setup.cfg`` file that explicitly
+ sets ``egg_info`` options such that they produce an identical version number
+ to the source distribution's version number. (Previously, the default
+ version number could be different due to the use of ``--tag-date``, or if
+ the version was overridden on the command line that built the source
+ distribution.)
+
+-----
+0.6b4
+-----
+
+ * Fix ``register`` not obeying name/version set by ``egg_info`` command, if
+ ``egg_info`` wasn't explicitly run first on the same command line.
+
+ * Added ``--no-date`` and ``--no-svn-revision`` options to ``egg_info``
+ command, to allow suppressing tags configured in ``setup.cfg``.
+
+ * Fixed redundant warnings about missing ``README`` file(s); it should now
+ appear only if you are actually a source distribution.
+
+-----
+0.6b3
+-----
+
+ * Fix ``bdist_egg`` not including files in subdirectories of ``.egg-info``.
+
+ * Allow ``.py`` files found by the ``include_package_data`` option to be
+ automatically included. Remove duplicate data file matches if both
+ ``include_package_data`` and ``package_data`` are used to refer to the same
+ files.
+
+-----
+0.6b1
+-----
+
+ * Strip ``module`` from the end of compiled extension modules when computing
+ the name of a ``.py`` loader/wrapper. (Python's import machinery ignores
+ this suffix when searching for an extension module.)
+
+------
+0.6a11
+------
+
+ * Added ``test_loader`` keyword to support custom test loaders
+
+ * Added ``setuptools.file_finders`` entry point group to allow implementing
+ revision control plugins.
+
+ * Added ``--identity`` option to ``upload`` command.
+
+ * Added ``dependency_links`` to allow specifying URLs for ``--find-links``.
+
+ * Enhanced test loader to scan packages as well as modules, and call
+ ``additional_tests()`` if present to get non-unittest tests.
+
+ * Support namespace packages in conjunction with system packagers, by omitting
+ the installation of any ``__init__.py`` files for namespace packages, and
+ adding a special ``.pth`` file to create a working package in
+ ``sys.modules``.
+
+ * Made ``--single-version-externally-managed`` automatic when ``--root`` is
+ used, so that most system packagers won't require special support for
+ setuptools.
+
+ * Fixed ``setup_requires``, ``tests_require``, etc. not using ``setup.cfg`` or
+ other configuration files for their option defaults when installing, and
+ also made the install use ``--multi-version`` mode so that the project
+ directory doesn't need to support .pth files.
+
+ * ``MANIFEST.in`` is now forcibly closed when any errors occur while reading
+ it. Previously, the file could be left open and the actual error would be
+ masked by problems trying to remove the open file on Windows systems.
+
+------
+0.6a10
+------
+
+ * Fixed the ``develop`` command ignoring ``--find-links``.
+
+-----
+0.6a9
+-----
+
+ * The ``sdist`` command no longer uses the traditional ``MANIFEST`` file to
+ create source distributions. ``MANIFEST.in`` is still read and processed,
+ as are the standard defaults and pruning. But the manifest is built inside
+ the project's ``.egg-info`` directory as ``SOURCES.txt``, and it is rebuilt
+ every time the ``egg_info`` command is run.
+
+ * Added the ``include_package_data`` keyword to ``setup()``, allowing you to
+ automatically include any package data listed in revision control or
+ ``MANIFEST.in``
+
+ * Added the ``exclude_package_data`` keyword to ``setup()``, allowing you to
+ trim back files included via the ``package_data`` and
+ ``include_package_data`` options.
+
+ * Fixed ``--tag-svn-revision`` not working when run from a source
+ distribution.
+
+ * Added warning for namespace packages with missing ``declare_namespace()``
+
+ * Added ``tests_require`` keyword to ``setup()``, so that e.g. packages
+ requiring ``nose`` to run unit tests can make this dependency optional
+ unless the ``test`` command is run.
+
+ * Made all commands that use ``easy_install`` respect its configuration
+ options, as this was causing some problems with ``setup.py install``.
+
+ * Added an ``unpack_directory()`` driver to ``setuptools.archive_util``, so
+ that you can process a directory tree through a processing filter as if it
+ were a zipfile or tarfile.
+
+ * Added an internal ``install_egg_info`` command to use as part of old-style
+ ``install`` operations, that installs an ``.egg-info`` directory with the
+ package.
+
+ * Added a ``--single-version-externally-managed`` option to the ``install``
+ command so that you can more easily wrap a "flat" egg in a system package.
+
+ * Enhanced ``bdist_rpm`` so that it installs single-version eggs that
+ don't rely on a ``.pth`` file. The ``--no-egg`` option has been removed,
+ since all RPMs are now built in a more backwards-compatible format.
+
+ * Support full roundtrip translation of eggs to and from ``bdist_wininst``
+ format. Running ``bdist_wininst`` on a setuptools-based package wraps the
+ egg in an .exe that will safely install it as an egg (i.e., with metadata
+ and entry-point wrapper scripts), and ``easy_install`` can turn the .exe
+ back into an ``.egg`` file or directory and install it as such.
+
+
+-----
+0.6a8
+-----
+
+ * Fixed some problems building extensions when Pyrex was installed, especially
+ with Python 2.4 and/or packages using SWIG.
+
+ * Made ``develop`` command accept all the same options as ``easy_install``,
+ and use the ``easy_install`` command's configuration settings as defaults.
+
+ * Made ``egg_info --tag-svn-revision`` fall back to extracting the revision
+ number from ``PKG-INFO`` in case it is being run on a source distribution of
+ a snapshot taken from a Subversion-based project.
+
+ * Automatically detect ``.dll``, ``.so`` and ``.dylib`` files that are being
+ installed as data, adding them to ``native_libs.txt`` automatically.
+
+ * Fixed some problems with fresh checkouts of projects that don't include
+ ``.egg-info/PKG-INFO`` under revision control and put the project's source
+ code directly in the project directory. If such a package had any
+ requirements that get processed before the ``egg_info`` command can be run,
+ the setup scripts would fail with a "Missing 'Version:' header and/or
+ PKG-INFO file" error, because the egg runtime interpreted the unbuilt
+ metadata in a directory on ``sys.path`` (i.e. the current directory) as
+ being a corrupted egg. Setuptools now monkeypatches the distribution
+ metadata cache to pretend that the egg has valid version information, until
+ it has a chance to make it actually be so (via the ``egg_info`` command).
+
+-----
+0.6a5
+-----
+
+ * Fixed missing gui/cli .exe files in distribution. Fixed bugs in tests.
+
+-----
+0.6a3
+-----
+
+ * Added ``gui_scripts`` entry point group to allow installing GUI scripts
+ on Windows and other platforms. (The special handling is only for Windows;
+ other platforms are treated the same as for ``console_scripts``.)
+
+-----
+0.6a2
+-----
+
+ * Added ``console_scripts`` entry point group to allow installing scripts
+ without the need to create separate script files. On Windows, console
+ scripts get an ``.exe`` wrapper so you can just type their name. On other
+ platforms, the scripts are written without a file extension.
+
+-----
+0.6a1
+-----
+
+ * Added support for building "old-style" RPMs that don't install an egg for
+ the target package, using a ``--no-egg`` option.
+
+ * The ``build_ext`` command now works better when using the ``--inplace``
+ option and multiple Python versions. It now makes sure that all extensions
+ match the current Python version, even if newer copies were built for a
+ different Python version.
+
+ * The ``upload`` command no longer attaches an extra ``.zip`` when uploading
+ eggs, as PyPI now supports egg uploads without trickery.
+
+ * The ``ez_setup`` script/module now displays a warning before downloading
+ the setuptools egg, and attempts to check the downloaded egg against an
+ internal MD5 checksum table.
+
+ * Fixed the ``--tag-svn-revision`` option of ``egg_info`` not finding the
+ latest revision number; it was using the revision number of the directory
+ containing ``setup.py``, not the highest revision number in the project.
+
+ * Added ``eager_resources`` setup argument
+
+ * The ``sdist`` command now recognizes Subversion "deleted file" entries and
+ does not include them in source distributions.
+
+ * ``setuptools`` now embeds itself more thoroughly into the distutils, so that
+ other distutils extensions (e.g. py2exe, py2app) will subclass setuptools'
+ versions of things, rather than the native distutils ones.
+
+ * Added ``entry_points`` and ``setup_requires`` arguments to ``setup()``;
+ ``setup_requires`` allows you to automatically find and download packages
+ that are needed in order to *build* your project (as opposed to running it).
+
+ * ``setuptools`` now finds its commands, ``setup()`` argument validators, and
+ metadata writers using entry points, so that they can be extended by
+ third-party packages. See `Creating distutils Extensions`_ above for more
+ details.
+
+ * The vestigial ``depends`` command has been removed. It was never finished
+ or documented, and never would have worked without EasyInstall - which it
+ pre-dated and was never compatible with.
+
+------
+0.5a12
+------
+
+ * The zip-safety scanner now checks for modules that might be used with
+ ``python -m``, and marks them as unsafe for zipping, since Python 2.4 can't
+ handle ``-m`` on zipped modules.
+
+------
+0.5a11
+------
+
+ * Fix breakage of the "develop" command that was caused by the addition of
+ ``--always-unzip`` to the ``easy_install`` command.
+
+-----
+0.5a9
+-----
+
+ * Include ``svn:externals`` directories in source distributions as well as
+ normal subversion-controlled files and directories.
+
+ * Added ``exclude=patternlist`` option to ``setuptools.find_packages()``
+
+ * Changed --tag-svn-revision to include an "r" in front of the revision number
+ for better readability.
+
+ * Added ability to build eggs without including source files (except for any
+ scripts, of course), using the ``--exclude-source-files`` option to
+ ``bdist_egg``.
+
+ * ``setup.py install`` now automatically detects when an "unmanaged" package
+ or module is going to be on ``sys.path`` ahead of a package being installed,
+ thereby preventing the newer version from being imported. If this occurs,
+ a warning message is output to ``sys.stderr``, but installation proceeds
+ anyway. The warning message informs the user what files or directories
+ need deleting, and advises them they can also use EasyInstall (with the
+ ``--delete-conflicting`` option) to do it automatically.
+
+ * The ``egg_info`` command now adds a ``top_level.txt`` file to the metadata
+ directory that lists all top-level modules and packages in the distribution.
+ This is used by the ``easy_install`` command to find possibly-conflicting
+ "unmanaged" packages when installing the distribution.
+
+ * Added ``zip_safe`` and ``namespace_packages`` arguments to ``setup()``.
+ Added package analysis to determine zip-safety if the ``zip_safe`` flag
+ is not given, and advise the author regarding what code might need changing.
+
+ * Fixed the swapped ``-d`` and ``-b`` options of ``bdist_egg``.
+
+-----
+0.5a8
+-----
+
+ * The "egg_info" command now always sets the distribution metadata to "safe"
+ forms of the distribution name and version, so that distribution files will
+ be generated with parseable names (i.e., ones that don't include '-' in the
+ name or version). Also, this means that if you use the various ``--tag``
+ options of "egg_info", any distributions generated will use the tags in the
+ version, not just egg distributions.
+
+ * Added support for defining command aliases in distutils configuration files,
+ under the "[aliases]" section. To prevent recursion and to allow aliases to
+ call the command of the same name, a given alias can be expanded only once
+ per command-line invocation. You can define new aliases with the "alias"
+ command, either for the local, global, or per-user configuration.
+
+ * Added "rotate" command to delete old distribution files, given a set of
+ patterns to match and the number of files to keep. (Keeps the most
+ recently-modified distribution files matching each pattern.)
+
+ * Added "saveopts" command that saves all command-line options for the current
+ invocation to the local, global, or per-user configuration file. Useful for
+ setting defaults without having to hand-edit a configuration file.
+
+ * Added a "setopt" command that sets a single option in a specified distutils
+ configuration file.
+
+-----
+0.5a7
+-----
+
+ * Added "upload" support for egg and source distributions, including a bug
+ fix for "upload" and a temporary workaround for lack of .egg support in
+ PyPI.
+
+-----
+0.5a6
+-----
+
+ * Beefed up the "sdist" command so that if you don't have a MANIFEST.in, it
+ will include all files under revision control (CVS or Subversion) in the
+ current directory, and it will regenerate the list every time you create a
+ source distribution, not just when you tell it to. This should make the
+ default "do what you mean" more often than the distutils' default behavior
+ did, while still retaining the old behavior in the presence of MANIFEST.in.
+
+ * Fixed the "develop" command always updating .pth files, even if you
+ specified ``-n`` or ``--dry-run``.
+
+ * Slightly changed the format of the generated version when you use
+ ``--tag-build`` on the "egg_info" command, so that you can make tagged
+ revisions compare *lower* than the version specified in setup.py (e.g. by
+ using ``--tag-build=dev``).
+
+-----
+0.5a5
+-----
+
+ * Added ``develop`` command to ``setuptools``-based packages. This command
+ installs an ``.egg-link`` pointing to the package's source directory, and
+ script wrappers that ``execfile()`` the source versions of the package's
+ scripts. This lets you put your development checkout(s) on sys.path without
+ having to actually install them. (To uninstall the link, use
+ use ``setup.py develop --uninstall``.)
+
+ * Added ``egg_info`` command to ``setuptools``-based packages. This command
+ just creates or updates the "projectname.egg-info" directory, without
+ building an egg. (It's used by the ``bdist_egg``, ``test``, and ``develop``
+ commands.)
+
+ * Enhanced the ``test`` command so that it doesn't install the package, but
+ instead builds any C extensions in-place, updates the ``.egg-info``
+ metadata, adds the source directory to ``sys.path``, and runs the tests
+ directly on the source. This avoids an "unmanaged" installation of the
+ package to ``site-packages`` or elsewhere.
+
+ * Made ``easy_install`` a standard ``setuptools`` command, moving it from
+ the ``easy_install`` module to ``setuptools.command.easy_install``. Note
+ that if you were importing or extending it, you must now change your imports
+ accordingly. ``easy_install.py`` is still installed as a script, but not as
+ a module.
+
+-----
+0.5a4
+-----
+
+ * Setup scripts using setuptools can now list their dependencies directly in
+ the setup.py file, without having to manually create a ``depends.txt`` file.
+ The ``install_requires`` and ``extras_require`` arguments to ``setup()``
+ are used to create a dependencies file automatically. If you are manually
+ creating ``depends.txt`` right now, please switch to using these setup
+ arguments as soon as practical, because ``depends.txt`` support will be
+ removed in the 0.6 release cycle. For documentation on the new arguments,
+ see the ``setuptools.dist.Distribution`` class.
+
+ * Setup scripts using setuptools now always install using ``easy_install``
+ internally, for ease of uninstallation and upgrading.
+
+-----
+0.5a1
+-----
+
+ * Added support for "self-installation" bootstrapping. Packages can now
+ include ``ez_setup.py`` in their source distribution, and add the following
+ to their ``setup.py``, in order to automatically bootstrap installation of
+ setuptools as part of their setup process::
+
+ from ez_setup import use_setuptools
+ use_setuptools()
+
+ from setuptools import setup
+ # etc...
+
+-----
+0.4a2
+-----
+
+ * Added ``ez_setup.py`` installer/bootstrap script to make initial setuptools
+ installation easier, and to allow distributions using setuptools to avoid
+ having to include setuptools in their source distribution.
+
+ * All downloads are now managed by the ``PackageIndex`` class (which is now
+ subclassable and replaceable), so that embedders can more easily override
+ download logic, give download progress reports, etc. The class has also
+ been moved to the new ``setuptools.package_index`` module.
+
+ * The ``Installer`` class no longer handles downloading, manages a temporary
+ directory, or tracks the ``zip_ok`` option. Downloading is now handled
+ by ``PackageIndex``, and ``Installer`` has become an ``easy_install``
+ command class based on ``setuptools.Command``.
+
+ * There is a new ``setuptools.sandbox.run_setup()`` API to invoke a setup
+ script in a directory sandbox, and a new ``setuptools.archive_util`` module
+ with an ``unpack_archive()`` API. These were split out of EasyInstall to
+ allow reuse by other tools and applications.
+
+ * ``setuptools.Command`` now supports reinitializing commands using keyword
+ arguments to set/reset options. Also, ``Command`` subclasses can now set
+ their ``command_consumes_arguments`` attribute to ``True`` in order to
+ receive an ``args`` option containing the rest of the command line.
+
+-----
+0.3a2
+-----
+
+ * Added new options to ``bdist_egg`` to allow tagging the egg's version number
+ with a subversion revision number, the current date, or an explicit tag
+ value. Run ``setup.py bdist_egg --help`` to get more information.
+
+ * Misc. bug fixes
+
+-----
+0.3a1
+-----
+
+ * Initial release.
diff --git a/docs/easy_install.txt b/docs/easy_install.txt
index 12bc73ea..03f816de 100644
--- a/docs/easy_install.txt
+++ b/docs/easy_install.txt
@@ -35,9 +35,8 @@ Please see the `setuptools PyPI page <https://pypi.python.org/pypi/setuptools>`_
for download links and basic installation instructions for each of the
supported platforms.
-You will need at least Python 2.3.5, or if you are on a 64-bit platform, Python
-2.4. An ``easy_install`` script will be installed in the normal location for
-Python scripts on your platform.
+You will need at least Python 2.4. An ``easy_install`` script will be
+installed in the normal location for Python scripts on your platform.
Note that the instructions on the setuptools PyPI page assume that you are
are installling to Python's primary ``site-packages`` directory. If this is
@@ -96,6 +95,15 @@ sections below on `Command-Line Options`_ and `Configuration Files`_. You
can pass command line options (such as ``--script-dir``) to
``ez_setup.py`` to control where ``easy_install.exe`` will be installed.
+Setuptools also supports deferring to an external launcher such as
+`pylauncher <https://bitbucket.org/pypa/pylauncher>`_ for launching scripts.
+Enable this experimental functionality by setting the
+``SETUPTOOLS_USE_PYLAUNCHER`` environment variable. Setuptools will then not
+install its own launcher executable, but will install scripts as simple
+scripts with a .py (or .pyw) extension appended. If these extensions are
+associated with the pylauncher and listed in the PATHEXT environment variable,
+these scripts can then be invoked simply and directly just like any other
+executable.
Downloading and Installing a Package
diff --git a/docs/setuptools.txt b/docs/setuptools.txt
index 5d80b230..dfa9ecdd 100644
--- a/docs/setuptools.txt
+++ b/docs/setuptools.txt
@@ -20,7 +20,7 @@ package from source and doesn't have a suitable version already installed.
Feature Highlights:
* Automatically find/download/install/upgrade dependencies at build time using
- the `EasyInstall tool <http://peak.telecommunity.com/DevCenter/EasyInstall>`_,
+ the `EasyInstall tool <easy_install.html>`_,
which supports downloading via HTTP, FTP, Subversion, and SourceForge, and
automatically scans web pages linked from PyPI to find download links. (It's
the closest thing to CPAN currently available for Python.)
@@ -72,7 +72,7 @@ is available from the `Python SVN sandbox`_, and in-development versions of the
.. contents:: **Table of Contents**
-.. _distribute_setup.py: `bootstrap module`_
+.. _ez_setup.py: `bootstrap module`_
-----------------
@@ -88,14 +88,14 @@ current stable version of setuptools. In particular, be sure to read the
section on `Custom Installation Locations`_ if you are installing anywhere
other than Python's ``site-packages`` directory.
-.. _EasyInstall Installation Instructions: http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions
+.. _EasyInstall Installation Instructions: easy_install.html#installation-instructions
-.. _Custom Installation Locations: http://peak.telecommunity.com/DevCenter/EasyInstall#custom-installation-locations
+.. _Custom Installation Locations: easy_install.html#custom-installation-locations
If you want the current in-development version of setuptools, you should first
install a stable version, and then run::
- distribute_setup.py setuptools==dev
+ ez_setup.py setuptools==dev
This will download and install the latest development (i.e. unstable) version
of setuptools from the Python Subversion sandbox.
@@ -529,7 +529,7 @@ Python must be available via the ``PATH`` environment variable, under its
"long" name. That is, if the egg is built for Python 2.3, there must be a
``python2.3`` executable present in a directory on ``PATH``.
-This feature is primarily intended to support distribute_setup the installation of
+This feature is primarily intended to support ez_setup the installation of
setuptools itself on non-Windows platforms, but may also be useful for other
projects as well.
@@ -652,7 +652,7 @@ A more complete example would be:
``vcs+proto://host/path@revision#egg=project-version``
Be careful with the version. It should match the one inside the project files.
-If you want do disregard the version, you have to omit it both in the
+If you want to disregard the version, you have to omit it both in the
``requires`` and in the URL's fragment.
This will do a checkout (or a clone, in Git and Mercurial parlance) to a
@@ -713,10 +713,11 @@ declare it like this, so that the "PDF" requirements are only resolved if the
name="Project-A",
...
entry_points = {
- 'console_scripts':
- ['rst2pdf = project_a.tools.pdfgen [PDF]'],
- ['rst2html = project_a.tools.htmlgen'],
+ 'console_scripts': [
+ 'rst2pdf = project_a.tools.pdfgen [PDF]',
+ 'rst2html = project_a.tools.htmlgen',
# more script entry points ...
+ ],
}
)
@@ -1147,20 +1148,20 @@ Using ``setuptools``... Without bundling it!
Your users might not have ``setuptools`` installed on their machines, or even
if they do, it might not be the right version. Fixing this is easy; just
-download `distribute_setup.py`_, and put it in the same directory as your ``setup.py``
+download `ez_setup.py`_, and put it in the same directory as your ``setup.py``
script. (Be sure to add it to your revision control system, too.) Then add
these two lines to the very top of your setup script, before the script imports
anything from setuptools:
.. code-block:: python
- import distribute_setup
- distribute_setup.use_setuptools()
+ import ez_setup
+ ez_setup.use_setuptools()
-That's it. The ``distribute_setup`` module will automatically download a matching
+That's it. The ``ez_setup`` module will automatically download a matching
version of ``setuptools`` from PyPI, if it isn't present on the target system.
Whenever you install an updated version of setuptools, you should also update
-your projects' ``distribute_setup.py`` files, so that a matching version gets installed
+your projects' ``ez_setup.py`` files, so that a matching version gets installed
on the target machine(s).
By the way, setuptools supports the new PyPI "upload" command, so you can use
@@ -1190,7 +1191,7 @@ relevant to your project and your target audience isn't already familiar with
setuptools and ``easy_install``.
Network Access
- If your project is using ``distribute_setup``, you should inform users of the
+ If your project is using ``ez_setup``, you should inform users of the
need to either have network access, or to preinstall the correct version of
setuptools using the `EasyInstall installation instructions`_. Those
instructions also have tips for dealing with firewalls as well as how to
@@ -1266,45 +1267,6 @@ Creating System Packages
resolve the issue.
-
-Managing Multiple Projects
---------------------------
-
-If you're managing several projects that need to use ``distribute_setup``, and you
-are using Subversion as your revision control system, you can use the
-"svn:externals" property to share a single copy of ``distribute_setup`` between
-projects, so that it will always be up-to-date whenever you check out or update
-an individual project, without having to manually update each project to use
-a new version.
-
-However, because Subversion only supports using directories as externals, you
-have to turn ``distribute_setup.py`` into ``distribute_setup/__init__.py`` in order
-to do this, then create "externals" definitions that map the ``distribute_setup``
-directory into each project. Also, if any of your projects use
-``find_packages()`` on their setup directory, you will need to exclude the
-resulting ``distribute_setup`` package, to keep it from being included in your
-distributions, e.g.::
-
- setup(
- ...
- packages = find_packages(exclude=['distribute_setup']),
- )
-
-Of course, the ``distribute_setup`` package will still be included in your
-packages' source distributions, as it needs to be.
-
-For your convenience, you may use the following external definition, which will
-track the latest version of setuptools::
-
- ez_setup svn://svn.eby-sarna.com/svnroot/ez_setup
-
-You can set this by executing this command in your project directory::
-
- svn propedit svn:externals .
-
-And then adding the line shown above to the file that comes up for editing.
-
-
Setting the ``zip_safe`` flag
-----------------------------
@@ -1416,20 +1378,21 @@ other copies will ever be loaded!)
TRANSITIONAL NOTE
~~~~~~~~~~~~~~~~~
-Setuptools 0.6a automatically calls ``declare_namespace()`` for you at runtime,
-but the 0.7a versions will *not*. This is because the automatic declaration
+Setuptools automatically calls ``declare_namespace()`` for you at runtime,
+but future versions may *not*. This is because the automatic declaration
feature has some negative side effects, such as needing to import all namespace
packages during the initialization of the ``pkg_resources`` runtime, and also
the need for ``pkg_resources`` to be explicitly imported before any namespace
-packages work at all. Beginning with the 0.7a releases, you'll be responsible
+packages work at all. In some future releases, you'll be responsible
for including your own declaration lines, and the automatic declaration feature
will be dropped to get rid of the negative side effects.
-During the remainder of the 0.6 development cycle, therefore, setuptools will
-warn you about missing ``declare_namespace()`` calls in your ``__init__.py``
-files, and you should correct these as soon as possible before setuptools 0.7a1
-is released. Namespace packages without declaration lines will not work
-correctly once a user has upgraded to setuptools 0.7a1, so it's important that
+During the remainder of the current development cycle, therefore, setuptools
+will warn you about missing ``declare_namespace()`` calls in your
+``__init__.py`` files, and you should correct these as soon as possible
+before the compatibility support is removed.
+Namespace packages without declaration lines will not work
+correctly once a user has upgraded to a later version, so it's important that
you make this change now in order to avoid having your code break in the field.
Our apologies for the inconvenience, and thank you for your patience.
@@ -1984,7 +1947,7 @@ them in a ``[develop]`` section or on the command line.
============================================
This command runs the `EasyInstall tool
-<http://peak.telecommunity.com/DevCenter/EasyInstall>`_ for you. It is exactly
+<easy_install.html>`_ for you. It is exactly
equivalent to running the ``easy_install`` command. All command line arguments
following this command are consumed and not processed further by the distutils,
so this must be the last command listed on the command line. Please see
@@ -2699,8 +2662,8 @@ XXX
Reusing ``setuptools`` Code
===========================
-``distribute_setup``
---------------------
+``ez_setup``
+------------
XXX
@@ -2722,500 +2685,6 @@ XXX
XXX
-History
-=======
-
-0.6c9
- * Fixed a missing files problem when using Windows source distributions on
- non-Windows platforms, due to distutils not handling manifest file line
- endings correctly.
-
- * Updated Pyrex support to work with Pyrex 0.9.6 and higher.
-
- * Minor changes for Jython compatibility, including skipping tests that can't
- work on Jython.
-
- * Fixed not installing eggs in ``install_requires`` if they were also used for
- ``setup_requires`` or ``tests_require``.
-
- * Fixed not fetching eggs in ``install_requires`` when running tests.
-
- * Allow ``ez_setup.use_setuptools()`` to upgrade existing setuptools
- installations when called from a standalone ``setup.py``.
-
- * Added a warning if a namespace package is declared, but its parent package
- is not also declared as a namespace.
-
- * Support Subversion 1.5
-
- * Removed use of deprecated ``md5`` module if ``hashlib`` is available
-
- * Fixed ``bdist_wininst upload`` trying to upload the ``.exe`` twice
-
- * Fixed ``bdist_egg`` putting a ``native_libs.txt`` in the source package's
- ``.egg-info``, when it should only be in the built egg's ``EGG-INFO``.
-
- * Ensure that _full_name is set on all shared libs before extensions are
- checked for shared lib usage. (Fixes a bug in the experimental shared
- library build support.)
-
- * Fix to allow unpacked eggs containing native libraries to fail more
- gracefully under Google App Engine (with an ``ImportError`` loading the
- C-based module, instead of getting a ``NameError``).
-
-0.6c7
- * Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and
- ``egg_info`` command failing on new, uncommitted SVN directories.
-
- * Fix import problems with nested namespace packages installed via
- ``--root`` or ``--single-version-externally-managed``, due to the
- parent package not having the child package as an attribute.
-
-0.6c6
- * Added ``--egg-path`` option to ``develop`` command, allowing you to force
- ``.egg-link`` files to use relative paths (allowing them to be shared across
- platforms on a networked drive).
-
- * Fix not building binary RPMs correctly.
-
- * Fix "eggsecutables" (such as setuptools' own egg) only being runnable with
- bash-compatible shells.
-
- * Fix ``#!`` parsing problems in Windows ``.exe`` script wrappers, when there
- was whitespace inside a quoted argument or at the end of the ``#!`` line
- (a regression introduced in 0.6c4).
-
- * Fix ``test`` command possibly failing if an older version of the project
- being tested was installed on ``sys.path`` ahead of the test source
- directory.
-
- * Fix ``find_packages()`` treating ``ez_setup`` and directories with ``.`` in
- their names as packages.
-
-0.6c5
- * Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg``
- packages under Python versions less than 2.5.
-
- * Fix uploaded ``bdist_wininst`` packages being described as suitable for
- "any" version by Python 2.5, even if a ``--target-version`` was specified.
-
-0.6c4
- * Overhauled Windows script wrapping to support ``bdist_wininst`` better.
- Scripts installed with ``bdist_wininst`` will always use ``#!python.exe`` or
- ``#!pythonw.exe`` as the executable name (even when built on non-Windows
- platforms!), and the wrappers will look for the executable in the script's
- parent directory (which should find the right version of Python).
-
- * Fix ``upload`` command not uploading files built by ``bdist_rpm`` or
- ``bdist_wininst`` under Python 2.3 and 2.4.
-
- * Add support for "eggsecutable" headers: a ``#!/bin/sh`` script that is
- prepended to an ``.egg`` file to allow it to be run as a script on Unix-ish
- platforms. (This is mainly so that setuptools itself can have a single-file
- installer on Unix, without doing multiple downloads, dealing with firewalls,
- etc.)
-
- * Fix problem with empty revision numbers in Subversion 1.4 ``entries`` files
-
- * Use cross-platform relative paths in ``easy-install.pth`` when doing
- ``develop`` and the source directory is a subdirectory of the installation
- target directory.
-
- * Fix a problem installing eggs with a system packaging tool if the project
- contained an implicit namespace package; for example if the ``setup()``
- listed a namespace package ``foo.bar`` without explicitly listing ``foo``
- as a namespace package.
-
-0.6c3
- * Fixed breakages caused by Subversion 1.4's new "working copy" format
-
-0.6c2
- * The ``ez_setup`` module displays the conflicting version of setuptools (and
- its installation location) when a script requests a version that's not
- available.
-
- * Running ``setup.py develop`` on a setuptools-using project will now install
- setuptools if needed, instead of only downloading the egg.
-
-0.6c1
- * Fixed ``AttributeError`` when trying to download a ``setup_requires``
- dependency when a distribution lacks a ``dependency_links`` setting.
-
- * Made ``zip-safe`` and ``not-zip-safe`` flag files contain a single byte, so
- as to play better with packaging tools that complain about zero-length
- files.
-
- * Made ``setup.py develop`` respect the ``--no-deps`` option, which it
- previously was ignoring.
-
- * Support ``extra_path`` option to ``setup()`` when ``install`` is run in
- backward-compatibility mode.
-
- * Source distributions now always include a ``setup.cfg`` file that explicitly
- sets ``egg_info`` options such that they produce an identical version number
- to the source distribution's version number. (Previously, the default
- version number could be different due to the use of ``--tag-date``, or if
- the version was overridden on the command line that built the source
- distribution.)
-
-0.6b4
- * Fix ``register`` not obeying name/version set by ``egg_info`` command, if
- ``egg_info`` wasn't explicitly run first on the same command line.
-
- * Added ``--no-date`` and ``--no-svn-revision`` options to ``egg_info``
- command, to allow suppressing tags configured in ``setup.cfg``.
-
- * Fixed redundant warnings about missing ``README`` file(s); it should now
- appear only if you are actually a source distribution.
-
-0.6b3
- * Fix ``bdist_egg`` not including files in subdirectories of ``.egg-info``.
-
- * Allow ``.py`` files found by the ``include_package_data`` option to be
- automatically included. Remove duplicate data file matches if both
- ``include_package_data`` and ``package_data`` are used to refer to the same
- files.
-
-0.6b1
- * Strip ``module`` from the end of compiled extension modules when computing
- the name of a ``.py`` loader/wrapper. (Python's import machinery ignores
- this suffix when searching for an extension module.)
-
-0.6a11
- * Added ``test_loader`` keyword to support custom test loaders
-
- * Added ``setuptools.file_finders`` entry point group to allow implementing
- revision control plugins.
-
- * Added ``--identity`` option to ``upload`` command.
-
- * Added ``dependency_links`` to allow specifying URLs for ``--find-links``.
-
- * Enhanced test loader to scan packages as well as modules, and call
- ``additional_tests()`` if present to get non-unittest tests.
-
- * Support namespace packages in conjunction with system packagers, by omitting
- the installation of any ``__init__.py`` files for namespace packages, and
- adding a special ``.pth`` file to create a working package in
- ``sys.modules``.
-
- * Made ``--single-version-externally-managed`` automatic when ``--root`` is
- used, so that most system packagers won't require special support for
- setuptools.
-
- * Fixed ``setup_requires``, ``tests_require``, etc. not using ``setup.cfg`` or
- other configuration files for their option defaults when installing, and
- also made the install use ``--multi-version`` mode so that the project
- directory doesn't need to support .pth files.
-
- * ``MANIFEST.in`` is now forcibly closed when any errors occur while reading
- it. Previously, the file could be left open and the actual error would be
- masked by problems trying to remove the open file on Windows systems.
-
-0.6a10
- * Fixed the ``develop`` command ignoring ``--find-links``.
-
-0.6a9
- * The ``sdist`` command no longer uses the traditional ``MANIFEST`` file to
- create source distributions. ``MANIFEST.in`` is still read and processed,
- as are the standard defaults and pruning. But the manifest is built inside
- the project's ``.egg-info`` directory as ``SOURCES.txt``, and it is rebuilt
- every time the ``egg_info`` command is run.
-
- * Added the ``include_package_data`` keyword to ``setup()``, allowing you to
- automatically include any package data listed in revision control or
- ``MANIFEST.in``
-
- * Added the ``exclude_package_data`` keyword to ``setup()``, allowing you to
- trim back files included via the ``package_data`` and
- ``include_package_data`` options.
-
- * Fixed ``--tag-svn-revision`` not working when run from a source
- distribution.
-
- * Added warning for namespace packages with missing ``declare_namespace()``
-
- * Added ``tests_require`` keyword to ``setup()``, so that e.g. packages
- requiring ``nose`` to run unit tests can make this dependency optional
- unless the ``test`` command is run.
-
- * Made all commands that use ``easy_install`` respect its configuration
- options, as this was causing some problems with ``setup.py install``.
-
- * Added an ``unpack_directory()`` driver to ``setuptools.archive_util``, so
- that you can process a directory tree through a processing filter as if it
- were a zipfile or tarfile.
-
- * Added an internal ``install_egg_info`` command to use as part of old-style
- ``install`` operations, that installs an ``.egg-info`` directory with the
- package.
-
- * Added a ``--single-version-externally-managed`` option to the ``install``
- command so that you can more easily wrap a "flat" egg in a system package.
-
- * Enhanced ``bdist_rpm`` so that it installs single-version eggs that
- don't rely on a ``.pth`` file. The ``--no-egg`` option has been removed,
- since all RPMs are now built in a more backwards-compatible format.
-
- * Support full roundtrip translation of eggs to and from ``bdist_wininst``
- format. Running ``bdist_wininst`` on a setuptools-based package wraps the
- egg in an .exe that will safely install it as an egg (i.e., with metadata
- and entry-point wrapper scripts), and ``easy_install`` can turn the .exe
- back into an ``.egg`` file or directory and install it as such.
-
-
-0.6a8
- * Fixed some problems building extensions when Pyrex was installed, especially
- with Python 2.4 and/or packages using SWIG.
-
- * Made ``develop`` command accept all the same options as ``easy_install``,
- and use the ``easy_install`` command's configuration settings as defaults.
-
- * Made ``egg_info --tag-svn-revision`` fall back to extracting the revision
- number from ``PKG-INFO`` in case it is being run on a source distribution of
- a snapshot taken from a Subversion-based project.
-
- * Automatically detect ``.dll``, ``.so`` and ``.dylib`` files that are being
- installed as data, adding them to ``native_libs.txt`` automatically.
-
- * Fixed some problems with fresh checkouts of projects that don't include
- ``.egg-info/PKG-INFO`` under revision control and put the project's source
- code directly in the project directory. If such a package had any
- requirements that get processed before the ``egg_info`` command can be run,
- the setup scripts would fail with a "Missing 'Version:' header and/or
- PKG-INFO file" error, because the egg runtime interpreted the unbuilt
- metadata in a directory on ``sys.path`` (i.e. the current directory) as
- being a corrupted egg. Setuptools now monkeypatches the distribution
- metadata cache to pretend that the egg has valid version information, until
- it has a chance to make it actually be so (via the ``egg_info`` command).
-
-0.6a5
- * Fixed missing gui/cli .exe files in distribution. Fixed bugs in tests.
-
-0.6a3
- * Added ``gui_scripts`` entry point group to allow installing GUI scripts
- on Windows and other platforms. (The special handling is only for Windows;
- other platforms are treated the same as for ``console_scripts``.)
-
-0.6a2
- * Added ``console_scripts`` entry point group to allow installing scripts
- without the need to create separate script files. On Windows, console
- scripts get an ``.exe`` wrapper so you can just type their name. On other
- platforms, the scripts are written without a file extension.
-
-0.6a1
- * Added support for building "old-style" RPMs that don't install an egg for
- the target package, using a ``--no-egg`` option.
-
- * The ``build_ext`` command now works better when using the ``--inplace``
- option and multiple Python versions. It now makes sure that all extensions
- match the current Python version, even if newer copies were built for a
- different Python version.
-
- * The ``upload`` command no longer attaches an extra ``.zip`` when uploading
- eggs, as PyPI now supports egg uploads without trickery.
-
- * The ``ez_setup`` script/module now displays a warning before downloading
- the setuptools egg, and attempts to check the downloaded egg against an
- internal MD5 checksum table.
-
- * Fixed the ``--tag-svn-revision`` option of ``egg_info`` not finding the
- latest revision number; it was using the revision number of the directory
- containing ``setup.py``, not the highest revision number in the project.
-
- * Added ``eager_resources`` setup argument
-
- * The ``sdist`` command now recognizes Subversion "deleted file" entries and
- does not include them in source distributions.
-
- * ``setuptools`` now embeds itself more thoroughly into the distutils, so that
- other distutils extensions (e.g. py2exe, py2app) will subclass setuptools'
- versions of things, rather than the native distutils ones.
-
- * Added ``entry_points`` and ``setup_requires`` arguments to ``setup()``;
- ``setup_requires`` allows you to automatically find and download packages
- that are needed in order to *build* your project (as opposed to running it).
-
- * ``setuptools`` now finds its commands, ``setup()`` argument validators, and
- metadata writers using entry points, so that they can be extended by
- third-party packages. See `Creating distutils Extensions`_ above for more
- details.
-
- * The vestigial ``depends`` command has been removed. It was never finished
- or documented, and never would have worked without EasyInstall - which it
- pre-dated and was never compatible with.
-
-0.5a12
- * The zip-safety scanner now checks for modules that might be used with
- ``python -m``, and marks them as unsafe for zipping, since Python 2.4 can't
- handle ``-m`` on zipped modules.
-
-0.5a11
- * Fix breakage of the "develop" command that was caused by the addition of
- ``--always-unzip`` to the ``easy_install`` command.
-
-0.5a9
- * Include ``svn:externals`` directories in source distributions as well as
- normal subversion-controlled files and directories.
-
- * Added ``exclude=patternlist`` option to ``setuptools.find_packages()``
-
- * Changed --tag-svn-revision to include an "r" in front of the revision number
- for better readability.
-
- * Added ability to build eggs without including source files (except for any
- scripts, of course), using the ``--exclude-source-files`` option to
- ``bdist_egg``.
-
- * ``setup.py install`` now automatically detects when an "unmanaged" package
- or module is going to be on ``sys.path`` ahead of a package being installed,
- thereby preventing the newer version from being imported. If this occurs,
- a warning message is output to ``sys.stderr``, but installation proceeds
- anyway. The warning message informs the user what files or directories
- need deleting, and advises them they can also use EasyInstall (with the
- ``--delete-conflicting`` option) to do it automatically.
-
- * The ``egg_info`` command now adds a ``top_level.txt`` file to the metadata
- directory that lists all top-level modules and packages in the distribution.
- This is used by the ``easy_install`` command to find possibly-conflicting
- "unmanaged" packages when installing the distribution.
-
- * Added ``zip_safe`` and ``namespace_packages`` arguments to ``setup()``.
- Added package analysis to determine zip-safety if the ``zip_safe`` flag
- is not given, and advise the author regarding what code might need changing.
-
- * Fixed the swapped ``-d`` and ``-b`` options of ``bdist_egg``.
-
-0.5a8
- * The "egg_info" command now always sets the distribution metadata to "safe"
- forms of the distribution name and version, so that distribution files will
- be generated with parseable names (i.e., ones that don't include '-' in the
- name or version). Also, this means that if you use the various ``--tag``
- options of "egg_info", any distributions generated will use the tags in the
- version, not just egg distributions.
-
- * Added support for defining command aliases in distutils configuration files,
- under the "[aliases]" section. To prevent recursion and to allow aliases to
- call the command of the same name, a given alias can be expanded only once
- per command-line invocation. You can define new aliases with the "alias"
- command, either for the local, global, or per-user configuration.
-
- * Added "rotate" command to delete old distribution files, given a set of
- patterns to match and the number of files to keep. (Keeps the most
- recently-modified distribution files matching each pattern.)
-
- * Added "saveopts" command that saves all command-line options for the current
- invocation to the local, global, or per-user configuration file. Useful for
- setting defaults without having to hand-edit a configuration file.
-
- * Added a "setopt" command that sets a single option in a specified distutils
- configuration file.
-
-0.5a7
- * Added "upload" support for egg and source distributions, including a bug
- fix for "upload" and a temporary workaround for lack of .egg support in
- PyPI.
-
-0.5a6
- * Beefed up the "sdist" command so that if you don't have a MANIFEST.in, it
- will include all files under revision control (CVS or Subversion) in the
- current directory, and it will regenerate the list every time you create a
- source distribution, not just when you tell it to. This should make the
- default "do what you mean" more often than the distutils' default behavior
- did, while still retaining the old behavior in the presence of MANIFEST.in.
-
- * Fixed the "develop" command always updating .pth files, even if you
- specified ``-n`` or ``--dry-run``.
-
- * Slightly changed the format of the generated version when you use
- ``--tag-build`` on the "egg_info" command, so that you can make tagged
- revisions compare *lower* than the version specified in setup.py (e.g. by
- using ``--tag-build=dev``).
-
-0.5a5
- * Added ``develop`` command to ``setuptools``-based packages. This command
- installs an ``.egg-link`` pointing to the package's source directory, and
- script wrappers that ``execfile()`` the source versions of the package's
- scripts. This lets you put your development checkout(s) on sys.path without
- having to actually install them. (To uninstall the link, use
- use ``setup.py develop --uninstall``.)
-
- * Added ``egg_info`` command to ``setuptools``-based packages. This command
- just creates or updates the "projectname.egg-info" directory, without
- building an egg. (It's used by the ``bdist_egg``, ``test``, and ``develop``
- commands.)
-
- * Enhanced the ``test`` command so that it doesn't install the package, but
- instead builds any C extensions in-place, updates the ``.egg-info``
- metadata, adds the source directory to ``sys.path``, and runs the tests
- directly on the source. This avoids an "unmanaged" installation of the
- package to ``site-packages`` or elsewhere.
-
- * Made ``easy_install`` a standard ``setuptools`` command, moving it from
- the ``easy_install`` module to ``setuptools.command.easy_install``. Note
- that if you were importing or extending it, you must now change your imports
- accordingly. ``easy_install.py`` is still installed as a script, but not as
- a module.
-
-0.5a4
- * Setup scripts using setuptools can now list their dependencies directly in
- the setup.py file, without having to manually create a ``depends.txt`` file.
- The ``install_requires`` and ``extras_require`` arguments to ``setup()``
- are used to create a dependencies file automatically. If you are manually
- creating ``depends.txt`` right now, please switch to using these setup
- arguments as soon as practical, because ``depends.txt`` support will be
- removed in the 0.6 release cycle. For documentation on the new arguments,
- see the ``setuptools.dist.Distribution`` class.
-
- * Setup scripts using setuptools now always install using ``easy_install``
- internally, for ease of uninstallation and upgrading.
-
-0.5a1
- * Added support for "self-installation" bootstrapping. Packages can now
- include ``ez_setup.py`` in their source distribution, and add the following
- to their ``setup.py``, in order to automatically bootstrap installation of
- setuptools as part of their setup process::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
- from setuptools import setup
- # etc...
-
-0.4a2
- * Added ``ez_setup.py`` installer/bootstrap script to make initial setuptools
- installation easier, and to allow distributions using setuptools to avoid
- having to include setuptools in their source distribution.
-
- * All downloads are now managed by the ``PackageIndex`` class (which is now
- subclassable and replaceable), so that embedders can more easily override
- download logic, give download progress reports, etc. The class has also
- been moved to the new ``setuptools.package_index`` module.
-
- * The ``Installer`` class no longer handles downloading, manages a temporary
- directory, or tracks the ``zip_ok`` option. Downloading is now handled
- by ``PackageIndex``, and ``Installer`` has become an ``easy_install``
- command class based on ``setuptools.Command``.
-
- * There is a new ``setuptools.sandbox.run_setup()`` API to invoke a setup
- script in a directory sandbox, and a new ``setuptools.archive_util`` module
- with an ``unpack_archive()`` API. These were split out of EasyInstall to
- allow reuse by other tools and applications.
-
- * ``setuptools.Command`` now supports reinitializing commands using keyword
- arguments to set/reset options. Also, ``Command`` subclasses can now set
- their ``command_consumes_arguments`` attribute to ``True`` in order to
- receive an ``args`` option containing the rest of the command line.
-
-0.3a2
- * Added new options to ``bdist_egg`` to allow tagging the egg's version number
- with a subversion revision number, the current date, or an explicit tag
- value. Run ``setup.py bdist_egg --help`` to get more information.
-
- * Misc. bug fixes
-
-0.3a1
- * Initial release.
Mailing List and Bug Tracker
============================
@@ -3226,5 +2695,5 @@ confirmed via the list are actual bugs, and which you have reduced to a minimal
set of steps to reproduce.
.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
-.. _setuptools bug tracker: http://bugs.python.org/setuptools/
+.. _setuptools bug tracker: https://bitbucket.org/pypa/setuptools/
diff --git a/ez_setup.py b/ez_setup.py
index 4eb79510..00cf47aa 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -20,6 +20,7 @@ import tempfile
import tarfile
import optparse
import subprocess
+import platform
from distutils import log
@@ -28,13 +29,22 @@ try:
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "0.9.9"
+DEFAULT_VERSION = "1.0"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
+def _check_call_py24(cmd, *args, **kwargs):
+ res = subprocess.call(cmd, *args, **kwargs)
+ class CalledProcessError(Exception):
+ pass
+ if not res == 0:
+ msg = "Command '%s' return non-zero exit status %d" % (cmd, res)
+ raise CalledProcessError(msg)
+vars(subprocess).setdefault('check_call', _check_call_py24)
+
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
@@ -141,6 +151,93 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
return _do_download(version, download_base, to_dir,
download_delay)
+def download_file_powershell(url, target):
+ """
+ Download the file at url to target using Powershell (which will validate
+ trust). Raise an exception if the command cannot complete.
+ """
+ target = os.path.abspath(target)
+ cmd = [
+ 'powershell',
+ '-Command',
+ "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)" % vars(),
+ ]
+ subprocess.check_call(cmd)
+
+download_file_powershell.viable = (
+ lambda: platform.system() == 'Windows' and platform.win32_ver()[1] >= '6'
+)
+
+def download_file_curl(url, target):
+ cmd = ['curl', url, '--silent', '--output', target]
+ subprocess.check_call(cmd)
+
+def has_curl():
+ cmd = ['curl', '--version']
+ devnull = open(os.path.devnull, 'wb')
+ try:
+ subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
+ except:
+ return False
+ finally:
+ devnull.close()
+ return True
+
+download_file_curl.viable = has_curl
+
+def download_file_wget(url, target):
+ cmd = ['wget', url, '--quiet', '--output-document', target]
+ subprocess.check_call(cmd)
+
+def has_wget():
+ cmd = ['wget', '--version']
+ devnull = open(os.path.devnull, 'wb')
+ try:
+ subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
+ except:
+ return False
+ finally:
+ devnull.close()
+ return True
+
+download_file_wget.viable = has_wget
+
+def download_file_insecure(url, target):
+ """
+ Use Python to download the file, even though it cannot authenticate the
+ connection.
+ """
+ try:
+ from urllib.request import urlopen
+ except ImportError:
+ from urllib2 import urlopen
+ src = dst = None
+ try:
+ src = urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = src.read()
+ dst = open(target, "wb")
+ dst.write(data)
+ finally:
+ if src:
+ src.close()
+ if dst:
+ dst.close()
+
+download_file_insecure.viable = lambda: True
+
+def get_best_downloader():
+ downloaders = [
+ download_file_powershell,
+ download_file_curl,
+ download_file_wget,
+ download_file_insecure,
+ ]
+
+ for dl in downloaders:
+ if dl.viable():
+ return dl
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
@@ -154,28 +251,13 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
- try:
- from urllib.request import urlopen
- except ImportError:
- from urllib2 import urlopen
tgz_name = "setuptools-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
- src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- log.warn("Downloading %s", url)
- src = urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = src.read()
- dst = open(saveto, "wb")
- dst.write(data)
- finally:
- if src:
- src.close()
- if dst:
- dst.close()
+ log.warn("Downloading %s", url)
+ downloader = get_best_downloader()
+ downloader(url, saveto)
return os.path.realpath(saveto)
diff --git a/pkg_resources.py b/pkg_resources.py
index 36a0e6ed..02976016 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -13,7 +13,13 @@ The package resource API is designed to work with normal filesystem packages,
method.
"""
-import sys, os, time, re, imp, types, zipfile, zipimport
+import sys
+import os
+import time
+import re
+import imp
+import zipfile
+import zipimport
import warnings
import stat
try:
@@ -122,8 +128,6 @@ def _sset_object(key, ob, state):
_sget_none = _sset_none = lambda *args: None
-
-
def get_supported_platform():
"""Return this platform's maximum compatible version.
@@ -137,7 +141,8 @@ def get_supported_platform():
If this condition occurs for any other platform with a version in its
platform strings, this function should be extended accordingly.
"""
- plat = get_build_platform(); m = macosVersionString.match(plat)
+ plat = get_build_platform()
+ m = macosVersionString.match(plat)
if m is not None and sys.platform == "darwin":
try:
plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
@@ -145,26 +150,6 @@ def get_supported_platform():
pass # not Mac OS X
return plat
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
__all__ = [
# Basic resource access and distribution/entry point discovery
'require', 'run_script', 'get_provider', 'get_distribution',
@@ -206,6 +191,7 @@ __all__ = [
# Deprecated/backward compatibility only
'run_main', 'AvailableDistributions',
]
+
class ResolutionError(Exception):
"""Abstract base for dependency resolution errors"""
def __repr__(self):
@@ -222,7 +208,7 @@ class UnknownExtra(ResolutionError):
_provider_factories = {}
PY_MAJOR = sys.version[:3]
-EGG_DIST = 3
+EGG_DIST = 3
BINARY_DIST = 2
SOURCE_DIST = 1
CHECKOUT_DIST = 0
@@ -299,11 +285,6 @@ darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)")
get_platform = get_build_platform # XXX backward compat
-
-
-
-
-
def compatible_platforms(provided,required):
"""Can code for the `provided` platform run on the `required` platform?
@@ -329,7 +310,7 @@ def compatible_platforms(provided,required):
dversion = int(provDarwin.group(1))
macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2))
if dversion == 7 and macosversion >= "10.3" or \
- dversion == 8 and macosversion >= "10.4":
+ dversion == 8 and macosversion >= "10.4":
#import warnings
#warnings.warn("Mac eggs should be rebuilt to "
@@ -340,11 +321,9 @@ def compatible_platforms(provided,required):
# are they the same major version and machine type?
if provMac.group(1) != reqMac.group(1) or \
- provMac.group(3) != reqMac.group(3):
+ provMac.group(3) != reqMac.group(3):
return False
-
-
# is the required OS major update >= the provided one?
if int(provMac.group(2)) > int(reqMac.group(2)):
return False
@@ -410,14 +389,6 @@ class IMetadataProvider:
"""Execute the named script in the supplied namespace dictionary"""
-
-
-
-
-
-
-
-
class IResourceProvider(IMetadataProvider):
"""An object that provides access to package resources"""
@@ -446,19 +417,6 @@ class IResourceProvider(IMetadataProvider):
"""List of resource names in the directory (like ``os.listdir()``)"""
-
-
-
-
-
-
-
-
-
-
-
-
-
class WorkingSet(object):
"""A collection of active distributions on sys.path (or a similar list)"""
@@ -475,7 +433,6 @@ class WorkingSet(object):
for entry in entries:
self.add_entry(entry)
-
def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
@@ -491,15 +448,10 @@ class WorkingSet(object):
for dist in find_distributions(entry, True):
self.add(dist, entry, False)
-
def __contains__(self,dist):
"""True if `dist` is the active distribution for its project"""
return self.by_key.get(dist.key) == dist
-
-
-
-
def find(self, req):
"""Find a distribution matching requirement `req`
@@ -539,8 +491,6 @@ class WorkingSet(object):
ns['__name__'] = name
self.require(requires)[0].run_script(script_name, ns)
-
-
def __iter__(self):
"""Yield distributions for non-duplicate projects in the working set
@@ -633,9 +583,8 @@ class WorkingSet(object):
return to_activate # return list of distros to activate
- def find_plugins(self,
- plugin_env, full_env=None, installer=None, fallback=True
- ):
+ def find_plugins(self, plugin_env, full_env=None, installer=None,
+ fallback=True):
"""Find all activatable distributions in `plugin_env`
Example usage::
@@ -712,10 +661,6 @@ class WorkingSet(object):
return distributions, error_info
-
-
-
-
def require(self, *requirements):
"""Ensure that distributions matching `requirements` are activated
@@ -793,7 +738,7 @@ class Environment(object):
"""
return (self.python is None or dist.py_version is None
or dist.py_version==self.python) \
- and compatible_platforms(dist.platform,self.platform)
+ and compatible_platforms(dist.platform,self.platform)
def remove(self, dist):
"""Remove `dist` from the environment"""
@@ -839,7 +784,6 @@ class Environment(object):
if dist.key in self._cache:
_sort_dists(self._cache[dist.key])
-
def best_match(self, req, working_set, installer=None):
"""Find distribution best matching `req` and usable on `working_set`
@@ -878,9 +822,6 @@ class Environment(object):
for key in self._distmap.keys():
if self[key]: yield key
-
-
-
def __iadd__(self, other):
"""In-place addition of a distribution or environment"""
if isinstance(other,Distribution):
@@ -920,8 +861,6 @@ class ExtractionError(RuntimeError):
"""
-
-
class ResourceManager:
"""Manage resource extraction and packages"""
extraction_path = None
@@ -983,27 +922,13 @@ The Python egg cache directory is currently set to:
Perhaps your account does not have write access to this directory? You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
-""" % (old_exc, cache_path)
+""" % (old_exc, cache_path)
)
- err.manager = self
- err.cache_path = cache_path
+ err.manager = self
+ err.cache_path = cache_path
err.original_error = old_exc
raise err
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def get_cache_path(self, archive_name, names=()):
"""Return absolute location in cache for `archive_name` and `names`
@@ -1053,23 +978,6 @@ variable to point to an accessible directory.
"PYTHON_EGG_CACHE environment variable)." % path)
warnings.warn(msg, UserWarning)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def postprocess(self, tempname, filename):
"""Perform any platform-specific postprocessing of `tempname`
@@ -1090,27 +998,6 @@ variable to point to an accessible directory.
mode = ((os.stat(tempname).st_mode) | 0x16D) & 0xFFF # 0555, 07777
os.chmod(tempname, mode)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def set_extraction_path(self, path):
"""Set the base path where resources will be extracted to, if needed.
@@ -1150,8 +1037,6 @@ variable to point to an accessible directory.
"""
# XXX
-
-
def get_default_cache():
"""Determine the default cache location
@@ -1227,13 +1112,6 @@ def to_filename(name):
"""
return name.replace('-','_')
-
-
-
-
-
-
-
_marker_names = {
'os': ['name'], 'sys': ['platform'],
'platform': ['version','machine','python_implementation'],
@@ -1267,12 +1145,28 @@ def _pyimp():
else:
return 'CPython'
+def normalize_exception(exc):
+ """
+ Given a SyntaxError from a marker evaluation, normalize the error message:
+ - Remove indications of filename and line number.
+ - Replace platform-specific error messages with standard error messages.
+ """
+ subs = {
+ 'unexpected EOF while parsing': 'invalid syntax',
+ 'parenthesis is never closed': 'invalid syntax',
+ }
+ exc.filename = None
+ exc.lineno = None
+ exc.msg = subs.get(exc.msg, exc.msg)
+ return exc
+
+
def invalid_marker(text):
"""Validate text as a PEP 426 environment marker; return exception or False"""
try:
evaluate_marker(text)
except SyntaxError:
- return sys.exc_info()[1]
+ return normalize_exception(sys.exc_info()[1])
return False
def evaluate_marker(text, extra=None, _ops={}):
@@ -1289,7 +1183,9 @@ def evaluate_marker(text, extra=None, _ops={}):
if not _ops:
from token import NAME, STRING
- import token, symbol, operator
+ import token
+ import symbol
+ import operator
def and_test(nodelist):
# MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
@@ -1355,7 +1251,7 @@ def evaluate_marker(text, extra=None, _ops={}):
if kind==STRING:
s = nodelist[1]
if s[:1] not in "'\"" or s.startswith('"""') or s.startswith("'''") \
- or '\\' in s:
+ or '\\' in s:
raise SyntaxError(
"Only plain strings allowed in environment markers")
return s[1:-1]
@@ -1434,7 +1330,6 @@ class NullProvider:
def metadata_isdir(self,name):
return self.egg_info and self._isdir(self._fn(self.egg_info,name))
-
def resource_listdir(self,resource_name):
return self._listdir(self._fn(self.module_path,resource_name))
@@ -1512,11 +1407,6 @@ class EggProvider(NullProvider):
old = path
path, base = os.path.split(path)
-
-
-
-
-
class DefaultProvider(EggProvider):
"""Provides access to package resources in the filesystem"""
@@ -1549,9 +1439,9 @@ class EmptyProvider(NullProvider):
"""Provider that returns nothing for all requests"""
_isdir = _has = lambda self,path: False
- _get = lambda self,path: ''
- _listdir = lambda self,path: []
- module_path = None
+ _get = lambda self,path: ''
+ _listdir = lambda self,path: []
+ module_path = None
def __init__(self):
pass
@@ -1752,28 +1642,6 @@ class ZipProvider(EggProvider):
register_loader_type(zipimport.zipimporter, ZipProvider)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class FileMetadata(EmptyProvider):
"""Metadata handler for standalone PKG-INFO files
@@ -1804,20 +1672,6 @@ class FileMetadata(EmptyProvider):
return yield_lines(self.get_metadata(name))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class PathMetadata(DefaultProvider):
"""Metadata provider for egg directories
@@ -1898,8 +1752,6 @@ class ImpLoader:
return mod
-
-
def get_importer(path_item):
"""Retrieve a PEP 302 "importer" for the given path item
@@ -1937,10 +1789,6 @@ else:
del ImpLoader, ImpImporter
-
-
-
-
_declare_state('dict', _distribution_finders = {})
def register_finder(importer_type, distribution_finder):
@@ -2164,12 +2012,12 @@ def yield_lines(strs):
LINE_END = re.compile(r"\s*(#.*)?$").match # whitespace and comment
CONTINUE = re.compile(r"\s*\\\s*(#.*)?$").match # line continuation
-DISTRO = re.compile(r"\s*((\w|[-.])+)").match # Distribution or extra
-VERSION = re.compile(r"\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)").match # ver. info
-COMMA = re.compile(r"\s*,").match # comma between items
+DISTRO = re.compile(r"\s*((\w|[-.])+)").match # Distribution or extra
+VERSION = re.compile(r"\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)").match # ver. info
+COMMA = re.compile(r"\s*,").match # comma between items
OBRACKET = re.compile(r"\s*\[").match
CBRACKET = re.compile(r"\s*\]").match
-MODULE = re.compile(r"\w+(\.\w+)*$").match
+MODULE = re.compile(r"\w+(\.\w+)*$").match
EGG_NAME = re.compile(
r"(?P<name>[^-]+)"
r"( -(?P<ver>[^-]+) (-py(?P<pyver>[^-]+) (-(?P<plat>.+))? )? )?",
@@ -2271,8 +2119,6 @@ class EntryPoint(object):
list(map(working_set.add,
working_set.resolve(self.dist.requires(self.extras),env,installer)))
-
-
#@classmethod
def parse(cls, src, dist=None):
"""Parse a single entry point from string `src`
@@ -2307,13 +2153,6 @@ class EntryPoint(object):
parse = classmethod(parse)
-
-
-
-
-
-
-
#@classmethod
def parse_group(cls, group, lines, dist=None):
"""Parse an entry point group"""
@@ -2364,10 +2203,9 @@ class Distribution(object):
"""Wrap an actual or potential sys.path entry w/metadata"""
PKG_INFO = 'PKG-INFO'
- def __init__(self,
- location=None, metadata=None, project_name=None, version=None,
- py_version=PY_MAJOR, platform=None, precedence = EGG_DIST
- ):
+ def __init__(self, location=None, metadata=None, project_name=None,
+ version=None, py_version=PY_MAJOR, platform=None,
+ precedence=EGG_DIST):
self.project_name = safe_name(project_name or 'Unknown')
if version is not None:
self._version = safe_version(version)
@@ -2395,7 +2233,6 @@ class Distribution(object):
)
from_location = classmethod(from_location)
-
hashcmp = property(
lambda self: (
getattr(self,'parsed_version',()),
@@ -2461,9 +2298,6 @@ class Distribution(object):
)
version = property(version)
-
-
-
#@property
def _dep_map(self):
try:
@@ -2503,8 +2337,6 @@ class Distribution(object):
for line in self.get_metadata_lines(name):
yield line
-
-
def activate(self,path=None):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None: path = sys.path
@@ -2513,7 +2345,6 @@ class Distribution(object):
fixup_namespace_packages(self.location)
list(map(declare_namespace, self._get_metadata('namespace_packages.txt')))
-
def egg_name(self):
"""Return what this distribution's standard .egg filename should be"""
filename = "%s-%s-py%s" % (
@@ -2543,9 +2374,6 @@ class Distribution(object):
raise AttributeError(attr)
return getattr(self._provider, attr)
-
-
-
#@classmethod
def from_filename(cls,filename,metadata=None, **kw):
return cls.from_location(
@@ -2581,12 +2409,6 @@ class Distribution(object):
"""Return the EntryPoint object for `group`+`name`, or ``None``"""
return self.get_entry_map(group).get(name)
-
-
-
-
-
-
def insert_on(self, path, loc = None):
"""Insert self.location in path before its nearest parent directory"""
@@ -2627,7 +2449,6 @@ class Distribution(object):
return
-
def check_version_conflict(self):
if self.key=='setuptools':
return # ignore the inevitable setuptools self-conflicts :(
@@ -2636,8 +2457,7 @@ class Distribution(object):
loc = normalize_path(self.location)
for modname in self._get_metadata('top_level.txt'):
if (modname not in sys.modules or modname in nsp
- or modname in _namespace_packages
- ):
+ or modname in _namespace_packages):
continue
if modname in ('pkg_resources', 'setuptools', 'site'):
continue
@@ -2668,9 +2488,6 @@ class Distribution(object):
kw.setdefault('metadata', self._provider)
return self.__class__(**kw)
-
-
-
#@property
def extras(self):
return [dep for dep in self._dep_map if dep]
@@ -2740,9 +2557,11 @@ class DistInfoDistribution(Distribution):
return dm
-_distributionImpl = {'.egg': Distribution,
- '.egg-info': Distribution,
- '.dist-info': DistInfoDistribution }
+_distributionImpl = {
+ '.egg': Distribution,
+ '.egg-info': Distribution,
+ '.dist-info': DistInfoDistribution,
+ }
def issue_warning(*args,**kw):
@@ -2759,27 +2578,6 @@ def issue_warning(*args,**kw):
warn(stacklevel = level+1, *args, **kw)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs`
@@ -2796,7 +2594,8 @@ def parse_requirements(strs):
while not TERMINATOR(line,p):
if CONTINUE(line,p):
try:
- line = next(lines); p = 0
+ line = next(lines)
+ p = 0
except StopIteration:
raise ValueError(
"\\ must not appear on the last nonblank line"
@@ -2847,21 +2646,6 @@ def _sort_dists(dists):
dists[::-1] = [d for hc,d in tmp]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class Requirement:
def __init__(self, project_name, specs, extras):
"""DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
@@ -2896,14 +2680,16 @@ class Requirement:
compare = lambda a, b: (a > b) - (a < b) # -1, 0, 1
for parsed,trans,op,ver in self.index:
action = trans[compare(item,parsed)] # Indexing: 0, 1, -1
- if action=='F': return False
- elif action=='T': return True
- elif action=='+': last = True
+ if action=='F':
+ return False
+ elif action=='T':
+ return True
+ elif action=='+':
+ last = True
elif action=='-' or last is None: last = False
if last is None: last = True # no rules encountered
return last
-
def __hash__(self):
return self.__hash
@@ -2922,12 +2708,12 @@ class Requirement:
state_machine = {
# =><
- '<' : '--T',
- '<=': 'T-T',
- '>' : 'F+F',
- '>=': 'T+F',
- '==': 'T..',
- '!=': 'F++',
+ '<': '--T',
+ '<=': 'T-T',
+ '>': 'F+F',
+ '>=': 'T+F',
+ '==': 'T..',
+ '!=': 'F++',
}
@@ -3025,5 +2811,5 @@ run_main = run_script # backward compatibility
# all distributions added to the working set in the future (e.g. by
# calling ``require()``) will get activated as well.
add_activation_listener(lambda dist: dist.activate())
-working_set.entries=[]; list(map(working_set.add_entry,sys.path)) # match order
-
+working_set.entries=[]
+list(map(working_set.add_entry,sys.path)) # match order
diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt
index 4b9fe8a6..ba887a08 100644
--- a/setuptools.egg-info/entry_points.txt
+++ b/setuptools.egg-info/entry_points.txt
@@ -1,62 +1,62 @@
-[setuptools.file_finders]
-svn_cvs = setuptools.command.sdist:_default_revctrl
-
-[egg_info.writers]
-depends.txt = setuptools.command.egg_info:warn_depends_obsolete
-top_level.txt = setuptools.command.egg_info:write_toplevel_names
-namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
-eager_resources.txt = setuptools.command.egg_info:overwrite_arg
-dependency_links.txt = setuptools.command.egg_info:overwrite_arg
-requires.txt = setuptools.command.egg_info:write_requirements
-PKG-INFO = setuptools.command.egg_info:write_pkg_info
-entry_points.txt = setuptools.command.egg_info:write_entries
-
-[setuptools.installation]
-eggsecutable = setuptools.command.easy_install:bootstrap
-
-[console_scripts]
-easy_install = setuptools.command.easy_install:main
-easy_install-3.3 = setuptools.command.easy_install:main
-
-[distutils.setup_keywords]
-dependency_links = setuptools.dist:assert_string_list
-packages = setuptools.dist:check_packages
-exclude_package_data = setuptools.dist:check_package_data
-use_2to3_exclude_fixers = setuptools.dist:assert_string_list
-package_data = setuptools.dist:check_package_data
-use_2to3 = setuptools.dist:assert_bool
-tests_require = setuptools.dist:check_requirements
-entry_points = setuptools.dist:check_entry_points
-extras_require = setuptools.dist:check_extras
-include_package_data = setuptools.dist:assert_bool
-eager_resources = setuptools.dist:assert_string_list
-zip_safe = setuptools.dist:assert_bool
-install_requires = setuptools.dist:check_requirements
-use_2to3_fixers = setuptools.dist:assert_string_list
-test_suite = setuptools.dist:check_test_suite
-test_loader = setuptools.dist:check_importable
-namespace_packages = setuptools.dist:check_nsp
-convert_2to3_doctests = setuptools.dist:assert_string_list
-
-[distutils.commands]
-bdist_egg = setuptools.command.bdist_egg:bdist_egg
-egg_info = setuptools.command.egg_info:egg_info
-alias = setuptools.command.alias:alias
-sdist = setuptools.command.sdist:sdist
-bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
-test = setuptools.command.test:test
-easy_install = setuptools.command.easy_install:easy_install
-register = setuptools.command.register:register
-setopt = setuptools.command.setopt:setopt
-install = setuptools.command.install:install
-install_scripts = setuptools.command.install_scripts:install_scripts
-bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
-build_ext = setuptools.command.build_ext:build_ext
-rotate = setuptools.command.rotate:rotate
-develop = setuptools.command.develop:develop
-install_lib = setuptools.command.install_lib:install_lib
-upload_docs = setuptools.command.upload_docs:upload_docs
-install_egg_info = setuptools.command.install_egg_info:install_egg_info
-build_py = setuptools.command.build_py:build_py
-saveopts = setuptools.command.saveopts:saveopts
-
+[setuptools.file_finders]
+svn_cvs = setuptools.command.sdist:_default_revctrl
+
+[egg_info.writers]
+depends.txt = setuptools.command.egg_info:warn_depends_obsolete
+top_level.txt = setuptools.command.egg_info:write_toplevel_names
+namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
+eager_resources.txt = setuptools.command.egg_info:overwrite_arg
+dependency_links.txt = setuptools.command.egg_info:overwrite_arg
+requires.txt = setuptools.command.egg_info:write_requirements
+PKG-INFO = setuptools.command.egg_info:write_pkg_info
+entry_points.txt = setuptools.command.egg_info:write_entries
+
+[setuptools.installation]
+eggsecutable = setuptools.command.easy_install:bootstrap
+
+[console_scripts]
+easy_install = setuptools.command.easy_install:main
+easy_install-3.3 = setuptools.command.easy_install:main
+
+[distutils.setup_keywords]
+dependency_links = setuptools.dist:assert_string_list
+packages = setuptools.dist:check_packages
+exclude_package_data = setuptools.dist:check_package_data
+use_2to3_exclude_fixers = setuptools.dist:assert_string_list
+package_data = setuptools.dist:check_package_data
+use_2to3 = setuptools.dist:assert_bool
+tests_require = setuptools.dist:check_requirements
+entry_points = setuptools.dist:check_entry_points
+extras_require = setuptools.dist:check_extras
+include_package_data = setuptools.dist:assert_bool
+eager_resources = setuptools.dist:assert_string_list
+zip_safe = setuptools.dist:assert_bool
+install_requires = setuptools.dist:check_requirements
+use_2to3_fixers = setuptools.dist:assert_string_list
+test_suite = setuptools.dist:check_test_suite
+test_loader = setuptools.dist:check_importable
+namespace_packages = setuptools.dist:check_nsp
+convert_2to3_doctests = setuptools.dist:assert_string_list
+
+[distutils.commands]
+bdist_egg = setuptools.command.bdist_egg:bdist_egg
+egg_info = setuptools.command.egg_info:egg_info
+alias = setuptools.command.alias:alias
+sdist = setuptools.command.sdist:sdist
+bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
+test = setuptools.command.test:test
+easy_install = setuptools.command.easy_install:easy_install
+register = setuptools.command.register:register
+setopt = setuptools.command.setopt:setopt
+install = setuptools.command.install:install
+install_scripts = setuptools.command.install_scripts:install_scripts
+bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst
+build_ext = setuptools.command.build_ext:build_ext
+rotate = setuptools.command.rotate:rotate
+develop = setuptools.command.develop:develop
+install_lib = setuptools.command.install_lib:install_lib
+upload_docs = setuptools.command.upload_docs:upload_docs
+install_egg_info = setuptools.command.install_egg_info:install_egg_info
+build_py = setuptools.command.build_py:build_py
+saveopts = setuptools.command.saveopts:saveopts
+
diff --git a/setuptools.egg-info/requires.txt b/setuptools.egg-info/requires.txt
index 668f4ee2..5de4d6e7 100644
--- a/setuptools.egg-info/requires.txt
+++ b/setuptools.egg-info/requires.txt
@@ -3,11 +3,11 @@
[certs]
certifi==0.0.8
-[ssl:python_version in '2.4, 2.5']
-ssl==1.16
+[ssl:sys_platform=='win32']
+wincertstore==0.1
[ssl:sys_platform=='win32' and python_version=='2.4']
ctypes==1.0.2
-[ssl:sys_platform=='win32']
-wincertstore==0.1 \ No newline at end of file
+[ssl:python_version in '2.4, 2.5']
+ssl==1.16 \ No newline at end of file
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 8b88cd1d..cf4402a5 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -22,6 +22,8 @@ import re
import stat
import random
import platform
+import textwrap
+import warnings
from glob import glob
from distutils import log, dir_util
@@ -1780,57 +1782,130 @@ def fix_jython_executable(executable, options):
return executable
-def get_script_args(dist, executable=sys_executable, wininst=False):
- """Yield write_script() argument tuples for a distribution's entrypoints"""
- spec = str(dist.as_requirement())
- header = get_script_header("", executable, wininst)
- for group in 'console_scripts', 'gui_scripts':
- for name, ep in dist.get_entry_map(group).items():
- script_text = (
- "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n"
- "__requires__ = %(spec)r\n"
- "import sys\n"
- "from pkg_resources import load_entry_point\n"
- "\n"
- "if __name__ == '__main__':"
- "\n"
- " 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':
- launcher_type = 'gui'
- ext = '-script.pyw'
- old = ['.pyw']
- new_header = re.sub('(?i)python.exe','pythonw.exe',header)
- else:
- launcher_type = 'cli'
- ext = '-script.py'
- old = ['.py','.pyc','.pyo']
- new_header = re.sub('(?i)pythonw.exe','python.exe',header)
- if os.path.exists(new_header[2:-1].strip('"')) 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', get_win_launcher(launcher_type),
- '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)
+class ScriptWriter(object):
+ """
+ Encapsulates behavior around writing entry point scripts for console and
+ gui apps.
+ """
+
+ template = textwrap.dedent("""
+ # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
+ __requires__ = %(spec)r
+ import sys
+ from pkg_resources import load_entry_point
+
+ if __name__ == '__main__':
+ sys.exit(
+ load_entry_point(%(spec)r, %(group)r, %(name)r)()
+ )
+ """).lstrip()
+
+ @classmethod
+ def get_script_args(cls, dist, executable=sys_executable, wininst=False):
+ """
+ Yield write_script() argument tuples for a distribution's entrypoints
+ """
+ gen_class = cls.get_writer(wininst)
+ spec = str(dist.as_requirement())
+ header = get_script_header("", executable, wininst)
+ for type_ in 'console', 'gui':
+ group = type_ + '_scripts'
+ for name, ep in dist.get_entry_map(group).items():
+ script_text = gen_class.template % locals()
+ for res in gen_class._get_script_args(type_, name, header,
+ script_text):
+ yield res
+
+ @classmethod
+ def get_writer(cls, force_windows):
+ if force_windows or sys.platform=='win32':
+ return WindowsScriptWriter.get_writer()
+ return cls
+
+ @classmethod
+ def _get_script_args(cls, type_, name, header, script_text):
+ # Simply write the stub with no extension.
+ yield (name, header+script_text)
+
+
+class WindowsScriptWriter(ScriptWriter):
+ @classmethod
+ def get_writer(cls):
+ """
+ Get a script writer suitable for Windows
+ """
+ # for compatibility, return the writer that creates exe launchers
+ # unless the SETUPTOOLS_USE_PYLAUNCHER is set, indicating
+ # future behavior.
+ use_legacy = 'SETUPTOOLS_USE_PYLAUNCHER' not in os.environ
+ if use_legacy:
+ return WindowsLauncherScriptWriter
+ return cls
+
+ @classmethod
+ def _get_script_args(cls, type_, name, header, script_text):
+ "For Windows, add a .py extension"
+ ext = dict(console='.pya', gui='.pyw')[type_]
+ if ext not in os.environ['PATHEXT'].lower().split(';'):
+ warnings.warn("%s not listed in PATHEXT; scripts will not be "
+ "recognized as executables." % ext, UserWarning)
+ old = ['.pya', '.py', '-script.py', '.pyc', '.pyo', '.pyw', '.exe']
+ old.remove(ext)
+ header = cls._adjust_header(type_, header)
+ blockers = [name+x for x in old]
+ yield name+ext, header+script_text, 't', blockers
+
+ @staticmethod
+ def _adjust_header(type_, orig_header):
+ """
+ Make sure 'pythonw' is used for gui and and 'python' is used for
+ console (regardless of what sys.executable is).
+ """
+ pattern = 'pythonw.exe'
+ repl = 'python.exe'
+ if type_ == 'gui':
+ pattern, repl = repl, pattern
+ pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
+ new_header = pattern_ob.sub(string=orig_header, repl=repl)
+ clean_header = new_header[2:-1].strip('"')
+ if sys.platform == 'win32' and not os.path.exists(clean_header):
+ # the adjusted version doesn't exist, so return the original
+ return orig_header
+ return new_header
+
+
+class WindowsLauncherScriptWriter(WindowsScriptWriter):
+ @classmethod
+ def _get_script_args(cls, type_, name, header, script_text):
+ """
+ For Windows, add a .py extension and an .exe launcher
+ """
+ if type_=='gui':
+ launcher_type = 'gui'
+ ext = '-script.pyw'
+ old = ['.pyw']
+ else:
+ launcher_type = 'cli'
+ ext = '-script.py'
+ old = ['.py','.pyc','.pyo']
+ hdr = cls._adjust_header(type_, header)
+ blockers = [name+x for x in old]
+ yield (name+ext, hdr+script_text, 't', blockers)
+ yield (
+ name+'.exe', get_win_launcher(launcher_type),
+ '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')
+
+# for backward-compatibility
+get_script_args = ScriptWriter.get_script_args
def get_win_launcher(type):
"""
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 01889215..9dbf04ba 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -2,6 +2,7 @@ __all__ = ['Distribution']
import re
import sys
+import warnings
from distutils.core import Distribution as _Distribution
from setuptools.depends import Require
from setuptools.command.install import install
@@ -132,7 +133,7 @@ def check_packages(dist, attr, value):
"WARNING: %r not a valid package name; please use only"
".-separated package names in setup.py", pkgname
)
-
+
@@ -194,7 +195,8 @@ class Distribution(_Distribution):
EasyInstall and requests one of your extras, the corresponding
additional requirements will be installed if needed.
- 'features' -- a dictionary mapping option names to 'setuptools.Feature'
+ 'features' **deprecated** -- a dictionary mapping option names to
+ 'setuptools.Feature'
objects. Features are a portion of the distribution that can be
included or excluded based on user options, inter-feature dependencies,
and availability on the current system. Excluded features are omitted
@@ -252,6 +254,9 @@ class Distribution(_Distribution):
have_package_data = hasattr(self, "package_data")
if not have_package_data:
self.package_data = {}
+ _attrs_dict = attrs or {}
+ if 'features' in _attrs_dict or 'require_features' in _attrs_dict:
+ Feature.warn_deprecated()
self.require_features = []
self.features = {}
self.dist_files = []
@@ -745,7 +750,13 @@ for module in distutils.dist, distutils.core, distutils.cmd:
class Feature:
- """A subset of the distribution that can be excluded if unneeded/wanted
+ """
+ **deprecated** -- The `Feature` facility was never completely implemented
+ or supported, `has reported issues
+ <https://bitbucket.org/pypa/setuptools/issue/58>`_ and will be removed in
+ a future version.
+
+ A subset of the distribution that can be excluded if unneeded/wanted
Features are created using these keyword arguments:
@@ -794,9 +805,17 @@ class Feature:
Aside from the methods, the only feature attributes that distributions look
at are 'description' and 'optional'.
"""
+
+ @staticmethod
+ def warn_deprecated():
+ warnings.warn("Features are deprecated and will be removed in "
+ "a future version. See http://bitbucket.org/pypa/setuptools/65.",
+ DeprecationWarning)
+
def __init__(self, description, standard=False, available=True,
optional=True, require_features=(), remove=(), **extras
):
+ self.warn_deprecated()
self.description = description
self.standard = standard
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py
index f8a780a9..90359b2c 100644
--- a/setuptools/ssl_support.py
+++ b/setuptools/ssl_support.py
@@ -194,6 +194,12 @@ class VerifyingHTTPSConn(HTTPSConnection):
sock = create_connection(
(self.host, self.port), getattr(self,'source_address',None)
)
+
+ # Handle the socket if a (proxy) tunnel is present
+ if hasattr(self, '_tunnel') and getattr(self, '_tunnel_host', None):
+ self.sock = sock
+ self._tunnel()
+
self.sock = ssl.wrap_socket(
sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=self.ca_bundle
)
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 2732bb3e..189e3d55 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -14,7 +14,7 @@ import distutils.core
from setuptools.compat import StringIO, BytesIO, next, urlparse
from setuptools.sandbox import run_setup, SandboxViolation
-from setuptools.command.easy_install import easy_install, fix_jython_executable, get_script_args
+from setuptools.command.easy_install import easy_install, fix_jython_executable, get_script_args, nt_quote_arg
from setuptools.command.easy_install import PthDistributions
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
@@ -52,7 +52,7 @@ if __name__ == '__main__':
sys.exit(
load_entry_point('spec', 'console_scripts', 'name')()
)
-""" % fix_jython_executable(sys.executable, "")
+""" % nt_quote_arg(fix_jython_executable(sys.executable, ""))
SETUP_PY = """\
from setuptools import setup
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index df5261d1..c9fcf76c 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -1,11 +1,24 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-# NOTE: the shebang and encoding lines are for ScriptHeaderTests; do not remove
-from unittest import TestCase, makeSuite; from pkg_resources import *
-from setuptools.command.easy_install import get_script_header, is_sh
+# NOTE: the shebang and encoding lines are for ScriptHeaderTests do not remove
+
+import os
+import sys
+import tempfile
+import shutil
+from unittest import TestCase
+
+import pkg_resources
+from pkg_resources import (parse_requirements, VersionConflict, parse_version,
+ Distribution, EntryPoint, Requirement, safe_version, safe_name,
+ WorkingSet)
+
+from setuptools.command.easy_install import (get_script_header, is_sh,
+ nt_quote_arg)
from setuptools.compat import StringIO, iteritems
-import os, pkg_resources, sys, tempfile, shutil
-try: frozenset
+
+try:
+ frozenset
except NameError:
from sets import ImmutableSet as frozenset
@@ -15,11 +28,11 @@ def safe_repr(obj, short=False):
result = repr(obj)
except Exception:
result = object.__repr__(obj)
- if not short or len(result) < _MAX_LENGTH:
+ if not short or len(result) < pkg_resources._MAX_LENGTH:
return result
- return result[:_MAX_LENGTH] + ' [truncated]...'
+ return result[:pkg_resources._MAX_LENGTH] + ' [truncated]...'
-class Metadata(EmptyProvider):
+class Metadata(pkg_resources.EmptyProvider):
"""Mock object to return metadata as if from an on-disk distribution"""
def __init__(self,*pairs):
@@ -32,18 +45,20 @@ class Metadata(EmptyProvider):
return self.metadata[name]
def get_metadata_lines(self,name):
- return yield_lines(self.get_metadata(name))
+ return pkg_resources.yield_lines(self.get_metadata(name))
+
+dist_from_fn = pkg_resources.Distribution.from_filename
class DistroTests(TestCase):
def testCollection(self):
# empty path should produce no distributions
- ad = Environment([], platform=None, python=None)
+ ad = pkg_resources.Environment([], platform=None, python=None)
self.assertEqual(list(ad), [])
self.assertEqual(ad['FooPkg'],[])
- ad.add(Distribution.from_filename("FooPkg-1.3_1.egg"))
- ad.add(Distribution.from_filename("FooPkg-1.4-py2.4-win32.egg"))
- ad.add(Distribution.from_filename("FooPkg-1.2-py2.4.egg"))
+ ad.add(dist_from_fn("FooPkg-1.3_1.egg"))
+ ad.add(dist_from_fn("FooPkg-1.4-py2.4-win32.egg"))
+ ad.add(dist_from_fn("FooPkg-1.2-py2.4.egg"))
# Name is in there now
self.assertTrue(ad['FooPkg'])
@@ -60,27 +75,33 @@ class DistroTests(TestCase):
[dist.version for dist in ad['FooPkg']], ['1.4','1.2']
)
# And inserting adds them in order
- ad.add(Distribution.from_filename("FooPkg-1.9.egg"))
+ ad.add(dist_from_fn("FooPkg-1.9.egg"))
self.assertEqual(
[dist.version for dist in ad['FooPkg']], ['1.9','1.4','1.2']
)
ws = WorkingSet([])
- foo12 = Distribution.from_filename("FooPkg-1.2-py2.4.egg")
- foo14 = Distribution.from_filename("FooPkg-1.4-py2.4-win32.egg")
+ foo12 = dist_from_fn("FooPkg-1.2-py2.4.egg")
+ foo14 = dist_from_fn("FooPkg-1.4-py2.4-win32.egg")
req, = parse_requirements("FooPkg>=1.3")
# Nominal case: no distros on path, should yield all applicable
self.assertEqual(ad.best_match(req,ws).version, '1.9')
# If a matching distro is already installed, should return only that
- ws.add(foo14); self.assertEqual(ad.best_match(req,ws).version, '1.4')
+ ws.add(foo14)
+ self.assertEqual(ad.best_match(req,ws).version, '1.4')
# If the first matching distro is unsuitable, it's a version conflict
- ws = WorkingSet([]); ws.add(foo12); ws.add(foo14)
+ ws = WorkingSet([])
+ ws.add(foo12)
+ ws.add(foo14)
self.assertRaises(VersionConflict, ad.best_match, req, ws)
# If more than one match on the path, the first one takes precedence
- ws = WorkingSet([]); ws.add(foo14); ws.add(foo12); ws.add(foo14);
+ ws = WorkingSet([])
+ ws.add(foo14)
+ ws.add(foo12)
+ ws.add(foo14)
self.assertEqual(ad.best_match(req,ws).version, '1.4')
def checkFooPkg(self,d):
@@ -103,9 +124,9 @@ class DistroTests(TestCase):
self.assertEqual(d.platform, None)
def testDistroParse(self):
- d = Distribution.from_filename("FooPkg-1.3_1-py2.4-win32.egg")
+ d = dist_from_fn("FooPkg-1.3_1-py2.4-win32.egg")
self.checkFooPkg(d)
- d = Distribution.from_filename("FooPkg-1.3_1-py2.4-win32.egg-info")
+ d = dist_from_fn("FooPkg-1.3_1-py2.4-win32.egg-info")
self.checkFooPkg(d)
def testDistroMetadata(self):
@@ -117,7 +138,6 @@ class DistroTests(TestCase):
)
self.checkFooPkg(d)
-
def distRequires(self, txt):
return Distribution("/foo", metadata=Metadata(('depends.txt', txt)))
@@ -131,20 +151,21 @@ class DistroTests(TestCase):
for v in "Twisted>=1.5", "Twisted>=1.5\nZConfig>=2.0":
self.checkRequires(self.distRequires(v), v)
-
def testResolve(self):
- ad = Environment([]); ws = WorkingSet([])
+ ad = pkg_resources.Environment([])
+ ws = WorkingSet([])
# Resolving no requirements -> nothing to install
- self.assertEqual( list(ws.resolve([],ad)), [] )
+ self.assertEqual(list(ws.resolve([],ad)), [])
# Request something not in the collection -> DistributionNotFound
self.assertRaises(
- DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad
+ pkg_resources.DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad
)
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.egg",
metadata=Metadata(('depends.txt', "[bar]\nBaz>=2.0"))
)
- ad.add(Foo); ad.add(Distribution.from_filename("Foo-0.9.egg"))
+ ad.add(Foo)
+ ad.add(Distribution.from_filename("Foo-0.9.egg"))
# Request thing(s) that are available -> list to activate
for i in range(3):
@@ -157,7 +178,7 @@ class DistroTests(TestCase):
# Request an extra that causes an unresolved dependency for "Baz"
self.assertRaises(
- DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad
+ pkg_resources.DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad
)
Baz = Distribution.from_filename(
"/foo_dir/Baz-2.1.egg", metadata=Metadata(('depends.txt', "Foo"))
@@ -169,9 +190,8 @@ class DistroTests(TestCase):
list(ws.resolve(parse_requirements("Foo[bar]"), ad)), [Foo,Baz]
)
# Requests for conflicting versions produce VersionConflict
- self.assertRaises( VersionConflict,
- ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad
- )
+ self.assertRaises(VersionConflict,
+ ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad)
def testDistroDependsOptions(self):
d = self.distRequires("""
@@ -196,7 +216,7 @@ class DistroTests(TestCase):
d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
["fastcgi", "docgen"]
)
- self.assertRaises(UnknownExtra, d.requires, ["foo"])
+ self.assertRaises(pkg_resources.UnknownExtra, d.requires, ["foo"])
class EntryPointTests(TestCase):
@@ -304,8 +324,8 @@ class RequirementsTests(TestCase):
def testBasicContains(self):
r = Requirement("Twisted", [('>=','1.2')], ())
foo_dist = Distribution.from_filename("FooPkg-1.3_1.egg")
- twist11 = Distribution.from_filename("Twisted-1.1.egg")
- twist12 = Distribution.from_filename("Twisted-1.2.egg")
+ twist11 = Distribution.from_filename("Twisted-1.1.egg")
+ twist12 = Distribution.from_filename("Twisted-1.2.egg")
self.assertTrue(parse_version('1.2') in r)
self.assertTrue(parse_version('1.1') not in r)
self.assertTrue('1.2' in r)
@@ -321,7 +341,6 @@ class RequirementsTests(TestCase):
for v in ('1.2c1','1.3.1','1.5','1.9.1','2.0','2.5','3.0','4.0'):
self.assertTrue(v not in r, (v,r))
-
def testOptionsAndHashing(self):
r1 = Requirement.parse("Twisted[foo,bar]>=1.2")
r2 = Requirement.parse("Twisted[bar,FOO]>=1.2")
@@ -366,15 +385,6 @@ class RequirementsTests(TestCase):
Requirement.parse('setuptools >= 0.7').project_name, 'setuptools')
-
-
-
-
-
-
-
-
-
class ParseTests(TestCase):
def testEmptyParse(self):
@@ -388,9 +398,7 @@ class ParseTests(TestCase):
self.assertEqual(list(pkg_resources.yield_lines(inp)),out)
def testSplitting(self):
- self.assertEqual(
- list(
- pkg_resources.split_sections("""
+ sample = """
x
[Y]
z
@@ -403,8 +411,7 @@ class ParseTests(TestCase):
[q]
v
"""
- )
- ),
+ self.assertEqual(list(pkg_resources.split_sections(sample)),
[(None,["x"]), ("Y",["z","a"]), ("b",["c"]), ("d",[]), ("q",["v"])]
)
self.assertRaises(ValueError,list,pkg_resources.split_sections("[foo"))
@@ -455,7 +462,8 @@ class ParseTests(TestCase):
c('0pre1', '0.0c1')
c('0.0.0preview1', '0c1')
c('0.0c1', '0-rc1')
- c('1.2a1', '1.2.a.1'); c('1.2...a', '1.2a')
+ c('1.2a1', '1.2.a.1')
+ c('1.2...a', '1.2a')
def testVersionOrdering(self):
def c(s1,s2):
@@ -492,30 +500,30 @@ class ParseTests(TestCase):
c(v2,v1)
-
-
-
-
-
-
class ScriptHeaderTests(TestCase):
non_ascii_exe = '/Users/José/bin/python'
+ exe_with_spaces = r'C:\Program Files\Python33\python.exe'
def test_get_script_header(self):
if not sys.platform.startswith('java') or not is_sh(sys.executable):
# This test is for non-Jython platforms
+ expected = '#!%s\n' % nt_quote_arg(os.path.normpath(sys.executable))
self.assertEqual(get_script_header('#!/usr/local/bin/python'),
- '#!%s\n' % os.path.normpath(sys.executable))
+ expected)
+ expected = '#!%s -x\n' % nt_quote_arg(os.path.normpath(sys.executable))
self.assertEqual(get_script_header('#!/usr/bin/python -x'),
- '#!%s -x\n' % os.path.normpath(sys.executable))
+ expected)
self.assertEqual(get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe),
'#!%s -x\n' % self.non_ascii_exe)
+ candidate = get_script_header('#!/usr/bin/python',
+ executable=self.exe_with_spaces)
+ self.assertEqual(candidate, '#!"%s"\n' % self.exe_with_spaces)
def test_get_script_header_jython_workaround(self):
# This test doesn't work with Python 3 in some locales
if (sys.version_info >= (3,) and os.environ.get("LC_CTYPE")
- in (None, "C", "POSIX")):
+ in (None, "C", "POSIX")):
return
class java:
@@ -554,8 +562,6 @@ class ScriptHeaderTests(TestCase):
sys.stdout, sys.stderr = stdout, stderr
-
-
class NamespaceTests(TestCase):
def setUp(self):
@@ -610,6 +616,5 @@ class NamespaceTests(TestCase):
self.assertEqual(pkg_resources._namespace_packages["pkg1"], ["pkg1.pkg2"])
# check the __path__ attribute contains both paths
self.assertEqual(pkg1.pkg2.__path__, [
- os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"),
- os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2") ])
-
+ os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"),
+ os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2")])
diff --git a/setuptools/version.py b/setuptools/version.py
index 1b1a934d..7e49527e 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '0.9.9'
+__version__ = '1.0'
diff --git a/tests/api_tests.txt b/tests/api_tests.txt
index 86ca245d..d34f2314 100644
--- a/tests/api_tests.txt
+++ b/tests/api_tests.txt
@@ -341,8 +341,8 @@ Environment Markers
>>> print(im("sys_platform"))
Comparison or logical expression expected
- >>> print(im("sys_platform==")) # doctest: +ELLIPSIS
- unexpected EOF while parsing (...line 1)
+ >>> print(im("sys_platform=="))
+ invalid syntax
>>> print(im("sys_platform=='win32'"))
False
@@ -353,8 +353,8 @@ Environment Markers
>>> print(im("(extra)"))
Comparison or logical expression expected
- >>> print(im("(extra")) # doctest: +ELLIPSIS
- unexpected EOF while parsing (...line 1)
+ >>> print(im("(extra"))
+ invalid syntax
>>> print(im("os.open('foo')=='y'"))
Language feature not supported in environment markers
diff --git a/tests/manual_test.py b/tests/manual_test.py
index 3eab99e1..e6489b1c 100644
--- a/tests/manual_test.py
+++ b/tests/manual_test.py
@@ -1,31 +1,16 @@
#!/usr/bin/env python
-import sys
-
-if sys.version_info[0] >= 3:
- raise NotImplementedError('Py3 not supported in this test yet')
+import sys
import os
import shutil
import tempfile
+import subprocess
from distutils.command.install import INSTALL_SCHEMES
from string import Template
from setuptools.compat import urlopen
-try:
- import subprocess
- def _system_call(*args):
- assert subprocess.call(args) == 0
-except ImportError:
- # Python 2.3
- def _system_call(*args):
- # quoting arguments if windows
- if sys.platform == 'win32':
- def quote(arg):
- if ' ' in arg:
- return '"%s"' % arg
- return arg
- args = [quote(arg) for arg in args]
- assert os.system(' '.join(args)) == 0
+def _system_call(*args):
+ assert subprocess.call(args) == 0
def tempdir(func):
def _tempdir(*args, **kwargs):