Skip to content

Instantly share code, notes, and snippets.

@ScriptAutomate
Last active August 27, 2021 21:45
Show Gist options
  • Save ScriptAutomate/11f739325ab458e4c3dbfad70b0a3ed7 to your computer and use it in GitHub Desktop.
Save ScriptAutomate/11f739325ab458e4c3dbfad70b0a3ed7 to your computer and use it in GitHub Desktop.
Install pyenv in root home on container
# Prereqs recommended for building Python
## ref: https://github.com/pyenv/pyenv/wiki#suggested-build-environment
## Ubuntu/Debian/Mint (includes Pop!_OS, Kali, etc.)
pyenv-prereq-pkgs:
pkg.installed:
- pkgs:
- git
- make
- build-essential
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- wget
- curl
- llvm
- libncurses5-dev
- xz-utils
- tk-dev
- libxml2-dev
- libffi-dev
- liblzma-dev
- python-is-python3
{% if grains['os'] == 'Ubuntu' or grains['os'] == 'Pop' %}
# Parrot OS runs into dependency errors with libxmlsec1-dev
# that don't seem resolvable at the moment.
# Parrot OS 4.1.0 - Home Edition
- libxmlsec1-dev
{% endif %}
# Clone latest version of git repo for pyenv
pyenv-repo:
git.latest:
- name: https://github.com/pyenv/pyenv.git
- target: /root/.pyenv
- rev: master
pyenv-virtualenv-plugin-repo:
git.latest:
- name: https://github.com/pyenv/pyenv-virtualenv.git
- target: /root/.pyenv/plugins/pyenv-virtualenv
- rev: master
pyenv-bashrc:
file.append:
- name: /root/.bashrc
- text: |
# Initializing pyenv
# Other pyenv info in ~/.profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
if shopt -q login_shell; then
eval "$(pyenv init --path)"
fi
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv-profile:
file.prepend:
- name: /root/.profile
- text: |
# pyenv initialization
# At top of file; needs to be before sourcing ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment