microsoft / python-environment-tools

MIT License
163 stars 16 forks source link

`pet` crate can't be fetched by cargo in GitHub Actions machine with Windows #171

Open ognevny opened 6 days ago

ognevny commented 6 days ago

cargo fails to checkout this repo because some files have too long path and Windows complains about it

Updating git repository `[https://github.com/microsoft/python-environment-tools.git`](https://github.com/microsoft/python-environment-tools.git%60)
  error: Unable to update https://github.com/microsoft/python-environment-tools.git?rev=ffcbf3f28c46633abd5448a52b1f396c322e0d6c
  Caused by:
    path too long: 'C:/Users/runneradmin/.cargo/git/checkouts/python-environment-tools-903993894b37a7d2/ffcbf3f/crates/pet-conda/tests/unix/conda_env_without_manager_but_found_in_history/some_other_location/conda_install/conda-meta/python-fastjsonschema-2.16.2-py310hca03da5_0.json'; class=Filesystem (30)
eternalphane commented 6 days ago

I also encountered this error when trying to build zed v0.160.1 on windows.

ognevny commented 6 days ago

I also encountered this error when trying to build zed v0.160.1 on windows.

I'm also trying to update zed for msys2!

ognevny commented 6 days ago

@eternalphane this is what you can do from your side

  1. change to directory with shortest possible path (e.g C:\_)
  2. clone zed repo to it (so it will be C:\_\zed for example from 1.)
  3. clone this repo to the same directory (so it will be C:\_\python-environment-tools)
  4. change Cargo.toml to use crates from ../python-environment-tools/crates/. you need to set path for each pet* crate
  5. remove source from each pet dependency in Cargo.lock manually

also you can use this patch which is based on v0.159.6 tag source: https://github.com/msys2/MINGW-packages/blob/9fbd2786337c61c69b76ee63a196b3036f7f8f92/mingw-w64-zed/zed-use-vendored-pet.patch

edit: I made it possible ONLY because I have a linux machine which doesn't have this stupid restriction. it's so painful to do things on Windows...

eternalphane commented 6 days ago

@ognevny Or you can set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled to 1 in registry and set core.longpaths to true in git

cf. rust-lang/cargo#13141

ognevny commented 6 days ago

@ognevny Or you can set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled to 1 in registry and set core.longpaths to true in git

this is not a solution in case of GitHub machine and git config probably won't work because cargo use libgit2/gix

eternalphane commented 6 days ago

... and git config probably won't work because cargo use libgit2/gix

Well it actually works ... just that I didn't make it compile yet 🤣 Image

ognevny commented 6 days ago

from_mode is for Unix only. a few #[cfg()] will fix it

update: looks like remote server is not supported on Windows. does cargo build -p zed works?