Skip to content

Commit 9148746

Browse files
committed
Merge together py27, py35 and py36 setups
1 parent e6af181 commit 9148746

File tree

6 files changed

+74
-150
lines changed

6 files changed

+74
-150
lines changed

defaults/main.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ lxml: false
1616
versions:
1717
py24: "2.4.6"
1818
py26: "2.6.9"
19+
py27: "2.7.15"
20+
py35: "3.5.5"
21+
py36: "3.6.5"
1922

2023
##
2124
# fine grained settings
@@ -42,32 +45,35 @@ py26:
4245
install: "{{ base_install_folder }}/python{{ versions.py26 }}"
4346
bin: "{{ base_install_folder }}/python{{ versions.py26 }}/bin/python2.6"
4447

45-
py27_version: "2.7.15"
46-
py27_major_version: "2.7"
47-
py27_url: "https://www.python.org/ftp/python/{{ py27_version }}/Python-{{ py27_version }}.tar.xz"
48-
py27_md5: "a80ae3cc478460b922242f43a1b4094d"
49-
py27_tar_file: "/tmp/py{{ py27_version }}.tar.xz"
50-
py27_sources: "/tmp/Python-{{ py27_version }}"
51-
py27_install: "{{ base_install_folder }}/python{{ py27_version }}"
52-
py27_bin: "{{ py27_install }}/bin/python2.7"
48+
py27:
49+
version: "{{ versions.py27 }}"
50+
major_version: "2.7"
51+
url: "https://www.python.org/ftp/python/{{ versions.py27 }}/Python-{{ versions.py27 }}.tar.xz"
52+
md5: "a80ae3cc478460b922242f43a1b4094d"
53+
tar_file: "/tmp/py{{ versions.py27 }}.tar.xz"
54+
sources: "/tmp/Python-{{ versions.py27 }}"
55+
install: "{{ base_install_folder }}/python{{ versions.py27 }}"
56+
bin: "{{ base_install_folder }}/python{{ versions.py27 }}/bin/python2.7"
5357

54-
py35_version: "3.5.5"
55-
py35_major_version: "3.5"
56-
py35_url: "https://www.python.org/ftp/python/{{ py35_version }}/Python-{{ py35_version }}.tar.xz"
57-
py35_md5: "f3763edf9824d5d3a15f5f646083b6e0"
58-
py35_tar_file: "/tmp/py{{ py35_version }}.tar.xz"
59-
py35_sources: "/tmp/Python-{{ py35_version }}"
60-
py35_install: "{{ base_install_folder }}/python{{ py35_version }}"
61-
py35_bin: "{{ py35_install }}/bin/python3.5"
58+
py35:
59+
version: "{{ versions.py35 }}"
60+
major_version: "3.5"
61+
url: "https://www.python.org/ftp/python/{{ versions.py35 }}/Python-{{ versions.py35 }}.tar.xz"
62+
md5: "f3763edf9824d5d3a15f5f646083b6e0"
63+
tar_file: "/tmp/py{{ versions.py35 }}.tar.xz"
64+
sources: "/tmp/Python-{{ versions.py35 }}"
65+
install: "{{ base_install_folder }}/python{{ versions.py35 }}"
66+
bin: "{{ base_install_folder }}/python{{ versions.py35 }}/bin/python3.5"
6267

63-
py36_version: "3.6.5"
64-
py36_major_version: "3.6"
65-
py36_url: "https://www.python.org/ftp/python/{{ py36_version }}/Python-{{ py36_version }}.tar.xz"
66-
py36_md5: "9f49654a4d6f733ff3284ab9d227e9fd"
67-
py36_tar_file: "/tmp/py{{ py36_version }}.tar.xz"
68-
py36_sources: "/tmp/Python-{{ py36_version }}"
69-
py36_install: "{{ base_install_folder }}/python{{ py36_version }}"
70-
py36_bin: "{{ py36_install }}/bin/python3.6"
68+
py36:
69+
version: "{{ versions.py36 }}"
70+
major_version: "3.6"
71+
url: "https://www.python.org/ftp/python/{{ versions.py36 }}/Python-{{ versions.py36 }}.tar.xz"
72+
md5: "9f49654a4d6f733ff3284ab9d227e9fd"
73+
tar_file: "/tmp/py{{ versions.py36 }}.tar.xz"
74+
sources: "/tmp/Python-{{ versions.py36 }}"
75+
install: "{{ base_install_folder }}/python{{ versions.py36 }}"
76+
bin: "{{ base_install_folder }}/python{{ versions.py36 }}/bin/python3.6"
7177

7278
venv24_version: "1.7.2"
7379
venv24_url: "https://files.pythonhosted.org/packages/16/86/7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0/virtualenv-1.7.2.tar.gz"

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
- include: deps.yml
44
- include: python24.yml
55
- include: python26.yml
6-
- include: python27.yml
7-
- include: python35.yml
8-
- include: python36.yml
6+
- include: python_generic.yml py_data={{ py27 }} should_install={{ python_27 }}
7+
- include: python_generic.yml py_data={{ py35 }} should_install={{ python_35 }}
8+
- include: python_generic.yml py_data={{ py36 }} should_install={{ python_36 }}
99
- include: venv.yml
1010

tasks/python27.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

tasks/python35.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

tasks/python36.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

tasks/python_generic.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
3+
- name: "{{ py_data.version }} | Check that {{ py_data.version}} is still not installed"
4+
become: true
5+
stat: path="{{ py_data.bin }}"
6+
register: already_installed
7+
ignore_errors: True
8+
9+
- name: "{{ py_data.version }} | Download"
10+
get_url:
11+
url="{{ py_data.url }}"
12+
dest="{{ py_data.tar_file }}"
13+
checksum="md5:{{ py_data.md5 }}"
14+
when: should_install and already_installed.stat.exists == false
15+
16+
- name: "{{ py_data.version }} | Uncompress"
17+
unarchive:
18+
src={{ py_data.tar_file }}
19+
dest=/tmp
20+
copy=no
21+
creates="{{ py_data.sources }}"
22+
when: should_install and already_installed.stat.exists == false
23+
24+
- name: "{{ py_data.version }} | Compile and install"
25+
become: true
26+
command: "{{ item }}"
27+
args:
28+
chdir: "{{ py_data.sources }}"
29+
with_items:
30+
- "./configure --enable-optimizations --prefix {{ py_data.install }}"
31+
- make
32+
- make install
33+
when: should_install and already_installed.stat.exists == false
34+
35+
- name: "{{ py_data.version }} | Create python_major_version symlink"
36+
become: true
37+
file:
38+
src={{ py_data.install }}
39+
dest='{{ base_install_folder }}/python{{ py_data.major_version }}'
40+
state=link
41+
when: should_install and already_installed.stat.exists == false

0 commit comments

Comments
 (0)