Skip to content

Commit

Permalink
Better handling of older setuptools versions
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Feb 2, 2024
1 parent 3664418 commit 6888abc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions test/spell_check.words
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ hookimpl
hookwrapper
https
importlib
importorskip
isatty
iterdir
junit
Expand All @@ -56,6 +57,7 @@ lineno
linter
linux
lstrip
minversion
mkdtemp
monkeypatch
namedtuple
Expand Down
11 changes: 7 additions & 4 deletions test/test_build_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def _test_build_package(
assert not libexec_pattern or setup_cfg, \
'The libexec pattern requires use of setup.cfg'

if setup_cfg and data_files:
pytest.importorskip('setuptools', minversion='40.5.0')

event_loop = new_event_loop()
asyncio.set_event_loop(event_loop)
try:
Expand All @@ -64,7 +67,7 @@ def _test_build_package(
**(
{
'data_files': [
('share/test-package', ['test-resource']),
('share/test_package', ['test-resource']),
]
} if data_files else {}
)
Expand Down Expand Up @@ -106,7 +109,7 @@ def _test_build_package(
if libexec_pattern else ''
) + (
'[options.data_files]\n'
'share/test-package = test-resource\n'
'share/test_package = test-resource\n'
if data_files else ''
)
)
Expand All @@ -121,7 +124,7 @@ def _test_build_package(
' },\n'
+ (
' data_files=[\n'
' ("share/test-package", [\n'
' ("share/test_package", [\n'
' "test-resource",\n'
' ]),\n'
' ],\n'
Expand Down Expand Up @@ -158,7 +161,7 @@ def _test_build_package(
any(install_base.rglob('bin/my_command*')) or
any(install_base.rglob('Scripts/my_command*')))
assert data_files == any(install_base.rglob(
'share/test-package/test-resource'))
'share/test_package/test-resource'))

if not symlink_install:
pkg_info, = install_base.rglob('PKG-INFO')
Expand Down

0 comments on commit 6888abc

Please sign in to comment.