Fix virtualenv for xenial #49

Merged
merged 1 commit into from May 8, 2016

Conversation

Projects
None yet
3 participants
Owner

johnsca commented Mar 18, 2016

In Xenial, the python-virtualenv package was split in to three different packages: python-virtualenv, python3-virtualenv, and virtualenv with the latter installing the actual CLI command. Unfortunately, python-virtualenv only recommends virtualenv so we have to manually install it on Xenial. It also doesn't exist on trusty, so that's fun.

lib/charms/layer/basic.py
@@ -31,7 +31,12 @@ def bootstrap_charm_deps():
# if we're using a venv, set it up
if cfg.get('use_venv'):
if not os.path.exists(venv):
- apt_install(['python-virtualenv'])
+ # note that the following two apt_installs *must* be done
@stub42

stub42 Mar 22, 2016

Contributor

charmhelpers.core.host.lsb_release() will tell you the release, allowing you to explicitly install the correct packages rather than rely on silent failures actually working.

Owner

johnsca commented May 2, 2016

Updated to explicitly check the series and just install the right package.

lib/charms/layer/basic.py
@@ -50,7 +51,11 @@ def bootstrap_charm_deps():
# if we're using a venv, set it up
if cfg.get('use_venv'):
if not os.path.exists(venv):
- apt_install(['python-virtualenv'])
+ distname, version, series = platform.linux_distribution()
+ if series == 'trusty':
@marcoceppi

marcoceppi May 2, 2016

Owner

if series in ('trusty', 'precise') to be accurate and complete

Owner

marcoceppi commented May 8, 2016

LGTM 👍

@marcoceppi marcoceppi merged commit 04cb3bd into juju-solutions:master May 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment