Closed altendky closed 6 years ago
We have known issues with git repos. pip install
from master and let me know if that helps any (triaging issues right now and then heading home from work but the fix may not be in master yet)
I observed this with some version reporting 11.9.0 first (might have been from pypi, maybe not...) and then as I recall I installed from master and then created this report which claims 11.9.1, but since I didn't -e
... no record. Just to be sure I just now did a -e
install of 8a67a21d61a2383253fe0dd5e7a8d79d51d30d2d and a short log.
https://gist.github.com/altendky/105157700c3d54b6d0b303da1a73cdad
After --rm
there's still <env>\src\pipenv\.git\objects\pack\pack-a86bebb39dc5850b462e6af478af45590e09a22d.idx
and .pack
left. Everything else is deleted. I could see how this would cause Git to have issues. I'll try to dig a bit more.
In my experience, this isn't sufficient on Windows. Deleting directories is somehow actually pretty hard.
https://github.com/pypa/pipenv/blob/8a67a21d61a2383253fe0dd5e7a8d79d51d30d2d/pipenv/core.py#L171
In a (bad) virtualenv creation script I made I did the following based on https://stackoverflow.com/a/21263493/228539.
https://github.com/altendky/stlib/blob/0ff4031f79e8d11193e122da29273aedc0faecdd/venv.py#L56-L74
# http://stackoverflow.com/a/21263493/228539
def del_rw(action, name, exc):
os.chmod(name, stat.S_IWRITE)
if os.path.isdir(name):
os.rmdir(name)
else:
os.remove(name)
try:
shutil.rmtree('venv', onerror=del_rw)
except FileNotFoundError:
pass
Though I'm thinking perhaps the os.rmdir()
inside del_rw()
should actually be another shutil.rmtree()
just in case.
I'll try this out and if it works (better, I've never had good luck with deleting on Windows...) then I'll get a PR in for consideration.
@altendky we have an entire tooling setup for this already, but it isn't being used here because of reasons... you are right about the git repo issues on windows, this tooling setup was specifically designed for this reason. Feel free to PR but please use this one: https://github.com/pypa/pipenv/blob/b5ae7cc0bb2c01eed86b884bd16425f0a3a06f6c/pipenv/utils.py#L1164
Ooh this is all handled I think, closing
Full commands and output: https://gist.github.com/altendky/165b025c6c2ca3d0a2ef84ae542e36bc
In reality I am having issues with my own repos but I decided to test with something more official and it showed the same issues. I would expect the following sequence of commands to work on Windows but it does not. It does work in Linux.
Instead of working I get an error from the last one including the following (full log in gist above).
Note that at the end the
pipenv
source directory is nearly empty and it's.git
directory is as well.