Commit 69175b94 authored by Steve Kowalik's avatar Steve Kowalik

Merge from master, resolving conflicts.

parents 43d0308a 8ccd428c
......@@ -234,3 +234,15 @@ cc41477ecf92f221c113736fac2830bf8079d40c 19.0
0a2a3d89416e1642cf6f41d22dbc07b3d3c15a4d 19.1.1
5d24cf9d1ced76c406ab3c4a94c25d1fe79b94bc 19.2
66fa131a0d77a1b0e6f89ccb76b254cfb07d3da3 19.3b1
32bba9bf8cce8350b560a7591c9ef5884a194211 19.3
f47f3671508b015e9bb735603d3a0a6ec6a77b01 19.4
0bda3291ac725750b899b4ba3e4b6765e7645daa 19.4.1
0a68cbab72580a6f8d3bf9c45206669eefcd256b 19.5
34121bf49b1a7ac77da7f7c75105c8a920218dd7 19.6b1
3c2332e4ec72717bf17321473e5c3ad6e5778903 19.6
35d9179d04390aada66eceae9ceb7b9274f67646 19.6.1
d2782cbb2f15ca6831ab9426fbf8d4d6ca60db8a 19.6.2
c6e619ce910d1650cc2433f94e5594964085f973 19.7
2a60daeff0cdb039b20b2058aaad7dae7bcd2c1c 20.0
06c9d3ffae80d7f5786c0a454d040d253d47fc03 20.1
919a40f1843131249f98104c73f3aee3fc835e67 20.1.1
......@@ -6,6 +6,10 @@ python:
- 3.4
- 3.5
- pypy
- pypy3
matrix:
allow_failures:
- python: pypy3
env:
- ""
- LC_ALL=C LC_CTYPE=C
......
......@@ -2,23 +2,110 @@
CHANGES
=======
20.2
----
19.3
* Pull Request #173: Replace dual PEP 345 _markerlib implementation
and PEP 426 implementation of environment marker support from
packaging 16.1 and PEP 508. Fixes Issue #122.
20.1.1
------
* Update ``upload_docs`` command to also honor keyring
for password resolution.
20.1
----
* Issue #229: Implement new technique for readily incorporating
dependencies conditionally from vendored copies or primary
locations. Adds a new dependency on six.
* Added support for using passwords from keyring in the upload
command. See `the upload docs
<http://pythonhosted.org/setuptools/setuptools.html#upload-upload-source-and-or-egg-distributions-to-pypi>`_
for details.
20.0
----
19.3
* Issue #118: Once again omit the package metadata (egg-info)
from the list of outputs in ``--record``. This version of setuptools
can no longer be used to upgrade pip earlier than 6.0.
19.7
----
* Pull Request #164: Replace dual PEP 345 _markerlib implementation
and PEP 426 implementation of environment marker support from
packaging 15.4 and PEP-508. Fixes Issue #122.
* `Off-project PR <https://github.com/jaraco/setuptools/pull/32>`_:
For FreeBSD, also honor root certificates from ca_root_nss.
19.6.2
------
* Issue #491: Correct regression incurred in 19.4 where
a double-namespace package installed using pip would
cause a TypeError.
19.6.1
------
* Restore compatibility for PyPy 3 compatibility lost in
19.4.1 addressing Issue #487.
* ``setuptools.launch`` shim now loads scripts in a new
namespace, avoiding getting relative imports from
the setuptools package on Python 2.
19.6
----
* Added a new entry script ``setuptools.launch``,
implementing the shim found in
``pip.util.setuptools_build``. Use this command to launch
distutils-only packages under setuptools in the same way that
pip does, causing the setuptools monkeypatching of distutils
to be invoked prior to invoking a script. Useful for debugging
or otherwise installing a distutils-only package under
setuptools when pip isn't available or otherwise does not
expose the desired functionality. For example::
$ python -m setuptools.launch setup.py develop
* Issue #488: Fix dual manifestation of Extension class in
extension packages installed as dependencies when Cython
is present.
19.5
----
* Issue #486: Correct TypeError when getfilesystemencoding
returns None.
* Issue #139: Clarified the license as MIT.
* Pull Request #169: Removed special handling of command
spec in scripts for Jython.
19.4.1
------
* Issue #487: Use direct invocation of ``importlib.machinery``
in ``pkg_resources`` to avoid missing detection on relevant
platforms.
19.4
----
* Issue #341: Correct error in path handling of package data
files in ``build_py`` command when package is empty.
* Distribute #323, Issue #141, Issue #207, and
Pull Request #167: Another implementation of
``pkg_resources.WorkingSet`` and ``pkg_resources.Distribution``
that supports replacing an extant package with a new one,
allowing for setup_requires dependencies to supersede installed
packages for the session.
19.3
----
* Issue #229: Implement new technique for readily incorporating
dependencies conditionally from vendored copies or primary
locations. Adds a new dependency on six.
19.2
----
......@@ -26,7 +113,6 @@ CHANGES
* Pull Request #162: Add missing whitespace to multiline string
literals.
------
19.1.1
------
......@@ -36,7 +122,6 @@ CHANGES
of strings, rather than rely on ``repr``, which can be
incorrect (especially on Python 2).
----
19.1
----
......@@ -46,14 +131,12 @@ CHANGES
than hard-coding a particular value.
* Issue #475: Fix incorrect usage in _translate_metadata2.
----
19.0
----
* Issue #442: Use RawConfigParser for parsing .pypirc file.
Interpolated values are no longer honored in .pypirc files.
------
18.8.1
------
......@@ -62,7 +145,6 @@ CHANGES
with setuptools hidden. Fixes regression introduced in Setuptools
12.0.
----
18.8
----
......@@ -74,14 +156,12 @@ CHANGES
* Issue #472: Remove deprecated use of 'U' in mode parameter
when opening files.
------
18.7.1
------
* Issue #469: Refactored logic for Issue #419 fix to re-use metadata
loading from Provider.
----
18.7
----
......@@ -99,14 +179,12 @@ CHANGES
reading the version info from distutils-installed metadata rather
than using the version in the filename.
------
18.6.1
------
* Issue #464: Correct regression in invocation of superclass on old-style
class on Python 2.
----
18.6
----
......@@ -114,7 +192,6 @@ CHANGES
omit the version number of the package, allowing any version of the
package to be used.
----
18.5
----
......@@ -126,27 +203,23 @@ CHANGES
* `Fix dictionary mutation during iteration
<https://github.com/jaraco/setuptools/pull/29>`_.
----
18.4
----
* Issue #446: Test command now always invokes unittest, even
if no test suite is supplied.
------
18.3.2
------
* Correct another regression in setuptools.findall
where the fix for Python #12885 was lost.
------
18.3.1
------
* Issue #425: Correct regression in setuptools.findall.
----
18.3
----
......@@ -167,25 +240,21 @@ CHANGES
* Refactor setuptools.findall in preparation for re-submission
back to distutils.
----
18.2
----
* Issue #412: More efficient directory search in ``find_packages``.
----
18.1
----
* Upgrade to vendored packaging 15.3.
------
18.0.1
------
* Issue #401: Fix failure in test suite.
----
18.0
----
......@@ -211,7 +280,6 @@ CHANGES
* Pull Request #136: Remove excessive quoting from shebang headers
for Jython.
------
17.1.1
------
......@@ -219,14 +287,12 @@ CHANGES
deprecated imp module (`ref
<https://bitbucket.org/pypa/setuptools/commits/f572ec9563d647fa8d4ffc534f2af8070ea07a8b#comment-1881283>`_).
----
17.1
----
* Issue #380: Add support for range operators on environment
marker evaluation.
----
17.0
----
......@@ -235,7 +301,6 @@ CHANGES
the name. Removes unintended functionality and brings behavior
into parity with pip.
----
16.0
----
......@@ -243,8 +308,9 @@ CHANGES
parsed requirements.
* Pull Request #133: Removed ``setuptools.tests`` from the
installed packages.
* Pull Request #129: Address deprecation warning due to usage
of imp module.
----
15.2
----
......@@ -252,14 +318,12 @@ CHANGES
``pkg_resources._initialize_master_working_set``, allowing for
imperative re-initialization of the master working set.
----
15.1
----
* Updated to Packaging 15.1 to address Packaging #28.
* Fix ``setuptools.sandbox._execfile()`` with Python 3.1.
----
15.0
----
......@@ -273,7 +337,6 @@ CHANGES
has since been changed, but older versions of buildout may experience
problems. See Buildout #242 for details.
------
14.3.1
------
......@@ -282,7 +345,6 @@ CHANGES
* Issue #364: Replace deprecated usage with recommended usage of
``EntryPoint.load``.
----
14.3
----
......@@ -290,7 +352,6 @@ CHANGES
for creating the directory to avoid the subsequent warning if
the directory is group writable.
----
14.2
----
......@@ -298,21 +359,18 @@ CHANGES
None for pyversion or platform can be compared against Distributions
defining those attributes.
------
14.1.1
------
* Issue #360: Removed undesirable behavior from test runs, preventing
write tests and installation to system site packages.
----
14.1
----
* Pull Request #125: Add ``__ne__`` to Requirement class.
* Various refactoring of easy_install.
----
14.0
----
......@@ -328,21 +386,18 @@ CHANGES
using the "install-dir" and "scripts-dir" parameters to easy_install
through an appropriate distutils config file.
------
13.0.2
------
* Issue #359: Include pytest.ini in the sdist so invocation of py.test on the
sdist honors the pytest configuration.
------
13.0.1
------
Re-release of 13.0. Intermittent connectivity issues caused the release
process to fail and PyPI uploads no longer accept files for 13.0.
----
13.0
----
......@@ -352,14 +407,12 @@ process to fail and PyPI uploads no longer accept files for 13.0.
functionality was added to support upgrades from old Distribute versions,
0.6.5 and 0.6.6.
----
12.4
----
* Pull Request #119: Restore writing of ``setup_requires`` to metadata
(previously added in 8.4 and removed in 9.0).
----
12.3
----
......@@ -369,7 +422,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #354. Added documentation on building setuptools
documentation.
----
12.2
----
......@@ -380,40 +432,34 @@ process to fail and PyPI uploads no longer accept files for 13.0.
remains deprecated for use by individual packages.
* Simplified implementation of ``ez_setup.use_setuptools``.
----
12.1
----
* Pull Request #118: Soften warning for non-normalized versions in
Distribution.
------
12.0.5
------
* Issue #339: Correct Attribute reference in ``cant_write_to_target``.
* Issue #336: Deprecated ``ez_setup.use_setuptools``.
------
12.0.4
------
* Issue #335: Fix script header generation on Windows.
------
12.0.3
------
* Fixed incorrect class attribute in ``install_scripts``. Tests would be nice.
------
12.0.2
------
* Issue #331: Fixed ``install_scripts`` command on Windows systems corrupting
the header.
------
12.0.1
------
......@@ -421,7 +467,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
compatibility. For the future, tools should construct a CommandSpec
explicitly.
----
12.0
----
......@@ -432,14 +477,12 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Deprecated ``easy_install.ScriptWriter.get_writer``, replaced by ``.best()``
with slightly different semantics (no force_windows flag).
------
11.3.1
------
* Issue #327: Formalize and restore support for any printable character in an
entry point name.
----
11.3
----
......@@ -453,13 +496,11 @@ process to fail and PyPI uploads no longer accept files for 13.0.
getattr(ep, "resolve", lambda: ep.load(require=False))()
----
11.2
----
* Pip #2326: Report deprecation warning at stacklevel 2 for easier diagnosis.
----
11.1
----
......@@ -470,20 +511,17 @@ process to fail and PyPI uploads no longer accept files for 13.0.
a VersionConflict when no dependent package context is known. New unit tests
now capture the expected interface.
----
11.0
----
* Interop #3: Upgrade to Packaging 15.0; updates to PEP 440 so that >1.7 does
not exclude 1.7.1 but does exclude 1.7.0 and 1.7.0.post1.
------
10.2.1
------
* Issue #323: Fix regression in entry point name parsing.
----
10.2
----
......@@ -493,7 +531,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Substantial refactoring of all unit tests. Tests are now much leaner and
re-use a lot of fixtures and contexts for better clarity of purpose.
----
10.1
----
......@@ -502,13 +539,11 @@ process to fail and PyPI uploads no longer accept files for 13.0.
so that systems relying on that interface do not fail (namely, Ubuntu 12.04
and similar Debian releases).
------
10.0.1
------
* Issue #319: Fixed issue installing pure distutils packages.
----
10.0
----
......@@ -521,53 +556,45 @@ process to fail and PyPI uploads no longer accept files for 13.0.
upgrade (or downgrade) itself even when its own metadata and implementation
change.
---
9.1
---
* Prefer vendored packaging library `as recommended
<https://github.com/jaraco/setuptools/commit/170657b68f4b92e7e1bf82f5e19a831f5744af67#commitcomment-9109448>`_.
-----
9.0.1
-----
* Issue #312: Restored presence of pkg_resources API tests (doctest) to sdist.
---
9.0
---
* Issue #314: Disabled support for ``setup_requires`` metadata to avoid issue
where Setuptools was unable to upgrade over earlier versions.
---
8.4
---
* Pull Request #106: Now write ``setup_requires`` metadata.
---
8.3
---
* Issue #311: Decoupled pkg_resources from setuptools once again.
``pkg_resources`` is now a package instead of a module.
-----
8.2.1
-----
* Issue #306: Suppress warnings about Version format except in select scenarios
(such as installation).
---
8.2
---
* Pull Request #85: Search egg-base when adding egg-info to manifest.
---
8.1
---
......@@ -577,7 +604,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
``pkg_resources.PEP440Warning``, instead of RuntimeWarning.
* Disabled warnings on empty versions.
-----
8.0.4
-----
......@@ -587,27 +613,23 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #296: Add warning when a version is parsed as legacy. This warning will
make it easier for developers to recognize deprecated version numbers.
-----
8.0.3
-----
* Issue #296: Restored support for ``__hash__`` on parse_version results.
-----
8.0.2
-----
* Issue #296: Restored support for ``__getitem__`` and sort operations on
parse_version result.
-----
8.0.1
-----
* Issue #296: Restore support for iteration over parse_version result, but
deprecated that usage with a warning. Fixes failure with buildout.
---
8.0
---
......@@ -620,7 +642,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
supported. Setuptools now "vendors" the `packaging
<https://github.com/pypa/packaging>`_ library.
---
7.0
---
......@@ -637,28 +658,24 @@ process to fail and PyPI uploads no longer accept files for 13.0.
adapted to ignore ``.eggs``. The files will need to be manually moved or
will be retrieved again. Most use cases will require no attention.
---
6.1
---
* Issue #268: When resolving package versions, a VersionConflict now reports
which package previously required the conflicting version.
-----
6.0.2
-----
* Issue #262: Fixed regression in pip install due to egg-info directories
being omitted. Re-opens Issue #118.
-----
6.0.1
-----
* Issue #259: Fixed regression with namespace package handling on ``single
version, externally managed`` installs.
---
6.0
---
......@@ -689,7 +706,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
recognize the specially-packaged compiler package for easy extension module
support on Python 2.6, 2.7, and 3.2.
---
5.8
---
......@@ -697,7 +713,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
Python 3, supporting environments where builtins have been patched to make
Python 3 look more like Python 2.
---
5.7
---
......@@ -708,20 +723,17 @@ process to fail and PyPI uploads no longer accept files for 13.0.
notes and detailed in Issue #154 was likely not an increase over the status
quo, but rather only an increase over not storing the zip info at all.
---
5.6
---
* Issue #242: Use absolute imports in svn_utils to avoid issues if the
installing package adds an xml module to the path.
-----
5.5.1
-----
* Issue #239: Fix typo in 5.5 such that fix did not take.
---
5.5
---
......@@ -729,20 +741,17 @@ process to fail and PyPI uploads no longer accept files for 13.0.
Distribution objects and validates the syntax just like install_requires
and tests_require directives.
-----
5.4.2
-----
* Issue #236: Corrected regression in execfile implementation for Python 2.6.
-----
5.4.1
-----
* Python #7776: (ssl_support) Correct usage of host for validation when
tunneling for HTTPS.
---
5.4
---
......@@ -753,7 +762,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
in startup time by enabling this feature. This feature is not enabled by
default because it causes a substantial increase in memory usage.
---
5.3
---
......@@ -762,7 +770,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Prune revision control directories (e.g .svn) from base path
as well as sub-directories.
---
5.2
---
......@@ -774,7 +781,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* During install_egg_info, the generated lines for namespace package .pth
files are now processed even during a dry run.
---
5.1
---
......@@ -782,20 +788,17 @@ process to fail and PyPI uploads no longer accept files for 13.0.
building on the work in Issue #168. Special thanks to Jurko Gospodnetic and
PJE.
-----
5.0.2
-----
* Issue #220: Restored script templates.
-----
5.0.1
-----
* Renamed script templates to end with .tmpl now that they no longer need
to be processed by 2to3. Fixes spurious syntax errors during build/install.
---
5.0
---
......@@ -803,7 +806,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Incidentally, script templates were updated not to include the triple-quote
escaping.
-------------------------
3.7.1 and 3.8.1 and 4.0.1
-------------------------
......@@ -811,48 +813,41 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #218: Setuptools 3.8.1 superseded 4.0.1, and 4.x was removed
from the available versions to install.
---
4.0
---
* Issue #210: ``setup.py develop`` now copies scripts in binary mode rather
than text mode, matching the behavior of the ``install`` command.
---
3.8
---
* Extend Issue #197 workaround to include all Python 3 versions prior to
3.2.2.
---
3.7
---
* Issue #193: Improved handling of Unicode filenames when building manifests.
---
3.6
---
* Issue #203: Honor proxy settings for Powershell downloader in the bootstrap
routine.
-----
3.5.2
-----
* Issue #168: More robust handling of replaced zip files and stale caches.
Fixes ZipImportError complaining about a 'bad local header'.
-----
3.5.1
-----
* Issue #199: Restored ``install._install`` for compatibility with earlier
NumPy versions.
---
3.5
---
......@@ -863,32 +858,27 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #192: Preferred bootstrap location is now
https://bootstrap.pypa.io/ez_setup.py (mirrored from former location).
-----
3.4.4
-----
* Issue #184: Correct failure where find_package over-matched packages
when directory traversal isn't short-circuited.
-----
3.4.3
-----
* Issue #183: Really fix test command with Python 3.1.
-----
3.4.2
-----
* Issue #183: Fix additional regression in test command on Python 3.1.
-----
3.4.1
-----
* Issue #180: Fix regression in test command not caught by py.test-run tests.
---
3.4
---
......@@ -899,13 +889,11 @@ process to fail and PyPI uploads no longer accept files for 13.0.
now installs naturally on IronPython. Behavior on CPython should be
unchanged.
---
3.3
---
* Add ``include`` parameter to ``setuptools.find_packages()``.
---
3.2
---
......@@ -913,27 +901,23 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #162: Update dependency on certifi to 1.0.1.
* Issue #164: Update dependency on wincertstore to 0.2.
---
3.1
---
* Issue #161: Restore Features functionality to allow backward compatibility
(for Features) until the uses of that functionality is sufficiently removed.
-----
3.0.2
-----
* Correct typo in previous bugfix.
-----
3.0.1
-----
* Issue #157: Restore support for Python 2.6 in bootstrap script where
``zipfile.ZipFile`` does not yet have support for context managers.
---
3.0
---
......@@ -961,7 +945,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
Python 3 environments.
* Issue #156: Fix spelling of __PYVENV_LAUNCHER__ variable.
---
2.2
---
......@@ -970,21 +953,18 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Issue #128: Fixed issue where only the first dependency link was honored
in a distribution where multiple dependency links were supplied.
-----
2.1.2
-----
* Issue #144: Read long_description using codecs module to avoid errors
installing on systems where LANG=C.
-----
2.1.1
-----
* Issue #139: Fix regression in re_finder for CVS repos (and maybe Git repos
as well).
---
2.1
---
......@@ -992,7 +972,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
in a zip-imported file.
* Issue #131: Fix RuntimeError when constructing an egg fetcher.
-----
2.0.2
-----
......@@ -1000,13 +979,11 @@ process to fail and PyPI uploads no longer accept files for 13.0.
not containing parser module.
* Fix NameError in ``sdist:re_finder``.
-----
2.0.1
-----
* Issue #124: Fixed error in list detection in upload_docs.
---
2.0
---
......@@ -1019,14 +996,12 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Removed ``pkg_resources.ImpWrapper``. Clients that expected this class
should use ``pkgutil.ImpImporter`` instead.
-----
1.4.2
-----
* Issue #116: Correct TypeError when reading a local package index on Python
3.
-----
1.4.1
-----
......@@ -1056,7 +1031,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
for legacy SVN releases and support for SVN without the subprocess command
would simple go away as support for the older SVNs does.
---
1.4
---
......@@ -1065,19 +1039,16 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Pull Request #21: Omit unwanted newlines in ``package_index._encode_auth``
when the username/password pair length indicates wrapping.
-----
1.3.2
-----
* Issue #99: Fix filename encoding issues in SVN support.
-----
1.3.1
-----
* Remove exuberant warning in SVN support when SVN is not used.
---
1.3
---
......@@ -1088,7 +1059,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
implementation if present.
* Correct NameError in ``ssl_support`` module (``socket.error``).
---
1.2
---
......@@ -1101,7 +1071,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Setuptools "natural" launcher support, introduced in 1.0, is now officially
supported.
-----
1.1.7
-----
......@@ -1112,39 +1081,33 @@ process to fail and PyPI uploads no longer accept files for 13.0.
* Distribute #363 and Issue #55: Skip an sdist test that fails on locales
other than UTF-8.
-----
1.1.6
-----
* Distribute #349: ``sandbox.execfile`` now opens the target file in binary
mode, thus honoring a BOM in the file when compiled.
-----
1.1.5
-----
* Issue #69: Second attempt at fix (logic was reversed).
-----
1.1.4
-----
* Issue #77: Fix error in upload command (Python 2.4).
-----
1.1.3
-----
* Fix NameError in previous patch.
-----
1.1.2
-----
* Issue #69: Correct issue where 404 errors are returned for URLs with
fragments in them (such as #egg=).
-----
1.1.1
-----
......@@ -1152,7 +1115,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
environments where a trusted SSL connection cannot be validated.
* Issue #76: Fix AttributeError in upload command with Python 2.4.
---
1.1
---
......@@ -1160,7 +1122,6 @@ process to fail and PyPI uploads no longer accept files for 13.0.
condition when a host is blocked via ``--allow-hosts``.
* Issue #72: Restored Python 2.4 compatibility in ``ez_setup.py``.
---
1.0
---
......@@ -1197,13 +1158,11 @@ not all users will find 1.0 a drop-in replacement for 0.9.
* Removed ``--ignore-conflicts-at-my-risk`` and ``--delete-conflicting``
options to easy_install. These options have been deprecated since 0.6a11.
-----
0.9.8
-----
* Issue #53: Fix NameErrors in `_vcs_split_rev_from_url`.
-----
0.9.7
-----
......@@ -1213,79 +1172,67 @@ not all users will find 1.0 a drop-in replacement for 0.9.
referenced by bookmark.
* Add underscore-separated keys to environment markers (markerlib).
-----
0.9.6
-----
* Issue #44: Test failure on Python 2.4 when MD5 hash doesn't have a `.name`
attribute.
-----
0.9.5
-----
* Python #17980: Fix security vulnerability in SSL certificate validation.
-----
0.9.4
-----
* Issue #43: Fix issue (introduced in 0.9.1) with version resolution when
upgrading over other releases of Setuptools.
-----
0.9.3
-----
* Issue #42: Fix new ``AttributeError`` introduced in last fix.
-----
0.9.2
-----
* Issue #42: Fix regression where blank checksums would trigger an
``AttributeError``.
-----
0.9.1
-----
* Distribute #386: Allow other positional and keyword arguments to os.open.
* Corrected dependency on certifi mis-referenced in 0.9.
---
0.9
---
* `package_index` now validates hashes other than MD5 in download links.
---
0.8
---
* Code base now runs on Python 2.4 - Python 3.3 without Python 2to3
conversion.
-----
0.7.8
-----
* Distribute #375: Yet another fix for yet another regression.
-----
0.7.7
-----
* Distribute #375: Repair AttributeError created in last release (redo).
* Issue #30: Added test for get_cache_path.
-----
0.7.6
-----
* Distribute #375: Repair AttributeError created in last release.
-----
0.7.5
-----
......@@ -1295,33 +1242,28 @@ not all users will find 1.0 a drop-in replacement for 0.9.
``SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT`` in addition to the now
deprecated ``DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT``.
-----
0.7.4
-----
* Issue #20: Fix comparison of parsed SVN version on Python 3.
-----
0.7.3
-----
* Issue #1: Disable installation of Windows-specific files on non-Windows systems.
* Use new sysconfig module with Python 2.7 or >=3.2.
-----
0.7.2
-----
* Issue #14: Use markerlib when the `parser` module is not available.
* Issue #10: ``ez_setup.py`` now uses HTTPS to download setuptools from PyPI.
-----
0.7.1
-----
* Fix NameError (Issue #3) again - broken in bad merge.
---
0.7
---
......@@ -1339,13 +1281,11 @@ Added several features that were slated for setuptools 0.6c12:
* Added support for SSL certificate validation when installing packages from
an HTTPS service.
-----
0.7b4
-----
* Issue #3: Fixed NameError in SSL support.
------
0.6.49
------
......@@ -1353,21 +1293,18 @@ Added several features that were slated for setuptools 0.6c12:
to avoid errors when the cache path does not yet exist. Fixes the error
reported in Distribute #375.
------
0.6.48
------
* Correct AttributeError in ``ResourceManager.get_cache_path`` introduced in
0.6.46 (redo).
------
0.6.47
------
* Correct AttributeError in ``ResourceManager.get_cache_path`` introduced in
0.6.46.
------
0.6.46
------
......@@ -1375,27 +1312,23 @@ Added several features that were slated for setuptools 0.6c12:
customized egg cache location specifies a directory that's group- or
world-writable.
------
0.6.45
------
* Distribute #379: ``distribute_setup.py`` now traps VersionConflict as well,
restoring ability to upgrade from an older setuptools version.
------
0.6.44
------
* ``distribute_setup.py`` has been updated to allow Setuptools 0.7 to
satisfy use_setuptools.
------
0.6.43
------
* Distribute #378: Restore support for Python 2.4 Syntax (regression in 0.6.42).
------
0.6.42
------
......@@ -1403,7 +1336,6 @@ Added several features that were slated for setuptools 0.6c12:
* Distribute #337: Moved site.py to setuptools/site-patch.py (graft of very old
patch from setuptools trunk which inspired PR #31).
------
0.6.41
------
......@@ -1412,14 +1344,12 @@ Added several features that were slated for setuptools 0.6c12:
* Added a new function ``easy_install.get_win_launcher`` which may be used by
third-party libraries such as buildout to get a suitable script launcher.
------
0.6.40
------
* Distribute #376: brought back cli.exe and gui.exe that were deleted in the
previous release.
------
0.6.39
------
......@@ -1431,13 +1361,11 @@ Added several features that were slated for setuptools 0.6c12:
check the contents of the file against the zip contents during each
invocation of get_resource_filename.
------
0.6.38
------
* Distribute #371: The launcher manifest file is now installed properly.
------
0.6.37
------
......@@ -1447,7 +1375,6 @@ Added several features that were slated for setuptools 0.6c12:
in `this Microsoft article
<http://technet.microsoft.com/en-us/library/cc709628%28WS.10%29.aspx>`_.
------
0.6.36
------
......@@ -1457,7 +1384,6 @@ Added several features that were slated for setuptools 0.6c12:
under Windows. Easy_install now skips all directories when processing
metadata scripts.
------
0.6.35
------
......@@ -1469,13 +1395,11 @@ how it parses version numbers.
0.6. Updated the documentation to match more closely with the version
parsing as intended in setuptools 0.6.
------
0.6.34
------
* Distribute #341: 0.6.33 fails to build under Python 2.4.
------
0.6.33
------
......@@ -1488,7 +1412,6 @@ how it parses version numbers.
for details.
* Distribute #341: Fix a ResourceWarning.
------
0.6.32
------
......@@ -1497,7 +1420,6 @@ how it parses version numbers.
* Distribute #335: Backed out `setup_requires` superceding installed requirements
until regression can be addressed.
------
0.6.31
------
......@@ -1522,14 +1444,12 @@ how it parses version numbers.
would have been in had that egg been on the path when pkg_resources was
first imported.
------
0.6.30
------
* Distribute #328: Clean up temporary directories in distribute_setup.py.
* Fix fatal bug in distribute_setup.py.
------
0.6.29
------
......@@ -1561,7 +1481,6 @@ how it parses version numbers.
* `distribute_setup.py` now allows a `--download-base` argument for retrieving
distribute from a specified location.
------
0.6.28
------
......@@ -1571,7 +1490,6 @@ how it parses version numbers.
* Distribute #283: Fix and disable scanning of `*.pyc` / `*.pyo` files on
Python 3.3.
------
0.6.27
------
......@@ -1582,7 +1500,6 @@ how it parses version numbers.
* Distribute #231: Don't fiddle with system python when used with buildout
(bootstrap.py)
------
0.6.26
------
......@@ -1591,7 +1508,6 @@ how it parses version numbers.
installation of a source distribution; now fulfillment of setup_requires
dependencies will honor the parameters passed to easy_install.
------
0.6.25
------
......@@ -1607,13 +1523,11 @@ how it parses version numbers.
449.
* Distribute #273: Legacy script launchers now install with Python2/3 support.
------
0.6.24
------
* Distribute #249: Added options to exclude 2to3 fixers
------
0.6.23
------
......@@ -1629,13 +1543,11 @@ how it parses version numbers.
* Distribute #227: easy_install now passes its arguments to setup.py bdist_egg
* Distribute #225: Fixed a NameError on Python 2.5, 2.4
------
0.6.21
------
* Distribute #225: FIxed a regression on py2.4
------
0.6.20
------
......@@ -1643,19 +1555,16 @@ how it parses version numbers.
* Distribute #212: Fix issue where easy_instal fails on Python 3 on windows installer.
* Distribute #213: Fix typo in documentation.
------
0.6.19
------
* Distribute #206: AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
------
0.6.18
------
* Distribute #210: Fixed a regression introduced by Distribute #204 fix.
------
0.6.17
------
......@@ -1668,7 +1577,6 @@ how it parses version numbers.
* Distribute #205: Sandboxing doesn't preserve working_set. Leads to setup_requires
problems.
------
0.6.16
------
......@@ -1678,7 +1586,6 @@ how it parses version numbers.
* Distribute #195: Cython build support.
* Distribute #200: Issues with recognizing 64-bit packages on Windows.
------
0.6.15
------
......@@ -1686,7 +1593,6 @@ how it parses version numbers.
* Several issues under Python 3 has been solved.
* Distribute #146: Fixed missing DLL files after easy_install of windows exe package.
------
0.6.14
------
......@@ -1696,7 +1602,6 @@ how it parses version numbers.
Thanks to David and Zooko.
* Distribute #174: Fixed the edit mode when its used with setuptools itself
------
0.6.13
------
......@@ -1705,13 +1610,11 @@ how it parses version numbers.
* Distribute #163: scan index links before external links, and don't use the md5 when
comparing two distributions
------
0.6.12
------
* Distribute #149: Fixed various failures on 2.3/2.4
------
0.6.11
------
......@@ -1728,7 +1631,6 @@ how it parses version numbers.
* Distribute #138: cant_write_to_target error when setup_requires is used.
* Distribute #147: respect the sys.dont_write_bytecode flag
------
0.6.10
------
......@@ -1736,7 +1638,6 @@ how it parses version numbers.
zc.buildout uses the exception message to get the name of the
distribution.
-----
0.6.9
-----
......@@ -1763,14 +1664,12 @@ how it parses version numbers.
* Distribute #100: making sure there's no SandboxViolation when
the setup script patches setuptools.
-----
0.6.8
-----
* Added "check_packages" in dist. (added in Setuptools 0.6c11)
* Fixed the DONT_PATCH_SETUPTOOLS state.
-----
0.6.7
-----
......@@ -1795,14 +1694,12 @@ how it parses version numbers.
* Distribute #74: no_fake should be True by default.
* Distribute #72: avoid a bootstrapping issue with easy_install -U
-----
0.6.6
-----
* Unified the bootstrap file so it works on both py2.x and py3k without 2to3
(patch by Holger Krekel)
-----
0.6.5
-----
......@@ -1821,7 +1718,6 @@ how it parses version numbers.
* Fixed a hole in sandboxing allowing builtin file to write outside of
the sandbox.
-----
0.6.4
-----
......@@ -1833,7 +1729,6 @@ how it parses version numbers.
* Fixed a bootstrap bug on the use_setuptools() API.
-----
0.6.3
-----
......@@ -1847,7 +1742,6 @@ bootstrapping
* Fixed a bug in sorting that caused bootstrap to fail on Python 3.
-----
0.6.2
-----
......@@ -1879,7 +1773,6 @@ bootstrapping
* Make sure setuptools is patched when running through easy_install
This closes Old Setuptools #40.
-----
0.6.1
-----
......@@ -1907,7 +1800,6 @@ bootstrapping
and --root or --prefix is provided, but is not in the same location.
This closes Distribute #10.
---
0.6
---
......@@ -1950,7 +1842,6 @@ easy_install
* Immediately close all file handles. This closes Distribute #3.
-----
0.6c9
-----
......@@ -1991,7 +1882,6 @@ easy_install
gracefully under Google App Engine (with an ``ImportError`` loading the
C-based module, instead of getting a ``NameError``).
-----
0.6c7
-----
......@@ -2002,7 +1892,6 @@ easy_install
``--root`` or ``--single-version-externally-managed``, due to the
parent package not having the child package as an attribute.
-----
0.6c6
-----
......@@ -2026,7 +1915,6 @@ easy_install
* Fix ``find_packages()`` treating ``ez_setup`` and directories with ``.`` in
their names as packages.
-----
0.6c5
-----
......@@ -2036,7 +1924,6 @@ easy_install
* 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
-----
......@@ -2066,13 +1953,11 @@ easy_install
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
-----
......@@ -2083,7 +1968,6 @@ easy_install
* Running ``setup.py develop`` on a setuptools-using project will now install
setuptools if needed, instead of only downloading the egg.
-----
0.6c1
-----
......@@ -2107,7 +1991,6 @@ easy_install
the version was overridden on the command line that built the source
distribution.)
-----
0.6b4
-----
......@@ -2120,7 +2003,6 @@ easy_install
* Fixed redundant warnings about missing ``README`` file(s); it should now
appear only if you are actually a source distribution.
-----
0.6b3
-----
......@@ -2131,7 +2013,6 @@ easy_install
``include_package_data`` and ``package_data`` are used to refer to the same
files.
-----
0.6b1
-----
......@@ -2139,7 +2020,6 @@ easy_install
the name of a ``.py`` loader/wrapper. (Python's import machinery ignores
this suffix when searching for an extension module.)
------
0.6a11
------
......@@ -2173,13 +2053,11 @@ easy_install
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
-----
......@@ -2231,7 +2109,6 @@ easy_install
back into an ``.egg`` file or directory and install it as such.
-----
0.6a8
-----
......@@ -2259,13 +2136,11 @@ easy_install
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
-----
......@@ -2273,7 +2148,6 @@ easy_install
on Windows and other platforms. (The special handling is only for Windows;
other platforms are treated the same as for ``console_scripts``.)
-----
0.6a2
-----
......@@ -2282,7 +2156,6 @@ easy_install
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
-----
......@@ -2328,7 +2201,6 @@ easy_install
or documented, and never would have worked without EasyInstall - which it
pre-dated and was never compatible with.
------
0.5a12
------
......@@ -2336,14 +2208,12 @@ easy_install
``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
-----
......@@ -2378,7 +2248,6 @@ easy_install
* Fixed the swapped ``-d`` and ``-b`` options of ``bdist_egg``.
-----
0.5a8
-----
......@@ -2406,7 +2275,6 @@ easy_install
* Added a "setopt" command that sets a single option in a specified distutils
configuration file.
-----
0.5a7
-----
......@@ -2414,7 +2282,6 @@ easy_install
fix for "upload" and a temporary workaround for lack of .egg support in
PyPI.
-----
0.5a6
-----
......@@ -2433,7 +2300,6 @@ easy_install
revisions compare *lower* than the version specified in setup.py (e.g. by
using ``--tag-build=dev``).
-----
0.5a5
-----
......@@ -2461,7 +2327,6 @@ easy_install
accordingly. ``easy_install.py`` is still installed as a script, but not as
a module.
-----
0.5a4
-----
......@@ -2477,7 +2342,6 @@ easy_install
* Setup scripts using setuptools now always install using ``easy_install``
internally, for ease of uninstallation and upgrading.
-----
0.5a1
-----
......@@ -2492,7 +2356,6 @@ easy_install
from setuptools import setup
# etc...
-----
0.4a2
-----
......@@ -2520,7 +2383,6 @@ easy_install
their ``command_consumes_arguments`` attribute to ``True`` in order to
receive an ``args`` option containing the rest of the command line.
-----
0.3a2
-----
......@@ -2530,8 +2392,8 @@ easy_install
* Misc. bug fixes
-----
0.3a1
-----
* Initial release.
......@@ -2328,54 +2328,25 @@ available:
``upload`` - Upload source and/or egg distributions to PyPI
===========================================================
PyPI now supports uploading project files for redistribution; uploaded files
are easily found by EasyInstall, even if you don't have download links on your
project's home page.
The ``upload`` command is implemented and `documented
<https://docs.python.org/3.1/distutils/uploading.html>`_
in distutils.
Although Python 2.5 will support uploading all types of distributions to PyPI,
setuptools only supports source distributions and eggs. (This is partly
because PyPI's upload support is currently broken for various other file
types.) To upload files, you must include the ``upload`` command *after* the
``sdist`` or ``bdist_egg`` commands on the setup command line. For example::
Setuptools augments the ``upload`` command with support
for `keyring <https://pypi.python.org/pypi/keyring>`_,
allowing the password to be stored in a secure
location and not in plaintext in the .pypirc file. To use
keyring, first install keyring and set the password for
the relevant repository, e.g.::
setup.py bdist_egg upload # create an egg and upload it
setup.py sdist upload # create a source distro and upload it
setup.py sdist bdist_egg upload # create and upload both
python -m keyring set <repository> <username>
Password for '<username>' in '<repository>': ********
Note that to upload files for a project, the corresponding version must already
be registered with PyPI, using the distutils ``register`` command. It's
usually a good idea to include the ``register`` command at the start of the
command line, so that any registration problems can be found and fixed before
building and uploading the distributions, e.g.::
Then, in .pypirc, set the repository configuration as normal,
but omit the password. Thereafter, uploads will use the
password from the keyring.
setup.py register sdist bdist_egg upload
This will update PyPI's listing for your project's current version.
Note, by the way, that the metadata in your ``setup()`` call determines what
will be listed in PyPI for your package. Try to fill out as much of it as
possible, as it will save you a lot of trouble manually adding and updating
your PyPI listings. Just put it in ``setup.py`` and use the ``register``
command to keep PyPI up to date.
The ``upload`` command has a few options worth noting:
``--sign, -s``
Sign each uploaded file using GPG (GNU Privacy Guard). The ``gpg`` program
must be available for execution on the system ``PATH``.
``--identity=NAME, -i NAME``
Specify the identity or key name for GPG to use when signing. The value of
this option will be passed through the ``--local-user`` option of the
``gpg`` program.
``--show-response``
Display the full response text from server; this is useful for debugging
PyPI problems.
``--repository=URL, -r URL``
The URL of the repository to upload to. Defaults to
https://pypi.python.org/pypi (i.e., the main PyPI installation).
New in 20.1: Added keyring support.
.. _upload_docs:
......
......@@ -46,7 +46,7 @@ except ImportError:
import imp as _imp
from pkg_resources.extern import six
from pkg_resources.extern.six.moves import urllib
from pkg_resources.extern.six.moves import urllib, map, filter
# capture these to bypass sandboxing
from os import utime
......@@ -60,10 +60,11 @@ except ImportError:
from os import open as os_open
from os.path import isdir, split
# Avoid try/except due to potential problems with delayed import mechanisms.
if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
try:
import importlib.machinery as importlib_machinery
else:
# access attribute to force import under delayed import mechanisms.
importlib_machinery.__name__
except ImportError:
importlib_machinery = None
try:
......@@ -78,9 +79,6 @@ __import__('pkg_resources._vendor.packaging.requirements')
__import__('pkg_resources._vendor.packaging.markers')
filter = six.moves.filter
map = six.moves.map
if (3, 0) < sys.version_info < (3, 3):
msg = (
"Support for Python 3.0-3.2 has been dropped. Future versions "
......@@ -757,7 +755,7 @@ class WorkingSet(object):
will be called.
"""
if insert:
dist.insert_on(self.entries, entry)
dist.insert_on(self.entries, entry, replace=replace)
if entry is None:
entry = dist.location
......@@ -1178,22 +1176,23 @@ class ResourceManager:
old_exc = sys.exc_info()[1]
cache_path = self.extraction_path or get_default_cache()
err = ExtractionError("""Can't extract file(s) to egg cache
tmpl = textwrap.dedent("""
Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
cache:
The following error occurred while trying to extract file(s) to the Python egg
cache:
%s
{old_exc}
The Python egg cache directory is currently set to:
The Python egg cache directory is currently set to:
%s
{cache_path}
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)
)
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.
""").lstrip()
err = ExtractionError(tmpl.format(**locals()))
err.manager = self
err.cache_path = cache_path
err.original_error = old_exc
......@@ -1561,10 +1560,13 @@ class DefaultProvider(EggProvider):
with open(path, 'rb') as stream:
return stream.read()
register_loader_type(type(None), DefaultProvider)
@classmethod
def _register(cls):
loader_cls = getattr(importlib_machinery, 'SourceFileLoader',
type(None))
register_loader_type(loader_cls, cls)
if importlib_machinery is not None:
register_loader_type(importlib_machinery.SourceFileLoader, DefaultProvider)
DefaultProvider._register()
class EmptyProvider(NullProvider):
......@@ -1970,7 +1972,7 @@ def find_on_path(importer, path_item, only=False):
break
register_finder(pkgutil.ImpImporter, find_on_path)
if importlib_machinery is not None:
if hasattr(importlib_machinery, 'FileFinder'):
register_finder(importlib_machinery.FileFinder, find_on_path)
_declare_state('dict', _namespace_handlers={})
......@@ -2016,11 +2018,28 @@ def _handle_ns(packageName, path_item):
path = module.__path__
path.append(subpath)
loader.load_module(packageName)
for path_item in path:
if path_item not in module.__path__:
module.__path__.append(path_item)
_rebuild_mod_path(path, packageName, module)
return subpath
def _rebuild_mod_path(orig_path, package_name, module):
"""
Rebuild module.__path__ ensuring that all entries are ordered
corresponding to their sys.path order
"""
sys_path = [_normalize_cached(p) for p in sys.path]
def position_in_sys_path(p):
"""
Return the ordinal of the path based on its position in sys.path
"""
parts = p.split(os.sep)
parts = parts[:-(package_name.count('.') + 1)]
return sys_path.index(_normalize_cached(os.sep.join(parts)))
orig_path.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path]
def declare_namespace(packageName):
"""Declare that package 'packageName' is a namespace package"""
......@@ -2079,7 +2098,7 @@ def file_ns_handler(importer, path_item, packageName, module):
register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
register_namespace_handler(zipimport.zipimporter, file_ns_handler)
if importlib_machinery is not None:
if hasattr(importlib_machinery, 'FileFinder'):
register_namespace_handler(importlib_machinery.FileFinder, file_ns_handler)
......@@ -2461,7 +2480,7 @@ class Distribution(object):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None:
path = sys.path
self.insert_on(path)
self.insert_on(path, replace=True)
if path is sys.path:
fixup_namespace_packages(self.location)
for pkg in self._get_metadata('namespace_packages.txt'):
......@@ -2538,7 +2557,7 @@ 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):
def insert_on(self, path, loc=None, replace=False):
"""Insert self.location in path before its nearest parent directory"""
loc = loc or self.location
......@@ -2562,6 +2581,9 @@ class Distribution(object):
else:
if path is sys.path:
self.check_version_conflict()
if replace:
path.insert(0, loc)
else:
path.append(loc)
return
......
......@@ -12,6 +12,8 @@ import stat
import distutils.dist
import distutils.command.install_egg_info
from pkg_resources.extern.six.moves import map
import pytest
import pkg_resources
......
from __future__ import unicode_literals
import os
import sys
import tempfile
import shutil
import string
from pkg_resources.extern.six.moves import map
import pytest
from pkg_resources.extern import packaging
......@@ -158,7 +160,7 @@ class TestDistro:
for i in range(3):
targets = list(ws.resolve(parse_requirements("Foo"), ad))
assert targets == [Foo]
list(map(ws.add,targets))
list(map(ws.add, targets))
with pytest.raises(VersionConflict):
ws.resolve(parse_requirements("Foo==0.9"), ad)
ws = WorkingSet([]) # reset
......@@ -608,21 +610,44 @@ class TestParsing:
class TestNamespaces:
def setup_method(self, method):
self._ns_pkgs = pkg_resources._namespace_packages.copy()
self._tmpdir = tempfile.mkdtemp(prefix="tests-setuptools-")
os.makedirs(os.path.join(self._tmpdir, "site-pkgs"))
self._prev_sys_path = sys.path[:]
sys.path.append(os.path.join(self._tmpdir, "site-pkgs"))
def teardown_method(self, method):
shutil.rmtree(self._tmpdir)
pkg_resources._namespace_packages = self._ns_pkgs.copy()
sys.path = self._prev_sys_path[:]
@pytest.mark.skipif(os.path.islink(tempfile.gettempdir()),
reason="Test fails when /tmp is a symlink. See #231")
def test_two_levels_deep(self):
ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n"
@pytest.yield_fixture
def symlinked_tmpdir(self, tmpdir):
"""
Where available, return the tempdir as a symlink,
which as revealed in #231 is more fragile than
a natural tempdir.
"""
if not hasattr(os, 'symlink'):
yield str(tmpdir)
return
link_name = str(tmpdir) + '-linked'
os.symlink(str(tmpdir), link_name)
try:
yield type(tmpdir)(link_name)
finally:
os.unlink(link_name)
@pytest.yield_fixture(autouse=True)
def patched_path(self, tmpdir):
"""
Patch sys.path to include the 'site-pkgs' dir. Also
restore pkg_resources._namespace_packages to its
former state.
"""
saved_ns_pkgs = pkg_resources._namespace_packages.copy()
saved_sys_path = sys.path[:]
site_pkgs = tmpdir.mkdir('site-pkgs')
sys.path.append(str(site_pkgs))
try:
yield
finally:
pkg_resources._namespace_packages = saved_ns_pkgs
sys.path = saved_sys_path
def test_two_levels_deep(self, symlinked_tmpdir):
"""
Test nested namespace packages
Create namespace packages in the following tree :
......@@ -631,19 +656,16 @@ class TestNamespaces:
Check both are in the _namespace_packages dict and that their __path__
is correct
"""
sys.path.append(os.path.join(self._tmpdir, "site-pkgs2"))
os.makedirs(os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"))
os.makedirs(os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2"))
ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n"
for site in ["site-pkgs", "site-pkgs2"]:
pkg1_init = open(os.path.join(self._tmpdir, site,
"pkg1", "__init__.py"), "w")
pkg1_init.write(ns_str)
pkg1_init.close()
pkg2_init = open(os.path.join(self._tmpdir, site,
"pkg1", "pkg2", "__init__.py"), "w")
pkg2_init.write(ns_str)
pkg2_init.close()
real_tmpdir = symlinked_tmpdir.realpath()
tmpdir = symlinked_tmpdir
sys.path.append(str(tmpdir / 'site-pkgs2'))
site_dirs = tmpdir / 'site-pkgs', tmpdir / 'site-pkgs2'
for site in site_dirs:
pkg1 = site / 'pkg1'
pkg2 = pkg1 / 'pkg2'
pkg2.ensure_dir()
(pkg1 / '__init__.py').write_text(self.ns_str, encoding='utf-8')
(pkg2 / '__init__.py').write_text(self.ns_str, encoding='utf-8')
import pkg1
assert "pkg1" in pkg_resources._namespace_packages
# attempt to import pkg2 from site-pkgs2
......@@ -653,7 +675,44 @@ class TestNamespaces:
assert pkg_resources._namespace_packages["pkg1"] == ["pkg1.pkg2"]
# check the __path__ attribute contains both paths
expected = [
os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"),
os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2"),
str(real_tmpdir / "site-pkgs" / "pkg1" / "pkg2"),
str(real_tmpdir / "site-pkgs2" / "pkg1" / "pkg2"),
]
assert pkg1.pkg2.__path__ == expected
def test_path_order(self, symlinked_tmpdir):
"""
Test that if multiple versions of the same namespace package subpackage
are on different sys.path entries, that only the one earliest on
sys.path is imported, and that the namespace package's __path__ is in
the correct order.
Regression test for https://bitbucket.org/pypa/setuptools/issues/207
"""
tmpdir = symlinked_tmpdir
site_dirs = (
tmpdir / "site-pkgs",
tmpdir / "site-pkgs2",
tmpdir / "site-pkgs3",
)
vers_str = "__version__ = %r"
for number, site in enumerate(site_dirs, 1):
if number > 1:
sys.path.append(str(site))
nspkg = site / 'nspkg'
subpkg = nspkg / 'subpkg'
subpkg.ensure_dir()
(nspkg / '__init__.py').write_text(self.ns_str, encoding='utf-8')
(subpkg / '__init__.py').write_text(vers_str % number, encoding='utf-8')
import nspkg.subpkg
import nspkg
expected = [
str(site.realpath() / 'nspkg')
for site in site_dirs
]
assert nspkg.__path__ == expected
assert nspkg.subpkg.__version__ == 1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# declare and require dependencies
__requires__ = [
'twine',
]; __import__('pkg_resources')
import errno
import glob
import hashlib
import json
import os
import shutil
import tarfile
import codecs
import urllib.request
import urllib.parse
import urllib.error
from distutils.version import LooseVersion
from twine.commands import upload
OK = '\033[92m'
FAIL = '\033[91m'
END = '\033[0m'
DISTRIBUTION = "setuptools"
class SetuptoolsOldReleasesWithoutZip:
"""docstring for SetuptoolsOldReleases"""
def __init__(self):
self.dirpath = './dist'
os.makedirs(self.dirpath, exist_ok=True)
print("Downloading %s releases..." % DISTRIBUTION)
print("All releases will be downloaded to %s" % self.dirpath)
self.data_json_setuptools = self.get_json_data(DISTRIBUTION)
self.valid_releases_numbers = sorted([
release
for release in self.data_json_setuptools['releases']
# This condition is motivated by 13.0 release, which
# comes as "13.0": [], in the json
if self.data_json_setuptools['releases'][release]
], key=LooseVersion)
self.total_downloaded_ok = 0
def get_json_data(self, package_name):
"""
"releases": {
"0.7.2": [
{
"has_sig": false,
"upload_time": "2013-06-09T16:10:00",
"comment_text": "",
"python_version": "source",
"url": "https://pypi.python.org/packages/source/s/setuptools/setuptools-0.7.2.tar.gz", # NOQA
"md5_digest": "de44cd90f8a1c713d6c2bff67bbca65d",
"downloads": 159014,
"filename": "setuptools-0.7.2.tar.gz",
"packagetype": "sdist",
"size": 633077
}
],
"0.7.3": [
{
"has_sig": false,
"upload_time": "2013-06-18T21:08:56",
"comment_text": "",
"python_version": "source",
"url": "https://pypi.python.org/packages/source/s/setuptools/setuptools-0.7.3.tar.gz", # NOQA
"md5_digest": "c854adacbf9067d330a847f06f7a8eba",
"downloads": 30594,
"filename": "setuptools-0.7.3.tar.gz",
"packagetype": "sdist",
"size": 751152
}
],
"12.3": [
{
"has_sig": false,
"upload_time": "2015-02-26T19:15:51",
"comment_text": "",
"python_version": "3.4",
"url": "https://pypi.python.org/packages/3.4/s/setuptools/setuptools-12.3-py2.py3-none-any.whl", # NOQA
"md5_digest": "31f51a38497a70efadf5ce8d4c2211ab",
"downloads": 288451,
"filename": "setuptools-12.3-py2.py3-none-any.whl",
"packagetype": "bdist_wheel",
"size": 501904
},
{
"has_sig": false,
"upload_time": "2015-02-26T19:15:43",
"comment_text": "",
"python_version": "source",
"url": "https://pypi.python.org/packages/source/s/setuptools/setuptools-12.3.tar.gz", # NOQA
"md5_digest": "67614b6d560fa4f240e99cd553ec7f32",
"downloads": 110109,
"filename": "setuptools-12.3.tar.gz",
"packagetype": "sdist",
"size": 635025
},
{
"has_sig": false,
"upload_time": "2015-02-26T19:15:47",
"comment_text": "",
"python_version": "source",
"url": "https://pypi.python.org/packages/source/s/setuptools/setuptools-12.3.zip", # NOQA
"md5_digest": "abc799e7db6e7281535bf342bfc41a12",
"downloads": 67539,
"filename": "setuptools-12.3.zip",
"packagetype": "sdist",
"size": 678783
}
],
"""
url = "https://pypi.python.org/pypi/%s/json" % (package_name,)
resp = urllib.request.urlopen(urllib.request.Request(url))
charset = resp.info().get_content_charset()
reader = codecs.getreader(charset)(resp)
data = json.load(reader)
# Mainly for debug.
json_filename = "%s/%s.json" % (self.dirpath, DISTRIBUTION)
with open(json_filename, 'w') as outfile:
json.dump(
data,
outfile,
sort_keys=True,
indent=4,
separators=(',', ': '),
)
return data
def get_setuptools_releases_without_zip_counterpart(self):
# Get set(all_valid_releases) - set(releases_with_zip), so now we have
# the releases without zip.
return set(self.valid_releases_numbers) - set([
release
for release in self.valid_releases_numbers
for same_version_release_dict in self.data_json_setuptools['releases'][release] # NOQA
if 'zip' in same_version_release_dict['filename']
])
def download_setuptools_releases_without_zip_counterpart(self):
try:
releases_without_zip = self.get_setuptools_releases_without_zip_counterpart() # NOQA
failed_md5_releases = []
# This is a "strange" loop, going through all releases and
# testing only the release I need to download, but I thought it
# would be mouch more readable than trying to iterate through
# releases I need and get into traverse hell values inside dicts
# inside dicts of the json to get the distribution's url to
# download.
for release in self.valid_releases_numbers:
if release in releases_without_zip:
for same_version_release_dict in self.data_json_setuptools['releases'][release]: # NOQA
if 'tar.gz' in same_version_release_dict['filename']:
print("Downloading %s..." % release)
local_file = '%s/%s' % (
self.dirpath,
same_version_release_dict["filename"]
)
urllib.request.urlretrieve(
same_version_release_dict["url"],
local_file
)
targz = open(local_file, 'rb').read()
hexdigest = hashlib.md5(targz).hexdigest()
if (hexdigest != same_version_release_dict['md5_digest']): # NOQA
print(FAIL + "FAIL: md5 for %s didn't match!" % release + END) # NOQA
failed_md5_releases.append(release)
else:
self.total_downloaded_ok += 1
print('Total releases without zip: %s' % len(releases_without_zip))
print('Total downloaded: %s' % self.total_downloaded_ok)
if failed_md5_releases:
msg = FAIL + (
"FAIL: these releases %s failed the md5 check!" %
','.join(failed_md5_releases)
) + END
raise Exception(msg)
elif self.total_downloaded_ok != len(releases_without_zip):
msg = FAIL + (
"FAIL: Unknown error occured. Please check the logs."
) + END
raise Exception(msg)
else:
print(OK + "All releases downloaded and md5 checked." + END)
except OSError as e:
if e.errno != errno.EEXIST:
raise e
def convert_targz_to_zip(self):
print("Converting the tar.gz to zip...")
files = glob.glob('%s/*.tar.gz' % self.dirpath)
total_converted = 0
for targz in sorted(files, key=LooseVersion):
# Extract and remove tar.
tar = tarfile.open(targz)
tar.extractall(path=self.dirpath)
tar.close()
os.remove(targz)
# Zip the extracted tar.
setuptools_folder_path = targz.replace('.tar.gz', '')
setuptools_folder_name = setuptools_folder_path.split("/")[-1]
print(setuptools_folder_name)
shutil.make_archive(
setuptools_folder_path,
'zip',
self.dirpath,
setuptools_folder_name
)
# Exclude extracted tar folder.
shutil.rmtree(setuptools_folder_path.replace('.zip', ''))
total_converted += 1
print('Total converted: %s' % total_converted)
if self.total_downloaded_ok != total_converted:
msg = FAIL + (
"FAIL: Total number of downloaded releases is different"
" from converted ones. Please check the logs."
) + END
raise Exception(msg)
print("Done with the tar.gz->zip. Check folder %s." % main.dirpath)
def upload_zips_to_pypi(self):
print('Uploading to pypi...')
zips = sorted(glob.glob('%s/*.zip' % self.dirpath), key=LooseVersion)
print("simulated upload of", zips); return
upload.upload(dists=zips)
if __name__ == '__main__':
main = SetuptoolsOldReleasesWithoutZip()
main.download_setuptools_releases_without_zip_counterpart()
main.convert_targz_to_zip()
main.upload_zips_to_pypi()
......@@ -59,7 +59,8 @@ force_windows_specific_files = (
os.environ.get("SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES")
not in (None, "", "0")
)
if sys.platform == 'win32' or force_windows_specific_files:
if (sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt')) \
or force_windows_specific_files:
package_data.setdefault('setuptools', []).extend(['*.exe'])
package_data.setdefault('setuptools.command', []).extend(['*.xml'])
......@@ -75,7 +76,6 @@ setup_params = dict(
"Python packages",
author="Python Packaging Authority",
author_email="distutils-sig@python.org",
license="PSF or ZPL",
long_description=long_description,
keywords="CPAN PyPI distutils eggs package management",
url="https://bitbucket.org/pypa/setuptools",
......@@ -134,8 +134,7 @@ setup_params = dict(
classifiers=textwrap.dedent("""
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Python Software Foundation License
License :: OSI Approved :: Zope Public License
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
......
......@@ -8,7 +8,7 @@ from distutils.core import Command as _Command
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools.extern.six.moves import filterfalse
from setuptools.extern.six.moves import filterfalse, map
import setuptools.version
from setuptools.extension import Extension
......
......@@ -2,7 +2,7 @@ __all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts',
'register', 'bdist_wininst', 'upload_docs',
'register', 'bdist_wininst', 'upload_docs', 'upload',
]
from distutils.command.bdist import bdist
......
from distutils.errors import DistutilsOptionError
from setuptools.extern.six.moves import map
from setuptools.command.setopt import edit_config, option_base, config_file
......
......@@ -9,6 +9,7 @@ import distutils.errors
import collections
import itertools
from setuptools.extern.six.moves import map
try:
from setuptools.lib2to3_ex import Mixin2to3
......@@ -59,9 +60,10 @@ class build_py(orig.build_py, Mixin2to3):
self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0))
def __getattr__(self, attr):
if attr == 'data_files': # lazily compute data files
self.data_files = files = self._get_data_files()
return files
"lazily compute data files"
if attr == 'data_files':
self.data_files = self._get_data_files()
return self.data_files
return orig.build_py.__getattr__(self, attr)
def build_module(self, module, module_file, package):
......@@ -74,23 +76,21 @@ class build_py(orig.build_py, Mixin2to3):
def _get_data_files(self):
"""Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
self.analyze_manifest()
data = []
for package in self.packages or ():
return list(map(self._get_pkg_data_files, self.packages or ()))
def _get_pkg_data_files(self, package):
# Locate package source directory
src_dir = self.get_package_dir(package)
# Compute package build directory
build_dir = os.path.join(*([self.build_lib] + package.split('.')))
# Length of path to strip from found files
plen = len(src_dir) + 1
# Strip directory from globbed filenames
filenames = [
file[plen:] for file in self.find_data_files(package, src_dir)
os.path.relpath(file, src_dir)
for file in self.find_data_files(package, src_dir)
]
data.append((package, src_dir, build_dir, filenames))
return data
return package, src_dir, build_dir, filenames
def find_data_files(self, package, src_dir):
"""Return filenames for package's data files in 'src_dir'"""
......
......@@ -41,7 +41,7 @@ import shlex
import io
from setuptools.extern import six
from setuptools.extern.six.moves import configparser
from setuptools.extern.six.moves import configparser, map
from setuptools import Command
from setuptools.sandbox import run_setup
......@@ -1876,17 +1876,6 @@ def chmod(path, mode):
log.debug("chmod failed: %s", e)
def fix_jython_executable(executable, options):
warnings.warn("Use JythonCommandSpec", DeprecationWarning, stacklevel=2)
if not JythonCommandSpec.relevant():
return executable
cmd = CommandSpec.best().from_param(executable)
cmd.install_options(options)
return cmd.as_header().lstrip('#!').rstrip('\n')
class CommandSpec(list):
"""
A command spec for a #! header, specified as a list of arguments akin to
......@@ -1901,7 +1890,7 @@ class CommandSpec(list):
"""
Choose the best CommandSpec class based on environmental conditions.
"""
return cls if not JythonCommandSpec.relevant() else JythonCommandSpec
return cls
@classmethod
def _sys_executable(cls):
......@@ -1968,36 +1957,6 @@ class WindowsCommandSpec(CommandSpec):
split_args = dict(posix=False)
class JythonCommandSpec(CommandSpec):
@classmethod
def relevant(cls):
return (
sys.platform.startswith('java')
and
__import__('java').lang.System.getProperty('os.name') != 'Linux'
)
def as_header(self):
"""
Workaround Jython's sys.executable being a .sh (an invalid
shebang line interpreter)
"""
if not is_sh(self[0]):
return super(JythonCommandSpec, self).as_header()
if self.options:
# Can't apply the workaround, leave it broken
log.warn(
"WARNING: Unable to adapt shebang line for Jython,"
" the following script is NOT executable\n"
" see http://bugs.jython.org/issue1112 for"
" more information.")
return super(JythonCommandSpec, self).as_header()
items = ['/usr/bin/env'] + self + list(self.options)
return self._render(items)
class ScriptWriter(object):
"""
Encapsulates behavior around writing entry point scripts for console and
......@@ -2074,7 +2033,10 @@ class ScriptWriter(object):
"""
Select the best ScriptWriter for this environment.
"""
return WindowsScriptWriter.best() if sys.platform == 'win32' else cls
if sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt'):
return WindowsScriptWriter.best()
else:
return cls
@classmethod
def _get_script_args(cls, type_, name, header, script_text):
......
......@@ -15,6 +15,7 @@ import warnings
import time
from setuptools.extern import six
from setuptools.extern.six.moves import map
from setuptools import Command
from setuptools.command.sdist import sdist
......
from distutils import log, dir_util
import os
from setuptools.extern.six.moves import map
from setuptools import Command
from setuptools.archive_util import unpack_archive
import pkg_resources
......@@ -27,7 +29,7 @@ class install_egg_info(Command):
).egg_name() + '.egg-info'
self.source = ei_cmd.egg_info
self.target = os.path.join(self.install_dir, basename)
self.outputs = [self.target]
self.outputs = []
def run(self):
self.run_command('egg_info')
......
......@@ -3,6 +3,7 @@ from unittest import TestLoader
import sys
from setuptools.extern import six
from setuptools.extern.six.moves import map
from pkg_resources import (resource_listdir, resource_exists, normalize_path,
working_set, _namespace_packages,
......
from distutils.command import upload as orig
class upload(orig.upload):
"""
Override default upload behavior to look up password
in the keyring if available.
"""
def finalize_options(self):
orig.upload.finalize_options(self)
self.password or self._load_password_from_keyring()
def _load_password_from_keyring(self):
"""
Attempt to load password from keyring. Suppress Exceptions.
"""
try:
keyring = __import__('keyring')
self.password = keyring.get_password(self.repository,
self.username)
except Exception:
pass
......@@ -8,18 +8,17 @@ PyPI's pythonhosted.org).
from base64 import standard_b64encode
from distutils import log
from distutils.errors import DistutilsOptionError
from distutils.command.upload import upload
import os
import socket
import zipfile
import tempfile
import sys
import shutil
from setuptools.extern import six
from setuptools.extern.six.moves import http_client, urllib
from pkg_resources import iter_entry_points
from .upload import upload
errors = 'surrogateescape' if six.PY3 else 'strict'
......
......@@ -14,6 +14,7 @@ from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
from setuptools.extern import six
from setuptools.extern.six.moves import map
from pkg_resources.extern import packaging
from setuptools.depends import Require
......
......@@ -5,6 +5,8 @@ import distutils.core
import distutils.errors
import distutils.extension
from setuptools.extern.six.moves import map
from .dist import _get_unpatched
from . import msvc9_support
......
"""
Launch the Python script on the command line after
setuptools is bootstrapped via import.
"""
# Note that setuptools gets imported implicitly by the
# invocation of this script using python -m setuptools.launch
import tokenize
import sys
def run():
"""
Run the script in sys.argv[1] as if it had
been invoked naturally.
"""
__builtins__
script_name = sys.argv[1]
namespace = dict(
__file__ = script_name,
__name__ = '__main__',
__doc__ = None,
)
sys.argv[:] = sys.argv[1:]
open_ = getattr(tokenize, 'open', open)
script = open_(script_name).read()
norm_script = script.replace('\\r\\n', '\\n')
code = compile(norm_script, script_name, 'exec')
exec(code, namespace)
if __name__ == '__main__':
run()
......@@ -15,7 +15,7 @@ except ImportError:
from urllib2 import splituser
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser
from setuptools.extern.six.moves import urllib, http_client, configparser, map
from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
......
......@@ -9,7 +9,7 @@ import contextlib
import pickle
from setuptools.extern import six
from setuptools.extern.six.moves import builtins
from setuptools.extern.six.moves import builtins, map
import pkg_resources
......@@ -207,8 +207,12 @@ def _needs_hiding(mod_name):
True
>>> _needs_hiding('distutils')
True
>>> _needs_hiding('os')
False
>>> _needs_hiding('Cython')
True
"""
pattern = re.compile('(setuptools|pkg_resources|distutils)(\.|$)')
pattern = re.compile('(setuptools|pkg_resources|distutils|Cython)(\.|$)')
return bool(pattern.match(mod_name))
......
......@@ -3,7 +3,7 @@ import socket
import atexit
import re
from setuptools.extern.six.moves import urllib, http_client
from setuptools.extern.six.moves import urllib, http_client, map
import pkg_resources
from pkg_resources import ResolutionError, ExtractionError
......@@ -25,6 +25,7 @@ cert_paths = """
/usr/local/share/certs/ca-root.crt
/etc/ssl/cert.pem
/System/Library/OpenSSL/certs/cert.pem
/usr/local/share/certs/ca-root-nss.crt
""".strip().split()
......
......@@ -6,6 +6,7 @@ import contextlib
import site
from setuptools.extern import six
import pkg_resources
@contextlib.contextmanager
......@@ -77,6 +78,18 @@ def save_user_site_setting():
site.ENABLE_USER_SITE = saved
@contextlib.contextmanager
def save_pkg_resources_state():
pr_state = pkg_resources.__getstate__()
# also save sys.path
sys_path = sys.path[:]
try:
yield pr_state, sys_path
finally:
sys.path[:] = sys_path
pkg_resources.__setstate__(pr_state)
@contextlib.contextmanager
def suppress_exceptions(*excs):
try:
......
......@@ -4,6 +4,8 @@ import os
import shutil
import tempfile
from setuptools.extern.six.moves import map
import pytest
import pkg_resources
......
......@@ -18,6 +18,7 @@ import io
from setuptools.extern import six
from setuptools.extern.six.moves import urllib
import time
import pytest
try:
......@@ -310,32 +311,32 @@ class TestSetupRequires:
"""
with contexts.tempdir() as dir:
dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
script = DALS("""
make_sdist(dist_path, [
('setup.py', DALS("""
import setuptools
setuptools.setup(
name="setuptools-test-fetcher",
version="1.0",
setup_requires = ['does-not-exist'],
)
""")
make_trivial_sdist(dist_path, script)
"""))])
yield dist_path
def test_setup_requires_overrides_version_conflict(self):
"""
Regression test for issue #323.
Regression test for distribution issue 323:
https://bitbucket.org/tarek/distribute/issues/323
Ensures that a distribution's setup_requires requirements can still be
installed and used locally even if a conflicting version of that
requirement is already on the path.
"""
pr_state = pkg_resources.__getstate__()
fake_dist = PRDistribution('does-not-matter', project_name='foobar',
version='0.0')
working_set.add(fake_dist)
try:
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
test_pkg = create_setup_requires_package(temp_dir)
test_setup_py = os.path.join(test_pkg, 'setup.py')
......@@ -347,19 +348,144 @@ class TestSetupRequires:
lines = stdout.readlines()
assert len(lines) > 0
assert lines[-1].strip(), 'test_pkg'
finally:
pkg_resources.__setstate__(pr_state)
def test_setup_requires_override_nspkg(self):
"""
Like ``test_setup_requires_overrides_version_conflict`` but where the
``setup_requires`` package is part of a namespace package that has
*already* been imported.
"""
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz')
make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1')
# Now actually go ahead an extract to the temp dir and add the
# extracted path to sys.path so foo.bar v0.1 is importable
foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1')
os.mkdir(foobar_1_dir)
with tarfile_open(foobar_1_archive) as tf:
tf.extractall(foobar_1_dir)
sys.path.insert(1, foobar_1_dir)
dist = PRDistribution(foobar_1_dir, project_name='foo.bar',
version='0.1')
working_set.add(dist)
template = DALS("""\
import foo # Even with foo imported first the
# setup_requires package should override
import setuptools
setuptools.setup(**%r)
if not (hasattr(foo, '__path__') and
len(foo.__path__) == 2):
print('FAIL')
if 'foo.bar-0.2' not in foo.__path__[0]:
print('FAIL')
""")
test_pkg = create_setup_requires_package(
temp_dir, 'foo.bar', '0.2', make_nspkg_sdist, template)
test_setup_py = os.path.join(test_pkg, 'setup.py')
with contexts.quiet() as (stdout, stderr):
try:
# Don't even need to install the package, just
# running the setup.py at all is sufficient
run_setup(test_setup_py, ['--name'])
except pkg_resources.VersionConflict:
self.fail('Installing setup.py requirements '
'caused a VersionConflict')
assert 'FAIL' not in stdout.getvalue()
lines = stdout.readlines()
assert len(lines) > 0
assert lines[-1].strip() == 'test_pkg'
def make_trivial_sdist(dist_path, distname, version):
"""
Create a simple sdist tarball at dist_path, containing just a simple
setup.py.
"""
make_sdist(dist_path, [
('setup.py',
DALS("""\
import setuptools
setuptools.setup(
name=%r,
version=%r
)
""" % (distname, version)))])
def make_nspkg_sdist(dist_path, distname, version):
"""
Make an sdist tarball with distname and version which also contains one
package with the same name as distname. The top-level package is
designated a namespace package).
"""
parts = distname.split('.')
nspackage = parts[0]
packages = ['.'.join(parts[:idx]) for idx in range(1, len(parts) + 1)]
setup_py = DALS("""\
import setuptools
setuptools.setup(
name=%r,
version=%r,
packages=%r,
namespace_packages=[%r]
)
""" % (distname, version, packages, nspackage))
init = "__import__('pkg_resources').declare_namespace(__name__)"
files = [('setup.py', setup_py),
(os.path.join(nspackage, '__init__.py'), init)]
for package in packages[1:]:
filename = os.path.join(*(package.split('.') + ['__init__.py']))
files.append((filename, ''))
make_sdist(dist_path, files)
def create_setup_requires_package(path):
def make_sdist(dist_path, files):
"""
Create a simple sdist tarball at dist_path, containing the files
listed in ``files`` as ``(filename, content)`` tuples.
"""
with tarfile_open(dist_path, 'w:gz') as dist:
for filename, content in files:
file_bytes = io.BytesIO(content.encode('utf-8'))
file_info = tarfile.TarInfo(name=filename)
file_info.size = len(file_bytes.getvalue())
file_info.mtime = int(time.time())
dist.addfile(file_info, fileobj=file_bytes)
def create_setup_requires_package(path, distname='foobar', version='0.1',
make_package=make_trivial_sdist,
setup_py_template=None):
"""Creates a source tree under path for a trivial test package that has a
single requirement in setup_requires--a tarball for that requirement is
also created and added to the dependency_links argument.
``distname`` and ``version`` refer to the name/version of the package that
the test package requires via ``setup_requires``. The name of the test
package itself is just 'test_pkg'.
"""
test_setup_attrs = {
'name': 'test_pkg', 'version': '0.0',
'setup_requires': ['foobar==0.1'],
'setup_requires': ['%s==%s' % (distname, version)],
'dependency_links': [os.path.abspath(path)]
}
......@@ -367,22 +493,17 @@ def create_setup_requires_package(path):
test_setup_py = os.path.join(test_pkg, 'setup.py')
os.mkdir(test_pkg)
with open(test_setup_py, 'w') as f:
f.write(DALS("""
if setup_py_template is None:
setup_py_template = DALS("""\
import setuptools
setuptools.setup(**%r)
""" % test_setup_attrs))
""")
foobar_path = os.path.join(path, 'foobar-0.1.tar.gz')
make_trivial_sdist(
foobar_path,
DALS("""
import setuptools
setuptools.setup(
name='foobar',
version='0.1'
)
"""))
with open(test_setup_py, 'w') as f:
f.write(setup_py_template % test_setup_attrs)
foobar_path = os.path.join(path, '%s-%s.tar.gz' % (distname, version))
make_package(foobar_path, distname, version)
return test_pkg
......@@ -427,51 +548,6 @@ class TestScriptHeader:
expected = '#!"%s"\n' % self.exe_with_spaces
assert actual == expected
@pytest.mark.xfail(
six.PY3 and is_ascii,
reason="Test fails in this locale on Python 3"
)
@mock.patch.dict(sys.modules, java=mock.Mock(lang=mock.Mock(System=
mock.Mock(getProperty=mock.Mock(return_value="")))))
@mock.patch('sys.platform', 'java1.5.0_13')
def test_get_script_header_jython_workaround(self, tmpdir):
# Create a mock sys.executable that uses a shebang line
header = DALS("""
#!/usr/bin/python
# -*- coding: utf-8 -*-
""")
exe = tmpdir / 'exe.py'
with exe.open('w') as f:
f.write(header)
exe = ei.nt_quote_arg(os.path.normpath(str(exe)))
# Make sure Windows paths are quoted properly before they're sent
# through shlex.split by get_script_header
executable = '"%s"' % exe if os.path.splitdrive(exe)[0] else exe
header = ei.ScriptWriter.get_script_header('#!/usr/local/bin/python',
executable=executable)
assert header == '#!/usr/bin/env %s\n' % exe
expect_out = 'stdout' if sys.version_info < (2,7) else 'stderr'
with contexts.quiet() as (stdout, stderr):
# When options are included, generate a broken shebang line
# with a warning emitted
candidate = ei.ScriptWriter.get_script_header('#!/usr/bin/python -x',
executable=executable)
assert candidate == '#!%s -x\n' % exe
output = locals()[expect_out]
assert 'Unable to adapt shebang line' in output.getvalue()
with contexts.quiet() as (stdout, stderr):
candidate = ei.ScriptWriter.get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe)
assert candidate == '#!%s -x\n' % self.non_ascii_exe
output = locals()[expect_out]
assert 'Unable to adapt shebang line' in output.getvalue()
class TestCommandSpec:
def test_custom_launch_command(self):
......
import os
import stat
from setuptools.extern.six.moves import map
import pytest
from . import environment
......
......@@ -10,6 +10,7 @@ import contextlib
import io
from setuptools.extern import six
from setuptools.extern.six.moves import map
import pytest
......
from setuptools import unicode_utils
def test_filesys_decode_fs_encoding_is_None(monkeypatch):
"""
Test filesys_decode does not raise TypeError when
getfilesystemencoding returns None.
"""
monkeypatch.setattr('sys.getfilesystemencoding', lambda: None)
unicode_utils.filesys_decode(b'test')
......@@ -22,11 +22,13 @@ def filesys_decode(path):
NONE when no expected encoding works
"""
fs_enc = sys.getfilesystemencoding()
if isinstance(path, six.text_type):
return path
for enc in (fs_enc, "utf-8"):
fs_enc = sys.getfilesystemencoding() or 'utf-8'
candidates = fs_enc, 'utf-8'
for enc in candidates:
try:
return path.decode(enc)
except UnicodeDecodeError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment