Skip to content

Commit

Permalink
pip 10 and pyproject.toml is required for wheel build
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Jun 26, 2018
1 parent e3572a1 commit 4dd236a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog/850.feature.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PEP-518 support: provide a tox configuration flag ``build`` which can be either ``sdist`` or ``wheel``. For ``sdist`` (default) we build the package as before by using ``python setup.py sdist``. However, when ``wheel`` is enabled now we'll use ``pip wheel`` to build it, and we'll also install wheels in these case into the environments. Note: ``pip`` 10 supports specifying project dependencies (such as ``setuptools-scm``, or a given ``setuptools`` version) via ``pyproject.toml``. Once ``pip`` supports building ``sdist`` to we'll migrate over the ``sdist`` build too. @gaborbernat
PEP-518 support: provide a tox configuration flag ``build`` which can be either ``sdist`` or ``wheel``. For ``sdist`` (default) we build the package as before by using ``python setup.py sdist``. However, when ``wheel`` is enabled now we'll use ``pip wheel`` to build it, and we'll also install wheels in these case into the environments. Note: ``pip`` 10 supports specifying project dependencies (such as ``setuptools-scm``, or a given ``setuptools`` version) via ``pyproject.toml``. Once ``pip`` supports building ``sdist`` to we'll migrate over the ``sdist`` build too.`@gaborbernat <https://github.com/gaborbernat>`_
2 changes: 1 addition & 1 deletion changelog/851.feature.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
While running tox invokes various commands (such as building the package, pip installing dependencies and so on), these were printed in case they failed as Python arrays. Changed the representation to a shell command, allowing the users to quickly replicate/debug the failure on their own. @gaborbernat
While running tox invokes various commands (such as building the package, pip installing dependencies and so on), these were printed in case they failed as Python arrays. Changed the representation to a shell command, allowing the users to quickly replicate/debug the failure on their own.`@gaborbernat <https://github.com/gaborbernat>`_
5 changes: 5 additions & 0 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ and will first lookup global tox settings in this section:
pip wheel . --no-dep
.. note::

wheel should only be used with pip ``10+`` and a ``pyproject.toml``, the build will
fail if either is missing


**Default:** ``sdist``

Expand Down
10 changes: 10 additions & 0 deletions src/tox/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import time

import py
from pkg_resources import get_distribution

import tox
from tox._verlib import IrrationalVersionError, NormalizedVersion
Expand Down Expand Up @@ -492,6 +493,15 @@ def _make_package(self, action, setup):
cwd=self.config.setupdir,
)
elif self.config.build == "wheel":
if NormalizedVersion(get_distribution("pip").version).parts[0][0] > 10:
raise RuntimeError("wheel support requires pip 10 or later")
py_project_toml = self.config.setupdir.join("pyproject.toml")
if not py_project_toml.exists():
raise RuntimeError(
"wheel support requires creating and setting build-requires in {}".format(
py_project_toml
)
)
action.popen(
[
sys.executable,
Expand Down

0 comments on commit 4dd236a

Please sign in to comment.