Skip to content

Commit

Permalink
Merge together py27, py35 and py36 setups
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Jun 17, 2018
1 parent e6af181 commit 9148746
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 150 deletions.
54 changes: 30 additions & 24 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ lxml: false
versions:
py24: "2.4.6"
py26: "2.6.9"
py27: "2.7.15"
py35: "3.5.5"
py36: "3.6.5"

##
# fine grained settings
Expand All @@ -42,32 +45,35 @@ py26:
install: "{{ base_install_folder }}/python{{ versions.py26 }}"
bin: "{{ base_install_folder }}/python{{ versions.py26 }}/bin/python2.6"

py27_version: "2.7.15"
py27_major_version: "2.7"
py27_url: "https://www.python.org/ftp/python/{{ py27_version }}/Python-{{ py27_version }}.tar.xz"
py27_md5: "a80ae3cc478460b922242f43a1b4094d"
py27_tar_file: "/tmp/py{{ py27_version }}.tar.xz"
py27_sources: "/tmp/Python-{{ py27_version }}"
py27_install: "{{ base_install_folder }}/python{{ py27_version }}"
py27_bin: "{{ py27_install }}/bin/python2.7"
py27:
version: "{{ versions.py27 }}"
major_version: "2.7"
url: "https://www.python.org/ftp/python/{{ versions.py27 }}/Python-{{ versions.py27 }}.tar.xz"
md5: "a80ae3cc478460b922242f43a1b4094d"
tar_file: "/tmp/py{{ versions.py27 }}.tar.xz"
sources: "/tmp/Python-{{ versions.py27 }}"
install: "{{ base_install_folder }}/python{{ versions.py27 }}"
bin: "{{ base_install_folder }}/python{{ versions.py27 }}/bin/python2.7"

py35_version: "3.5.5"
py35_major_version: "3.5"
py35_url: "https://www.python.org/ftp/python/{{ py35_version }}/Python-{{ py35_version }}.tar.xz"
py35_md5: "f3763edf9824d5d3a15f5f646083b6e0"
py35_tar_file: "/tmp/py{{ py35_version }}.tar.xz"
py35_sources: "/tmp/Python-{{ py35_version }}"
py35_install: "{{ base_install_folder }}/python{{ py35_version }}"
py35_bin: "{{ py35_install }}/bin/python3.5"
py35:
version: "{{ versions.py35 }}"
major_version: "3.5"
url: "https://www.python.org/ftp/python/{{ versions.py35 }}/Python-{{ versions.py35 }}.tar.xz"
md5: "f3763edf9824d5d3a15f5f646083b6e0"
tar_file: "/tmp/py{{ versions.py35 }}.tar.xz"
sources: "/tmp/Python-{{ versions.py35 }}"
install: "{{ base_install_folder }}/python{{ versions.py35 }}"
bin: "{{ base_install_folder }}/python{{ versions.py35 }}/bin/python3.5"

py36_version: "3.6.5"
py36_major_version: "3.6"
py36_url: "https://www.python.org/ftp/python/{{ py36_version }}/Python-{{ py36_version }}.tar.xz"
py36_md5: "9f49654a4d6f733ff3284ab9d227e9fd"
py36_tar_file: "/tmp/py{{ py36_version }}.tar.xz"
py36_sources: "/tmp/Python-{{ py36_version }}"
py36_install: "{{ base_install_folder }}/python{{ py36_version }}"
py36_bin: "{{ py36_install }}/bin/python3.6"
py36:
version: "{{ versions.py36 }}"
major_version: "3.6"
url: "https://www.python.org/ftp/python/{{ versions.py36 }}/Python-{{ versions.py36 }}.tar.xz"
md5: "9f49654a4d6f733ff3284ab9d227e9fd"
tar_file: "/tmp/py{{ versions.py36 }}.tar.xz"
sources: "/tmp/Python-{{ versions.py36 }}"
install: "{{ base_install_folder }}/python{{ versions.py36 }}"
bin: "{{ base_install_folder }}/python{{ versions.py36 }}/bin/python3.6"

venv24_version: "1.7.2"
venv24_url: "https://files.pythonhosted.org/packages/16/86/7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0/virtualenv-1.7.2.tar.gz"
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- include: deps.yml
- include: python24.yml
- include: python26.yml
- include: python27.yml
- include: python35.yml
- include: python36.yml
- include: python_generic.yml py_data={{ py27 }} should_install={{ python_27 }}
- include: python_generic.yml py_data={{ py35 }} should_install={{ python_35 }}
- include: python_generic.yml py_data={{ py36 }} should_install={{ python_36 }}
- include: venv.yml

41 changes: 0 additions & 41 deletions tasks/python27.yml

This file was deleted.

41 changes: 0 additions & 41 deletions tasks/python35.yml

This file was deleted.

41 changes: 0 additions & 41 deletions tasks/python36.yml

This file was deleted.

41 changes: 41 additions & 0 deletions tasks/python_generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---

- name: "{{ py_data.version }} | Check that {{ py_data.version}} is still not installed"
become: true
stat: path="{{ py_data.bin }}"
register: already_installed
ignore_errors: True

- name: "{{ py_data.version }} | Download"
get_url:
url="{{ py_data.url }}"
dest="{{ py_data.tar_file }}"
checksum="md5:{{ py_data.md5 }}"
when: should_install and already_installed.stat.exists == false

- name: "{{ py_data.version }} | Uncompress"
unarchive:
src={{ py_data.tar_file }}
dest=/tmp
copy=no
creates="{{ py_data.sources }}"
when: should_install and already_installed.stat.exists == false

- name: "{{ py_data.version }} | Compile and install"
become: true
command: "{{ item }}"
args:
chdir: "{{ py_data.sources }}"
with_items:
- "./configure --enable-optimizations --prefix {{ py_data.install }}"
- make
- make install
when: should_install and already_installed.stat.exists == false

- name: "{{ py_data.version }} | Create python_major_version symlink"
become: true
file:
src={{ py_data.install }}
dest='{{ base_install_folder }}/python{{ py_data.major_version }}'
state=link
when: should_install and already_installed.stat.exists == false

0 comments on commit 9148746

Please sign in to comment.