Improve py27 detection to avoid "No module named venv" when using plonecli
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
- Plone CLI version: 2.1.2
- Python version: 2.7
- Operating System: Ubuntu 18.04
Right now, the logic to use virtualenv instead of venv is a bit fragile, since it tries to detect python 2 by comparing if the bin is python2.7
https://github.com/plone/plonecli/blob/b478678d7437f29db1f577994e6538982028cb3e/plonecli/cli.py#L120
A more robust condition using sys.version_info is better since you can use any compiled python in any path. A little hackish, but it works instead of comparing to python2.7string: if subprocess.call([python_bin, "-c", "import sys; sys.exit(0) if sys.version_info.major == 2 else sys.exit(1)"]) == 0
@jensens
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in plonecli/cli.py around the linked detection logic at line 120 and reproduce the Python 2.7 case that reports "No module named venv". Check how the selected interpreter is identified when it is not named python2.7; done means Python 2 uses virtualenv reliably regardless of its path while newer Python uses the existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100