Repetition of `site-packages\build\lib\build\lib\...`
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
When creating a shiv package, the path `site-packages\build\lib\build\lib\...` is repeated multiple times and ends up being very long:
`\site-packages\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\build\lib\mytools\`
Versions: shiv 1.0.1 and python 3.10
Command used to create package: `shiv -e mytool.cli:cli -o mytool.pyz .`
Then, when executing the archive we experience some strange problems only on Windows systems which are configured in French language. Other systems we have at hand (German and English) do not show this behavior and the shiv package runs as expected. Python version (and python installation) is the same on all systems.
This is the error we get on French systems:
```
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\paths\mytool.pyz\__main__.py", line 3, in
File "D:\paths\mytools.pyz\_bootstrap\__init__.py", line 197, in bootstrap
File "D:\paths\mytool.pyz\_bootstrap\__init__.py", line 137, in extract_site_packages
File "C:\Program Files\Python310\lib\zipfile.py", line 1628, in extract
return self._extract_member(member, path, pwd)
File "C:\Program Files\Python310\lib\zipfile.py", line 1691, in _extract_member
os.makedirs(upperdirs)
File "C:\Program Files\Python310\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "C:\Program Files\Python310\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "C:\Program Files\Python310\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
[Previous line repeated 4 more times]
File "C:\Program Files\Python310\lib\os.py", line 225, in makedirs
mkdir(name, mode)
FileNotFoundError: [WinError 206] Nom de fichier ou extension trop long: 'C:\\Users\\XYZ\\.shiv\\mytool.pyz_bd23d769b67428a55f59e57861d9e79feb6ac7d6ca7b6156b777d17bd09a877b.tmp\\site-packages\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib\\build\\lib'
```
We think this path should not be repeated in the first place. Where does it come from? What should `\site-packages\build\lib` actually contain? It is not present in my virtual environment (`\site-packages\build` is present).
Contributor guide
Research direction
Start with _bootstrap/__init__.py, especially extract_site_packages at the locations shown in the traceback, and reproduce the shiv command on a French Windows system. Trace why site-packages/build/lib is repeated during extraction; done means the archive extracts without the repeated path and runs successfully on the affected system.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100