Skip to content

Commit 6782164

Browse files
henryiiilayday
andcommitted
chore: minor cleanups from pypa#361
Co-authored-by: layday <[email protected]>
1 parent 05f8df0 commit 6782164

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ jobs:
2929
- name: Setup run environment
3030
run: tox -vv --notest -e docs
3131

32-
- name: Run check for type
32+
- name: Run check for docs
3333
run: tox -e docs --skip-pkg-install

.readthedocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
version: 2
22

3+
build:
4+
os: ubuntu-20.04
5+
tools:
6+
python: '3.10'
7+
38
python:
4-
version: 3.8
59
install:
610
- method: pip
711
path: .

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test =
6464
typing =
6565
importlib-metadata>=4.6.4
6666
mypy==0.942
67-
typing-extensions>=3.7.4.3
67+
typing-extensions>=3.7.4.3;python_version < "3.8"
6868
virtualenv =
6969
virtualenv>=20.0.35
7070

src/build/__init__.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
build - A simple, correct PEP 517 build frontend
55
"""
6+
67
__version__ = '0.7.0'
78

89
import contextlib
@@ -24,6 +25,7 @@
2425
Callable,
2526
Dict,
2627
Iterator,
28+
List,
2729
Mapping,
2830
MutableMapping,
2931
Optional,
@@ -71,18 +73,18 @@
7173
}
7274

7375

74-
_logger = logging.getLogger('build')
76+
_logger = logging.getLogger(__name__)
7577

7678

7779
class BuildException(Exception):
7880
"""
79-
Exception raised by ProjectBuilder
81+
Exception raised by :class:`ProjectBuilder`
8082
"""
8183

8284

8385
class BuildBackendException(Exception):
8486
"""
85-
Exception raised when the backend fails
87+
Exception raised when a backend operation fails
8688
"""
8789

8890
def __init__(
@@ -131,7 +133,7 @@ def __str__(self) -> str:
131133

132134
class TypoWarning(Warning):
133135
"""
134-
Warning raised when a potential typo is found
136+
Warning raised when a possible typo is found
135137
"""
136138

137139

@@ -428,12 +430,13 @@ def build(
428430

429431
def metadata_path(self, output_directory: PathType) -> str:
430432
"""
431-
Generates the metadata directory of a distribution and returns its path.
433+
Generate the metadata directory of a distribution and return its path.
432434
433435
If the backend does not support the ``prepare_metadata_for_build_wheel``
434-
hook, a wheel will be built and the metadata extracted.
436+
hook, a wheel will be built and the metadata will be extracted from it.
435437
436438
:param output_directory: Directory to put the metadata distribution in
439+
:returns: The path of the metadata directory
437440
"""
438441
# prepare_metadata hook
439442
metadata = self.prepare('wheel', output_directory)
@@ -491,20 +494,20 @@ def _handle_backend(self, hook: str) -> Iterator[None]:
491494
@staticmethod
492495
def log(message: str) -> None:
493496
"""
494-
Prints message
497+
Log a message.
495498
496499
The default implementation uses the logging module but this function can be
497-
overwritten by users to have a different implementation.
500+
overridden by users to have a different implementation.
498501
499-
:param msg: Message to output
502+
:param message: Message to output
500503
"""
501504
if sys.version_info >= (3, 8):
502505
_logger.log(logging.INFO, message, stacklevel=2)
503506
else:
504507
_logger.log(logging.INFO, message)
505508

506509

507-
__all__ = (
510+
__all__ = [
508511
'__version__',
509512
'BuildBackendException',
510513
'BuildException',
@@ -514,4 +517,8 @@ def log(message: str) -> None:
514517
'RunnerType',
515518
'TypoWarning',
516519
'check_dependency',
517-
)
520+
]
521+
522+
523+
def __dir__() -> List[str]:
524+
return __all__

src/build/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def _error(msg: str, code: int = 1) -> NoReturn: # pragma: no cover
7878
:param msg: Error message
7979
:param code: Error code
8080
"""
81-
print('{red}ERROR{reset} {}'.format(msg, **_STYLES))
82-
exit(code)
81+
print('{red}ERROR{reset} {}'.format(msg, **_STYLES), file=sys.stderr)
82+
raise SystemExit(code)
8383

8484

8585
class _ProjectBuilder(ProjectBuilder):

0 commit comments

Comments
 (0)