fix: correct path when building sdist package (#1687)
* Edit path when building sdist package This patch changes the working directory from the temp to the project when building sdist package.This resolves issues with relative paths in configuration files. Resolves #1683 * Add a test for the `package` placeholder exposure The change extends the existing test — `test_simple`. It checks that the temporary wheel build directory is the project root extracted from the source distribution. It does so by testing the presence of the `setup.py` in the current working directory, as a side effect. * Edit quotes in the CLI argument for Windows compatibility Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua> * Use single quotes to avoid syntax errors from f-string Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua> --------- Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
This commit is contained in:
co-authored by
Sviatoslav Sydorenko
parent
c0e4b16ab9
commit
a1e3efb81c
+14
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user