conda-build
conda-build copied to clipboard
Unhandled exception in _guess_patch_strip_level
Checklist
- [X] I added a descriptive title
- [X] I searched open reports and couldn't find a duplicate
What happened?
Attempting to add a (Windows only) patch to a conda-forge recipe as part of https://github.com/conda-forge/jove-feedstock/pull/12 got an unexpected failure:
Source cache directory is: D:\bld\src_cache
INFO:conda_build.source:Source cache directory is: D:\bld\src_cache
Downloading source to cache: 4.17.5.2_e28836e230.tar.gz
INFO:conda_build.source:Downloading source to cache: 4.17.5.2_e28836e230.tar.gz
Downloading https://github.com/jonmacs/jove/archive/4.17.5.2.tar.gz
INFO:conda_build.source:Downloading https://github.com/jonmacs/jove/archive/4.17.5.2.tar.gz
INFO:conda_build.source:Success
Success
Extracting download
Applying patch: D:\a\1\s\recipe\windows.patch
Traceback (most recent call last):
File "C:\Miniforge\Scripts\conda-mambabuild-script.py", line 9, in <module>
sys.exit(main())
File "C:\Miniforge\lib\site-packages\boa\cli\mambabuild.py", line 256, in main
call_conda_build(action, config)
File "C:\Miniforge\lib\site-packages\boa\cli\mambabuild.py", line 228, in call_conda_build
result = api.build(
File "C:\Miniforge\lib\site-packages\conda_build\api.py", line 180, in build
return build_tree(
File "C:\Miniforge\lib\site-packages\conda_build\build.py", line 3097, in build_tree
packages_from_this = build(metadata, stats,
File "C:\Miniforge\lib\site-packages\conda_build\build.py", line 2136, in build
try_download(m, no_download_source=False, raise_error=True)
File "C:\Miniforge\lib\site-packages\conda_build\render.py", line 643, in try_download
source.provide(metadata)
File "C:\Miniforge\lib\site-packages\conda_build\source.py", line 902, in provide
patch_attributes_output += [apply_one_patch(src_dir, metadata.path, patch, metadata.config, git)]
File "C:\Miniforge\lib\site-packages\conda_build\source.py", line 797, in apply_one_patch
patch_attributes = _get_patch_attributes(path, patch_exe, git, src_dir, stdout, stderr, tmpdir)
File "C:\Miniforge\lib\site-packages\conda_build\source.py", line 595, in _get_patch_attributes
strip_level, strip_level_guessed = _guess_patch_strip_level(files, src_dir)
File "C:\Miniforge\lib\site-packages\conda_build\source.py", line 526, in _guess_patch_strip_level
histo = {i: 0 for i in range(maxlevel + 1)}
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
The patch file was just:
65c65
< JTMPDIR = /var/tmp
---
> JTMPDIR = %TMP%
Note I omitted the filename (an error in hindsight as the conda-build system won't know which file to apply it to), but the failure could be handled better.
Conda Info
No response
Conda Config
No response
Conda list
No response
Additional Context
Logging quoted from Azure, https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=676262&view=logs&jobId=a70f640f-cc53-5cd3-6cdc-236a1aa90802&j=a70f640f-cc53-5cd3-6cdc-236a1aa90802&t=f5d15007-a01c-5ad8-c9ce-4d519d3b275f
Hi @peterjc,
Thanks for reporting this bug. I do agree this is not the best user experience to be faced with such tracebacks.
I've added the https://github.com/conda/conda-build/labels/tag%3A%3Aux so we can collect these issues into a single place. We cannot promise when this particular issue will be resolved though. Please keep an eye on this issue for updates.
Hi there, thank you for your contribution!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.
If you would like this issue to remain open please:
- Verify that you can still reproduce the issue at hand
- Comment that the issue is still reproducible and include: - What OS and version you reproduced the issue on - What steps you followed to reproduce the issue
NOTE: If this issue was closed prematurely, please leave a comment.
Thanks!