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

cowardly refuse to delete a directory if it isn't a venv #1340

Merged
merged 1 commit into from Jun 10, 2019
Merged

cowardly refuse to delete a directory if it isn't a venv #1340

merged 1 commit into from Jun 10, 2019

Conversation

@asottile
Copy link
Member

@asottile asottile commented Jun 9, 2019

Contribution checklist:

(also see CONTRIBUTING.rst for details)

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation (N/A)
  • added relevant issue keyword
    in message body (N/A)
  • added news fragment in changelog folder
    • fragment name: <issue number>.<type>.rst for example (588.bugfix.rst)
    • <type> is must be one of bugfix, feature, deprecation,breaking, doc, misc
    • if PR has no issue: consider creating one first or change it to the PR number after creating the PR
    • "sign" fragment with "by :user:<your username>"
    • please use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files - by :user:superuser."
    • also see examples
  • added yourself to CONTRIBUTORS (preserving alphabetical order)
src/tox/venv.py Outdated Show resolved Hide resolved
@asottile asottile closed this Jun 10, 2019
@asottile asottile reopened this Jun 10, 2019
@asottile
Copy link
Member Author

@asottile asottile commented Jun 10, 2019

since AP's python is still broken:

$ git rev-parse HEAD
3eb1896a98f28fbc5b36837da54faa20f46b850d
$ tox -e fix_lint
fix_lint create: /tmp/tox/.tox/fix_lint
fix_lint installdeps: pre-commit >= 1.14.4, < 2
fix_lint installed: aspy.yaml==1.3.0,cfgv==2.0.0,identify==1.4.3,importlib-metadata==0.17,nodeenv==1.3.3,pre-commit==1.17.0,PyYAML==5.1.1,six==1.12.0,toml==0.10.0,virtualenv==16.6.0,zipp==0.5.1
fix_lint run-test-pre: PYTHONHASHSEED='3597702364'
fix_lint run-test: commands[0] | pre-commit run --all-files --show-diff-on-failure
[INFO] Installing environment for https://github.com/asottile/seed-isort-config.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/asottile/pyupgrade.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
black....................................................................Passed
blacken-docs.............................................................Passed
seed isort known_third_party.............................................Passed
isort....................................................................Passed
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Flake8...................................................................Passed
pyupgrade................................................................Passed
rst ``code`` is two backticks............................................Passed
fix_lint run-test: commands[1] | python -c 'import pathlib; print("hint: run {} install to add checks as pre-commit hook".format(pathlib.Path(r"/tmp/tox/.tox/fix_lint") / "bin" / "pre-commit"))'
hint: run /tmp/tox/.tox/fix_lint/bin/pre-commit install to add checks as pre-commit hook
___________________________________ summary ____________________________________
  fix_lint: commands succeeded
  congratulations :)

@gaborbernat gaborbernat merged commit 81d1683 into tox-dev:master Jun 10, 2019
1 check was pending
@asottile asottile deleted the envdir_safety branch Jun 10, 2019
@westover
Copy link

@westover westover commented Jul 2, 2019

How do I override this feature?

@asottile
Copy link
Member Author

@asottile asottile commented Jul 2, 2019

beyond rm -rf path/to/thing? is there a virtualenv type that's not covered here?

@westover
Copy link

@westover westover commented Jul 2, 2019

Ended up doing rm -rf .tox as part of my CI which seems to alleviate the issue.

@asottile
Copy link
Member Author

@asottile asottile commented Jul 2, 2019

Do you have a failing output? I'd be interested in what case you're hitting?

@westover
Copy link

@westover westover commented Jul 2, 2019

The output isn't very illuminating but here it is:

/mnt/jenkins/workspace/test-ubermon/env/bin/tox
GLOB sdist-make: /mnt/jenkins/workspace/test-ubermon/setup.py
py27 create: /mnt/jenkins/workspace/test-ubermon/.tox/py27
ERROR: cowardly refusing to delete `envdir` (it does not look like a virtualenv): /mnt/jenkins/workspace/test-ubermon/.tox/py27
___________________________________ summary ____________________________________
ERROR:   py27: error
ERROR:   py34: undefined

@asottile
Copy link
Member Author

@asottile asottile commented Jul 2, 2019

interesting! what version of tox are you using and are there any plugins at play? -- if you ls -al .tox/py27 right before the error occurs can you show me the contents?

@westover
Copy link

@westover westover commented Jul 2, 2019

This .tox directory was created by version 2.5 I believe. And then I ran the latest version in the same directory. Unfortunately I could never reproduce the error locally and that directory is long gone at this point

@asottile
Copy link
Member Author

@asottile asottile commented Jul 2, 2019

wompwomp oh well :( -- if it crops up again let us know! thanks

@ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Jul 6, 2019

Something is fishy I recently encountered this with env name dist, was me unlucky to pick that env name? https://travis-ci.com/pycontribs/jira/jobs/213724388

dist create: /home/travis/build/pycontribs/jira/.tox/dist
ERROR: cowardly refusing to delete `envdir` (it does not look like a virtualenv): /home/travis/build

@asottile
Copy link
Member Author

@asottile asottile commented Jul 6, 2019

./dist is commonly used by the outputs of python setup.py $cmd (sdist, bdist_wheel, etc.) -- the error in that case is correct as tox would have blown away those artifacts

@asottile
Copy link
Member Author

@asottile asottile commented Jul 6, 2019

Oh hmm .tox/dist I don't know about though 🤔

@asottile
Copy link
Member Author

@asottile asottile commented Jul 6, 2019

Ah yes, that's distdir

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

Successfully merging this pull request may close these issues.

None yet

5 participants