Commit acd94990 authored by Jason R. Coombs's avatar Jason R. Coombs

Merge branch 'master' into issue250-module_from_spec

parents 27b7d4e4 5c940698
v30.4.0
-------
* #879: For declarative config:
- read_configuration() now accepts ignore_option_errors argument. This allows scraping tools to read metadata without a need to download entire packages. E.g. we can gather some stats right from GitHub repos just by downloading setup.cfg.
- packages find: directive now supports fine tuning from a subsection. The same arguments as for find() are accepted.
v30.3.0
-------
* #394 via #862: Added support for `declarative package
config in a setup.cfg file
<http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files>`_.
v30.2.1
-------
* #850: In test command, invoke unittest.main with
indication not to exit the process.
v30.2.0 v30.2.0
------- -------
......
...@@ -139,10 +139,10 @@ Package Index`_. Scroll to the very bottom of the page to find the links. ...@@ -139,10 +139,10 @@ Package Index`_. Scroll to the very bottom of the page to find the links.
.. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools .. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools
In addition to the PyPI downloads, the development version of ``setuptools`` In addition to the PyPI downloads, the development version of ``setuptools``
is available from the `Bitbucket repo`_, and in-development versions of the is available from the `GitHub repo`_, and in-development versions of the
`0.6 branch`_ are available as well. `0.6 branch`_ are available as well.
.. _Bitbucket repo: https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev .. _GitHub repo: https://github.com/pypa/setuptools/archive/master.tar.gz#egg=setuptools-dev
.. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06 .. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
Uninstalling Uninstalling
......
import os
pytest_plugins = 'setuptools.tests.fixtures' pytest_plugins = 'setuptools.tests.fixtures'
...@@ -9,17 +6,3 @@ def pytest_addoption(parser): ...@@ -9,17 +6,3 @@ def pytest_addoption(parser):
"--package_name", action="append", default=[], "--package_name", action="append", default=[],
help="list of package_name to pass to test functions", help="list of package_name to pass to test functions",
) )
def pytest_configure():
_issue_852_workaround()
def _issue_852_workaround():
"""
Patch 'setuptools.__file__' with an absolute path
for forward compatibility with Python 3.
Workaround for https://github.com/pypa/setuptools/issues/852
"""
setuptools = __import__('setuptools')
setuptools.__file__ = os.path.abspath(setuptools.__file__)
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
<h3>Questions? Suggestions? Contributions?</h3> <h3>Questions? Suggestions? Contributions?</h3>
<p>Visit the <a href="https://bitbucket.org/pypa/setuptools">Setuptools project page</a> </p> <p>Visit the <a href="https://github.com/pypa/setuptools">Setuptools project page</a> </p>
...@@ -16,10 +16,10 @@ Documentation content: ...@@ -16,10 +16,10 @@ Documentation content:
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
history
roadmap
python3
setuptools setuptools
easy_install easy_install
pkg_resources pkg_resources
python3
development development
roadmap
history
...@@ -2398,6 +2398,211 @@ The ``upload_docs`` command has the following options: ...@@ -2398,6 +2398,211 @@ The ``upload_docs`` command has the following options:
https://pypi.python.org/pypi (i.e., the main PyPI installation). https://pypi.python.org/pypi (i.e., the main PyPI installation).
-----------------------------------------
Configuring setup() using setup.cfg files
-----------------------------------------
``Setuptools`` allows using configuration files (usually `setup.cfg`)
to define package’s metadata and other options which are normally supplied
to ``setup()`` function.
This approach not only allows automation scenarios, but also reduces
boilerplate code in some cases.
.. note::
Implementation presents limited compatibility with distutils2-like
``setup.cfg`` sections (used by ``pbr`` and ``d2to1`` packages).
Namely: only metadata related keys from ``metadata`` section are supported
(except for ``description-file``); keys from ``files``, ``entry_points``
and ``backwards_compat`` are not supported.
.. code-block:: ini
[metadata]
name = my_package
version = attr: src.VERSION
description = My package description
long_description = file: README.rst
keywords = one, two
license = BSD 3-Clause License
[metadata.classifiers]
Framework :: Django
Programming Language :: Python :: 3.5
[options]
zip_safe = False
include_package_data = True
packages = find:
scripts =
bin/first.py
bin/second.py
[options.package_data]
* = *.txt, *.rst
hello = *.msg
[options.extras_require]
pdf = ReportLab>=1.2; RXP
rest = docutils>=0.3; pack ==1.1, ==1.3
[options.packages.find]
exclude =
src.subpackage1
src.subpackage2
Metadata and options could be set in sections with the same names.
* Keys are the same as keyword arguments one provides to ``setup()`` function.
* Complex values could be placed comma-separated or one per line
in *dangling* sections. The following are the same:
.. code-block:: ini
[metadata]
keywords = one, two
[metadata]
keywords =
one
two
* In some cases complex values could be provided in subsections for clarity.
* Some keys allow ``file:``, ``attr:`` and ``find:`` directives to cover
common usecases.
* Unknown keys are ignored.
Specifying values
=================
Some values are treated as simple strings, some allow more logic.
Type names used below:
* ``str`` - simple string
* ``list-comma`` - dangling list or comma-separated values string
* ``list-semi`` - dangling list or semicolon-separated values string
* ``bool`` - ``True`` is 1, yes, true
* ``dict`` - list-comma where keys from values are separated by =
* ``section`` - values could be read from a dedicated (sub)section
Special directives:
* ``attr:`` - value could be read from module attribute
* ``file:`` - value could be read from a file
.. note::
``file:`` directive is sandboxed and won't reach anything outside
directory with ``setup.py``.
Metadata
--------
.. note::
Aliases given below are supported for compatibility reasons,
but not advised.
================= ================= =====
Key Aliases Accepted value type
================= ================= =====
name str
version attr:, str
url home-page str
download_url download-url str
author str
author_email author-email str
maintainer str
maintainer_email maintainer-email str
classifiers classifier file:, section, list-comma
license file:, str
description summary file:, str
long_description long-description file:, str
keywords list-comma
platforms platform list-comma
provides list-comma
requires list-comma
obsoletes list-comma
================= ================= =====
.. note::
**version** - ``attr:`` supports callables; supports iterables;
unsupported types are casted using ``str()``.
Options
-------
======================= =====
Key Accepted value type
======================= =====
zip_safe bool
setup_requires list-semi
install_requires list-semi
extras_require section
entry_points file:, section
use_2to3 bool
use_2to3_fixers list-comma
use_2to3_exclude_fixers list-comma
convert_2to3_doctests list-comma
scripts list-comma
eager_resources list-comma
dependency_links list-comma
tests_require list-semi
include_package_data bool
packages find:, list-comma
package_dir dict
package_data section
exclude_package_data section
namespace_packages list-comma
======================= =====
.. note::
**packages** - ``find:`` directive can be further configured
in a dedicated subsection `options.packages.find`. This subsection
accepts the same keys as `setuptools.find` function:
`where`, `include`, `exclude`.
Configuration API
=================
Some automation tools may wish to access data from a configuration file.
``Setuptools`` exposes ``read_configuration()`` function allowing
parsing ``metadata`` and ``options`` sections into a dictionary.
.. code-block:: python
from setuptools.config import read_configuration
conf_dict = read_configuration('/home/user/dev/package/setup.cfg')
By default ``read_configuration()`` will read only file provided
in the first argument. To include values from other configuration files
which could be in various places set `find_others` function argument
to ``True``.
If you have only a configuration file but not the whole package you can still
try to get data out of it with the help of `ignore_option_errors` function
argument. When it is set to ``True`` all options with errors possibly produced
by directives, such as ``attr:`` and others will be silently ignored.
As a consequence the resulting dictionary will include no such options.
-------------------------------- --------------------------------
Extending and Reusing Setuptools Extending and Reusing Setuptools
-------------------------------- --------------------------------
......
[bumpversion] [bumpversion]
current_version = 30.2.0 current_version = 30.4.0
commit = True commit = True
tag = True tag = True
......
...@@ -85,7 +85,7 @@ def pypi_link(pkg_filename): ...@@ -85,7 +85,7 @@ def pypi_link(pkg_filename):
setup_params = dict( setup_params = dict(
name="setuptools", name="setuptools",
version="30.2.0", version="30.4.0",
description="Easily download, build, install, upgrade, and uninstall " description="Easily download, build, install, upgrade, and uninstall "
"Python packages", "Python packages",
author="Python Packaging Authority", author="Python Packaging Authority",
......
...@@ -219,7 +219,7 @@ class build_py(orig.build_py, Mixin2to3): ...@@ -219,7 +219,7 @@ class build_py(orig.build_py, Mixin2to3):
@staticmethod @staticmethod
def _get_platform_patterns(spec, package, src_dir): def _get_platform_patterns(spec, package, src_dir):
""" """
yield platfrom-specific path patterns (suitable for glob yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data) self.package_data or self.exclude_package_data)
matching package in src_dir. matching package in src_dir.
......
...@@ -225,10 +225,12 @@ class test(Command): ...@@ -225,10 +225,12 @@ class test(Command):
del_modules.append(name) del_modules.append(name)
list(map(sys.modules.__delitem__, del_modules)) list(map(sys.modules.__delitem__, del_modules))
exit_kwarg = {} if sys.version_info < (2, 7) else {"exit": False}
unittest_main( unittest_main(
None, None, self._argv, None, None, self._argv,
testLoader=self._resolve_as_ep(self.test_loader), testLoader=self._resolve_as_ep(self.test_loader),
testRunner=self._resolve_as_ep(self.test_runner), testRunner=self._resolve_as_ep(self.test_runner),
**exit_kwarg
) )
@property @property
......
This diff is collapsed.
...@@ -19,6 +19,7 @@ from pkg_resources.extern import packaging ...@@ -19,6 +19,7 @@ from pkg_resources.extern import packaging
from setuptools.depends import Require from setuptools.depends import Require
from setuptools import windows_support from setuptools import windows_support
from setuptools.monkey import get_unpatched from setuptools.monkey import get_unpatched
from setuptools.config import parse_configuration
import pkg_resources import pkg_resources
...@@ -342,6 +343,15 @@ class Distribution(_Distribution): ...@@ -342,6 +343,15 @@ class Distribution(_Distribution):
if getattr(self, 'python_requires', None): if getattr(self, 'python_requires', None):
self.metadata.python_requires = self.python_requires self.metadata.python_requires = self.python_requires
def parse_config_files(self, filenames=None):
"""Parses configuration files from various levels
and loads configuration.
"""
_Distribution.parse_config_files(self, filenames=filenames)
parse_configuration(self, self.command_options)
def parse_command_line(self): def parse_command_line(self):
"""Process features after parsing command line options""" """Process features after parsing command line options"""
result = _Distribution.parse_command_line(self) result = _Distribution.parse_command_line(self)
......
...@@ -56,5 +56,5 @@ def run_setup_py(cmd, pypath=None, path=None, ...@@ -56,5 +56,5 @@ def run_setup_py(cmd, pypath=None, path=None,
data = data.decode() data = data.decode()
data = unicodedata.normalize('NFC', data) data = unicodedata.normalize('NFC', data)
# communciate calls wait() # communicate calls wait()
return proc.returncode, data return proc.returncode, data
This diff is collapsed.
...@@ -237,7 +237,7 @@ class TestEggInfo(object): ...@@ -237,7 +237,7 @@ class TestEggInfo(object):
pkginfo = os.path.join(egg_info_dir, 'PKG-INFO') pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n') assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n')
def test_manifest_maker_warning_suppresion(self): def test_manifest_maker_warning_suppression(self):
fixtures = [ fixtures = [
"standard file not found: should have one of foo.py, bar.py", "standard file not found: should have one of foo.py, bar.py",
"standard file 'setup.py' not found" "standard file 'setup.py' not found"
......
[testenv] [testenv]
deps=-rtests/requirements.txt deps=-rtests/requirements.txt
passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR
commands=python -m pytest {posargs:-rsx} commands=py.test {posargs:-rsx}
usedevelop=True
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