Skip to content

Commit d0ac438

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

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

defaults/main.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@ python_36: true
1313
pillow: false
1414
lxml: false
1515

16+
versions:
17+
py24: "2.4.6"
1618

1719
##
1820
# fine grained settings
1921
##
2022
base_install_folder: "/srv"
2123

22-
py24_version: "2.4.6"
23-
py24_major_version: "2.4"
24-
py24_url: "https://www.python.org/ftp/python/{{ py24_version }}/Python-{{ py24_version }}.tar.bz2"
25-
py24_md5: "76083277f6c7e4d78992f36d7ad9018d"
26-
py24_tar_file: "/tmp/py{{ py24_version }}.tar.bz2"
27-
py24_sources: "/tmp/Python-{{ py24_version }}"
28-
py24_install: "{{ base_install_folder }}/python{{ py24_version }}"
29-
py24_bin: "{{ py24_install }}/bin/python2.4"
24+
py24:
25+
version: "{{ versions.py24 }}"
26+
major_version: "2.4"
27+
url: "https://www.python.org/ftp/python/{{ versions.py24 }}/Python-{{ versions.py24 }}.tar.bz2"
28+
md5: "76083277f6c7e4d78992f36d7ad9018d"
29+
tar_file: "/tmp/py{{ versions.py24 }}.tar.bz2"
30+
sources: "/tmp/Python-{{ versions.py24 }}"
31+
install: "{{ base_install_folder }}/python{{ versions.py24 }}"
32+
bin: "{{ base_install_folder }}/python{{ versions.py24 }}/bin/python2.4"
3033

3134
py26_version: "2.6.9"
3235
py26_major_version: "2.6"

tasks/python24.yml

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

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

99
- name: py24 | Download
1010
get_url:
11-
url="{{ py24_url }}"
12-
dest="{{ py24_tar_file }}"
13-
checksum="md5:{{ py24_md5 }}"
11+
url="{{ py24.url }}"
12+
dest="{{ py24.tar_file }}"
13+
checksum="md5:{{ py24.md5 }}"
1414
when: python_24 and py24_already_installed.stat.exists == false
1515

1616
- name: py24 | Uncompress
1717
unarchive:
18-
src={{ py24_tar_file }}
18+
src={{ py24.tar_file }}
1919
dest=/tmp
2020
copy=no
21-
creates="{{ py24_sources }}"
21+
creates="{{ py24.sources }}"
2222
when: python_24 and py24_already_installed.stat.exists == false
2323

2424
- name: py24 | Configure sources
2525
become: true
26-
command: "./configure --prefix {{ py24_install }}"
26+
command: "./configure --prefix {{ py24.install }}"
2727
args:
28-
chdir: "{{ py24_sources }}"
28+
chdir: "{{ py24.sources }}"
2929
when: python_24 and py24_already_installed.stat.exists == false
3030

3131
- name: py24 | Tweak sources
3232
become: true
3333
lineinfile:
34-
dest="{{ py24_sources }}/Modules/Setup"
34+
dest="{{ py24.sources }}/Modules/Setup"
3535
regexp=^#zlib(.*)
3636
line=zlib\1
3737
backrefs=yes
@@ -41,7 +41,7 @@
4141
become: true
4242
command: "{{ item }}"
4343
args:
44-
chdir: "{{ py24_sources }}"
44+
chdir: "{{ py24.sources }}"
4545
with_items:
4646
- make
4747
- make install
@@ -50,7 +50,7 @@
5050
- name: p24 | Create python_major_version symlink
5151
become: true
5252
file:
53-
src={{ py24_install }}
54-
dest='{{ base_install_folder }}/python{{ py24_major_version }}'
53+
src={{ py24.install }}
54+
dest='{{ base_install_folder }}/python{{ py24.major_version }}'
5555
state=link
5656
when: python_24 and py24_already_installed.stat.exists == false

0 commit comments

Comments
 (0)