Skip to content

Conversation

@shubhbapna
Copy link
Contributor

@shubhbapna shubhbapna commented Aug 7, 2024

fixes #278

had to tell mypy to ignore settings.py until #257

@shubhbapna shubhbapna force-pushed the config-build-dir branch 2 times, most recently from e405453 to 7829da4 Compare August 7, 2024 20:28
@shubhbapna shubhbapna marked this pull request as ready for review August 7, 2024 20:29
@shubhbapna shubhbapna requested a review from dhellmann August 7, 2024 20:29
@shubhbapna
Copy link
Contributor Author

@dhellmann now that i think about this, should i just apply this transformation: ctx.settings.build_dir(req.name, sdist_root_dir) in prepare_source and find_source_dir. What do you think?

@mergify mergify bot added the ci label Aug 9, 2024
@shubhbapna
Copy link
Contributor Author

shubhbapna commented Aug 9, 2024

Handling the case where user tries to escape the source root dir is a bit tough since ".." can appear anywhere in the path for example: foo/../../../bar will allow me to escape outside the source root dir. So I used a hack - if ".." appears anywhere in the path then resolve it to an absolute path and since I have code that can handle absolute path we are able to contain the directory escaping.

For example say our sdist dir path is /home/outside/sdist_root_dir and build_dir is defined as ../outside then settings.build_dir will return /home/outside/sdist_root_dir/home/outside because ../outside is resolved to /home/outside.

@shubhbapna shubhbapna requested a review from dhellmann August 9, 2024 20:14
@mergify mergify bot merged commit 8b3e4d7 into python-wheel-build:main Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

configuration option for build dir relative to source root

2 participants