pyenv - setup

This commit is contained in:
unman 2022-10-29 15:55:56 +00:00
parent e3c72c0e38
commit d0071c82e5
No known key found for this signature in database
GPG Key ID: FDD1B8244731B36C
4 changed files with 106 additions and 0 deletions

63
pyenv/install.sls Normal file
View File

@ -0,0 +1,63 @@
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
#
#
#
{% if grains['nodename'] != 'dom0' %}
{% if salt['qvm.exists']('cacher') %}
{% if grains['os_family']|lower == 'debian' %}
{% if grains['nodename']|lower != 'host' %}
{% for repo in salt['file.find']('/etc/apt/sources.list.d/', name='*list') %}
{{ repo }}_baseurl:
file.replace:
- name: {{ repo }}
- pattern: 'https://'
- repl: 'http://HTTPS///'
- flags: [ 'IGNORECASE', 'MULTILINE' ]
- backup: False
{% endfor %}
/etc/apt/sources.list:
file.replace:
- name: /etc/apt/sources.list
- pattern: 'https:'
- repl: 'http://HTTPS/'
- flags: [ 'IGNORECASE', 'MULTILINE' ]
- backup: False
{% endif %}
{% endif %}
{% endif %}
pyenv_update:
pkg.uptodate:
- refresh: True
pyenv_install:
pkg.installed:
- pkgs:
- qubes-core-agent-networking
- build-essential
- curl
- git
- libbz2-dev
- libcurl4-openssl-dev
- libffi-dev
- libncursesw5-dev
- libreadline-dev
- libsqlite3-dev
- libssl-dev
- libxml2-dev
- libxmlsec1-dev
- liblzma-dev
- llvm
- make
- tk-dev
- wget
- xz-utils
- zlib1g-dev
{% endif %}

5
pyenv/install.top Normal file
View File

@ -0,0 +1,5 @@
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
base:
'*':
- pyenv.install

8
pyenv/setup.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> /home/user/.bashrc
echo 'export PYENV_ROOT=/home/user/.pyenv' >> /home/user/.bashrc
echo 'command -v pyenv >/dev/null|| export PATH="$HOME/.pyenv/bin:$PATH" '>> /home/user/.bashrc
echo 'eval "$(pyenv init -)" '>> /home/user/.bashrc
echo 'eval "$(pyenv virtualenv-init -)" '>> /home/user/.bashrc

30
pyenv/setup_pyenv.sls Normal file
View File

@ -0,0 +1,30 @@
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
#
#
#
{% if grains['nodename'] != 'dom0' %}
pyenv_cloned:
git.cloned:
- name: https://github.com/pyenv/pyenv.git
- target: /home/user/.pyenv
- user: user
pyenv-virtual_cloned:
git.cloned:
- name: https://github.com/pyenv/pyenv-virtualenv.git
- target: /home/user/.pyenv/plugins/pyenv-virtualenv
- user: user
{% set current_path = salt['environ.get']('PATH', '/usr/local/bin:/usr/bin:/bin') %}
cmd-run:
cmd.script:
- source: salt://pyenv/setup.sh
- cwd: /home/user/
- runas: user
- env:
- PATH: {{ ['/home/user/.pyenv/bin', current_path]|join(':') }}
{% endif %}