-
-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
Resolves #2612
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Create session views of the build wheel/sdist into the :ref:`temp_dir` folder - by :user:`gaborbernat`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[build-system] | ||
build-backend = "hatchling.build" | ||
requires = ["hatchling>=1.11.1", "hatch-vcs>=0.2"] | ||
requires = ["hatchling>=1.11.1", "hatch-vcs>=0.2.1"] | ||
|
||
[project] | ||
name = "tox" | ||
|
@@ -24,8 +24,8 @@ dependencies = [ | |
"cachetools>=5.2", | ||
"chardet>=5.1", | ||
"colorama>=0.4.6", | ||
"packaging>=21.3", | ||
"platformdirs>=2.5.4", | ||
"packaging>=22", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gaborbernat
Author
Member
|
||
"platformdirs>=2.6", | ||
"pluggy>=1", | ||
"pyproject-api>=1.2.1", | ||
'tomli>=2.0.1; python_version < "3.11"', | ||
|
@@ -35,7 +35,7 @@ dependencies = [ | |
'typing-extensions>=4.4; python_version < "3.8"', | ||
] | ||
optional-dependencies.docs = [ | ||
"furo>=2022.9.29", | ||
"furo>=2022.12.7", | ||
"sphinx>=5.3", | ||
"sphinx-argparse-cli>=1.10", | ||
"sphinx-autodoc-typehints>=1.19.5", | ||
|
@@ -51,7 +51,7 @@ optional-dependencies.testing = [ | |
"diff-cover>=7.2", | ||
"distlib>=0.3.6", | ||
"flaky>=3.7", | ||
"hatch-vcs>=0.2", | ||
"hatch-vcs>=0.2.1", | ||
"hatchling>=1.11.1", | ||
"psutil>=5.9.4", | ||
"pytest>=7.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
import os | ||
import shutil | ||
from itertools import chain | ||
from os.path import commonpath | ||
from pathlib import Path | ||
|
||
|
||
def create_session_view(package: Path, temp_path: Path) -> Path: | ||
"""Allows using the file after you no longer holding a lock to it by moving it into a temp folder""" | ||
# we'll number the active instances, and use the max value as session folder for a new build | ||
# note we cannot change package names as PEP-491 (wheel binary format) | ||
# is strict about file name structure | ||
|
||
temp_path.mkdir(parents=True, exist_ok=True) | ||
exists = [i.name for i in temp_path.iterdir()] | ||
file_id = max(chain((0,), (int(i) for i in exists if str(i).isnumeric()))) | ||
session_dir = temp_path / str(file_id + 1) | ||
session_dir.mkdir() | ||
session_package = session_dir / package.name | ||
|
||
links = False # if we can do hard links do that, otherwise just copy | ||
if hasattr(os, "link"): | ||
try: | ||
os.link(package, session_package) | ||
links = True | ||
except (OSError, NotImplementedError): | ||
pass | ||
if not links: | ||
shutil.copyfile(package, session_package) | ||
operation = "links" if links else "copied" | ||
common = commonpath((session_package, package)) | ||
rel_session, rel_package = session_package.relative_to(common), package.relative_to(common) | ||
logging.debug("package %s %s to %s (%s)", rel_session, operation, rel_package, common) | ||
return session_package |
Is the new version of
packaging
strictly required? I've noticed it breaks some packages (notably setuptools, possibly more; I'm not sure because tracebacks I'm getting are deeply confusing), and since we're unbundling dependencies from setuptools on Gentoo that blocks us from adding it for the time being. I've noticed that all tests pass with 21.3, so either>=22
is unnecessary or the test coverage is incomplete.