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

Repetition of site-packages\build\lib\build\lib\... #220

Open
jonas-hagen opened this issue Jun 22, 2022 · 1 comment
Open

Repetition of site-packages\build\lib\build\lib\... #220

jonas-hagen opened this issue Jun 22, 2022 · 1 comment

Comments

@jonas-hagen
Copy link

jonas-hagen commented Jun 22, 2022

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 <module>
  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).

@lorencarvalho
Copy link
Contributor

Hi @jonas-hagen,

Sorry for the delay in responding to this issue! This is a tricky one, I don't currently have access to a windows machine to test on but I will in the coming week or two. An example repository that you can consistently reproduce with would be extremely helpful for debugging, if you have one handy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants