Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit path when building sdist package #1687

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def main() -> None:
# This is now the new package dir
args.package_dir = project_dir.resolve()

with chdir(temp_dir):
with chdir(project_dir):
build_in_directory(args)
finally:
# avoid https://github.com/python/cpython/issues/86962 by performing
Expand Down
15 changes: 14 additions & 1 deletion test/test_from_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,23 @@ def test_simple(tmp_path):
sdist_dir.mkdir()
sdist_path = make_sdist(basic_project, sdist_dir)

setup_py_assertion_snippet = textwrap.dedent(
"""
import os

assert os.path.exists('setup.py')
assert os.path.exists('{package}/setup.py')
""",
)
setup_py_assertion_cmd = f'python3 -c "{setup_py_assertion_snippet !s}"'

# build the wheels from sdist
actual_wheels = cibuildwheel_from_sdist_run(
sdist_path,
add_env={"CIBW_BUILD": "cp39-*"},
add_env={
"CIBW_BEFORE_BUILD": setup_py_assertion_cmd,
"CIBW_BUILD": "cp39-*",
},
)

# check that the expected wheels are produced
Expand Down