Skip to content

Commit e6af181

Browse files
committed
Refactor: use a dictionary to store all py26 data
1 parent d0ac438 commit e6af181

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

defaults/main.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ lxml: false
1515

1616
versions:
1717
py24: "2.4.6"
18+
py26: "2.6.9"
1819

1920
##
2021
# fine grained settings
@@ -31,14 +32,15 @@ py24:
3132
install: "{{ base_install_folder }}/python{{ versions.py24 }}"
3233
bin: "{{ base_install_folder }}/python{{ versions.py24 }}/bin/python2.4"
3334

34-
py26_version: "2.6.9"
35-
py26_major_version: "2.6"
36-
py26_url: "https://www.python.org/ftp/python/{{ py26_version }}/Python-{{ py26_version }}.tar.xz"
37-
py26_md5: "933a811f11e3db3d73ae492f6c3a7a76"
38-
py26_tar_file: "/tmp/py{{ py26_version }}.tar.xz"
39-
py26_sources: "/tmp/Python-{{ py26_version }}"
40-
py26_install: "{{ base_install_folder }}/python{{ py26_version }}"
41-
py26_bin: "{{ py26_install }}/bin/python2.6"
35+
py26:
36+
version: "{{ versions.py26 }}"
37+
major_version: "2.6"
38+
url: "https://www.python.org/ftp/python/{{ versions.py26 }}/Python-{{ versions.py26 }}.tar.xz"
39+
md5: "933a811f11e3db3d73ae492f6c3a7a76"
40+
tar_file: "/tmp/py{{ versions.py26 }}.tar.xz"
41+
sources: "/tmp/Python-{{ versions.py26 }}"
42+
install: "{{ base_install_folder }}/python{{ versions.py26 }}"
43+
bin: "{{ base_install_folder }}/python{{ versions.py26 }}/bin/python2.6"
4244

4345
py27_version: "2.7.15"
4446
py27_major_version: "2.7"

tasks/python26.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
- name: py26 | Check that py26 is still not installed
44
become: true
5-
stat: path="{{ py26_bin }}"
5+
stat: path="{{ py26.bin }}"
66
register: py26_already_installed
77
ignore_errors: True
88

99
- name: py26 | Download
1010
get_url:
11-
url="{{ py26_url }}"
12-
dest="{{ py26_tar_file }}"
13-
checksum="md5:{{ py26_md5 }}"
11+
url="{{ py26.url }}"
12+
dest="{{ py26.tar_file }}"
13+
checksum="md5:{{ py26.md5 }}"
1414
when: python_26 and py26_already_installed.stat.exists == false
1515

1616
- name: py26 | Uncompress
1717
unarchive:
18-
src={{ py26_tar_file }}
18+
src={{ py26.tar_file }}
1919
dest=/tmp
2020
copy=no
21-
creates="{{ py26_sources }}"
21+
creates="{{ py26.sources }}"
2222
when: python_26 and py26_already_installed.stat.exists == false
2323

2424
- name: py26 | Configure sources
2525
become: true
26-
command: "./configure --prefix {{ py26_install }}"
26+
command: "./configure --prefix {{ py26.install }}"
2727
args:
28-
chdir: "{{ py26_sources }}"
28+
chdir: "{{ py26.sources }}"
2929
when: python_26 and py26_already_installed.stat.exists == false
3030

3131
- name: py26 | Tweak sources
3232
become: true
3333
lineinfile:
34-
dest="{{ py26_sources }}/Modules/Setup"
34+
dest="{{ py26.sources }}/Modules/Setup"
3535
regexp=^#zlib(.*)
3636
line=zlib\1
3737
backrefs=yes
@@ -40,7 +40,7 @@
4040
- name: py26 | Tweak sources
4141
become: true
4242
lineinfile:
43-
dest="{{ py26_sources }}/Modules/Setup"
43+
dest="{{ py26.sources }}/Modules/Setup"
4444
regexp=^#_sha256(.*)
4545
line=_sha256\1
4646
backrefs=yes
@@ -49,7 +49,7 @@
4949
- name: py26 | Tweak sources
5050
become: true
5151
lineinfile:
52-
dest="{{ py26_sources }}/Modules/Setup"
52+
dest="{{ py26.sources }}/Modules/Setup"
5353
regexp=^#_sha512(.*)
5454
line=_sha512\1
5555
backrefs=yes
@@ -59,7 +59,7 @@
5959
become: true
6060
command: "{{ item }}"
6161
args:
62-
chdir: "{{ py26_sources }}"
62+
chdir: "{{ py26.sources }}"
6363
with_items:
6464
- make
6565
- make install
@@ -68,7 +68,7 @@
6868
- name: py26 | Create python_major_version symlink
6969
become: true
7070
file:
71-
src={{ py26_install }}
72-
dest='{{ base_install_folder }}/python{{ py26_major_version }}'
71+
src={{ py26.install }}
72+
dest='{{ base_install_folder }}/python{{ py26.major_version }}'
7373
state=link
7474
when: python_26 and py26_already_installed.stat.exists == false

0 commit comments

Comments
 (0)