plone / plone/plonecli

Improve py27 detection to avoid "No module named venv" when using plonecli

Open
#70 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.