From 198fe299c78f336d8f0650ad2fc652cd627850c0 Mon Sep 17 00:00:00 2001 From: Deimos Date: Mon, 10 Dec 2018 20:33:33 -0700 Subject: [PATCH] Use deadsnakes PPA for Python instead of pyenv Previously I was using pyenv to build Python, but that's mostly unnecessary and has some other side effects (like needing to install a lot of packages as dependencies). This switches to using the deadsnakes PPA instead, which also has the effect of upgrading to the most recent version of Python 3.6 (currently, 3.6.7 instead of 3.6.5). --- salt/salt/boussole.sls | 7 +++---- salt/salt/common.jinja2 | 2 +- salt/salt/python.sls | 36 ++++++++------------------------ salt/salt/site-icons-spriter.sls | 7 +++---- 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/salt/salt/boussole.sls b/salt/salt/boussole.sls index b10ee0c..e670e85 100644 --- a/salt/salt/boussole.sls +++ b/salt/salt/boussole.sls @@ -5,16 +5,15 @@ # Salt seems to use the deprecated pyvenv script, manual for now boussole-venv-setup: cmd.run: - - name: /usr/local/pyenv/versions/{{ python_version }}/bin/python -m venv {{ boussole_venv_dir }} + - name: python{{ python_version }} -m venv {{ boussole_venv_dir }} - creates: {{ boussole_venv_dir }} - require: - - pkg: python3-venv - - pyenv: {{ python_version }} + - pkg: python{{ python_version }}-venv boussole-pip-installs: cmd.run: - name: {{ boussole_venv_dir }}/bin/pip install boussole - - unless: ls {{ boussole_venv_dir }}/lib/python3.6/site-packages/boussole + - unless: ls {{ boussole_venv_dir }}/lib/python{{ python_version }}/site-packages/boussole /etc/systemd/system/boussole.service: file.managed: diff --git a/salt/salt/common.jinja2 b/salt/salt/common.jinja2 index 163d8e5..39d4dd3 100644 --- a/salt/salt/common.jinja2 +++ b/salt/salt/common.jinja2 @@ -1,4 +1,4 @@ -{% set python_version = '3.6.5' %} +{% set python_version = '3.6' %} {% set app_dir = '/opt/tildes' %} {% set static_sites_dir = '/opt/tildes-static-sites' %} diff --git a/salt/salt/python.sls b/salt/salt/python.sls index e4a6947..f449fbd 100644 --- a/salt/salt/python.sls +++ b/salt/salt/python.sls @@ -1,28 +1,11 @@ {% from 'common.jinja2' import app_dir, bin_dir, python_version, venv_dir %} -pyenv-deps: +deadsnakes: + pkgrepo.managed: + - ppa: deadsnakes/ppa pkg.installed: - - pkgs: - - build-essential - - curl - - libbz2-dev - - libncurses5-dev - - libncursesw5-dev - - libreadline-dev - - libsqlite3-dev - - libssl-dev - - llvm - - make - - wget - - xz-utils - - zlib1g-dev - -python-3.6: - pyenv.installed: - - name: {{ python_version }} - - default: True - - require: - - pkg: pyenv-deps + - name: python{{ python_version }} + - refresh: True delete-obsolete-venv: file.absent: @@ -32,13 +15,12 @@ delete-obsolete-venv: # Salt seems to use the deprecated pyvenv script, manual for now venv-setup: pkg.installed: - - name: python3-venv + - name: python{{ python_version }}-venv cmd.run: - - name: /usr/local/pyenv/versions/{{ python_version }}/bin/python -m venv {{ venv_dir }} + - name: python{{ python_version }} -m venv {{ venv_dir }} - creates: {{ venv_dir }} - require: - - pkg: python3-venv - - pyenv: {{ python_version }} + - pkg: python{{ python_version }}-venv pip-installs: pip.installed: @@ -55,4 +37,4 @@ self-install: - {{ app_dir }} - require: - cmd: venv-setup - - unless: ls {{ venv_dir }}/lib/python3.6/site-packages/tildes.egg-link + - unless: ls {{ venv_dir }}/lib/python{{ python_version }}/site-packages/tildes.egg-link diff --git a/salt/salt/site-icons-spriter.sls b/salt/salt/site-icons-spriter.sls index e732267..ddd013c 100644 --- a/salt/salt/site-icons-spriter.sls +++ b/salt/salt/site-icons-spriter.sls @@ -6,16 +6,15 @@ # Salt seems to use the deprecated pyvenv script, manual for now site-icons-venv-setup: cmd.run: - - name: /usr/local/pyenv/versions/{{ python_version }}/bin/python -m venv {{ site_icons_venv_dir }} + - name: python{{ python_version }} -m venv {{ site_icons_venv_dir }} - creates: {{ site_icons_venv_dir }} - require: - - pkg: python3-venv - - pyenv: {{ python_version }} + - pkg: python{{ python_version }}-venv site-icons-pip-installs: cmd.run: - name: {{ site_icons_venv_dir }}/bin/pip install glue - - unless: ls {{ site_icons_venv_dir }}/lib/python3.6/site-packages/glue + - unless: ls {{ site_icons_venv_dir }}/lib/python{{ python_version }}/site-packages/glue site-icons-output-placeholder: file.managed: