Skip to content

Commit 33c0e85

Browse files
authored
Merge pull request #10 from singleplatform-eng/SPROD-7700_update_python_for_ubuntu_1804
Sprod 7700 update python for ubuntu 1804
2 parents 2b3d3a8 + e9cb704 commit 33c0e85

File tree

8 files changed

+53
-22
lines changed

8 files changed

+53
-22
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services: docker
33

44
env:
55
- distro: ubuntu1404
6+
- distro: ubuntu1804
67

78
script:
89
# Run tests.

defaults/main.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,9 @@ python_pip_prefix: '/usr/local'
2828
python_pip_path: "{{python_pip_prefix}}/bin/pip{{python_major_version}}"
2929
python_tar_dir: "Python-{{python_version}}"
3030
python_tar_url: "https://www.python.org/ftp/python/{{python_version}}/{{python_tar_dir}}.tgz"
31-
python_dependencies:
32-
- build-essential
33-
- libbz2-dev
34-
- libdb-dev
35-
- libexpat1-dev
36-
- libffi-dev
37-
- libgdbm-dev
38-
- liblzma-dev
39-
- libncurses-dev
40-
- libreadline-dev
41-
- libsqlite3-dev
42-
- libssl-dev
43-
- python-dev
44-
- tk-dev
45-
- zlib1g-dev
4631

4732
# Needed to get around restrictive umask on CIS-supplied images. Setting to Ubuntu default of 0022.
4833
python_pip_umask: '0022'
34+
python_pip_module_opts: --default-pip
35+
36+
python_build_opts: --with-zlib-dir=/lib

meta/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ galaxy_info:
88
platforms:
99
- name: Ubuntu
1010
versions:
11+
- bionic
1112
- trusty
1213

1314
galaxy_tags:

tasks/build_source.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22

3+
- name: Include dist dependency vars
4+
include_vars:
5+
file: "{{ansible_distribution_release}}.yml"
6+
when: python_dependencies is not defined
7+
38
- name: Install dependencies
49
apt: name="{{item}}" update_cache=yes cache_valid_time=86400
510
with_items: "{{python_dependencies}}"
@@ -14,6 +19,6 @@
1419
file: path="{{python_configure_prefix}}" state=directory
1520

1621
- name: Build python
17-
shell: "./configure --prefix={{python_configure_prefix}}; make; make install"
22+
shell: "./configure --prefix={{python_configure_prefix}} {{python_build_opts}}; make; make install"
1823
args:
1924
chdir: "/tmp/{{python_tar_dir}}"

tasks/install_pip.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
- name: Install python3-distutils
33
package:
44
name: python3-distutils
5-
when: ansible_distribution_release == 'bionic'
5+
when: ansible_distribution_major_version|int >= 16
66

7-
- name: Download get-pip.py
8-
get_url: url=https://bootstrap.pypa.io/get-pip.py dest=/tmp/
97

10-
- name: Install pip
11-
command: "{{python_path}} /tmp/get-pip.py"
8+
- name: Install Pip
9+
block:
10+
- name: Module Install
11+
command: "{{python_path}} -m ensurepip {{python_pip_module_opts}}"
12+
rescue:
13+
- name: Download get-pip
14+
get_url: url=https://bootstrap.pypa.io/get-pip.py dest=/tmp/
15+
- name: Run get-pip
16+
command: "{{python_path}} /tmp/get-pip.py"

tasks/main.yml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
# Install packages
3535
- name: Install virtualenv
3636
pip: name=virtualenv executable="{{python_pip_path}}" umask="{{python_pip_umask}}"
37-
when: python_major_version == '2'
3837

3938
- name: Install global packages
4039
pip: name="{{item}}" state=present executable="{{python_pip_path}}" umask="{{python_pip_umask}}"

vars/bionic.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
python_dependencies:
3+
- build-essential
4+
- libbz2-1.0
5+
- libc6
6+
- libdb5.3
7+
- libexpat1
8+
- libffi6
9+
- libncursesw5
10+
- libreadline7
11+
- libsqlite3-0
12+
- libssl1.0.0
13+
- libssl1.0-dev
14+
- libtinfo5
15+
- mime-support
16+
- zlib1g
17+
- zlib1g-dev

vars/trusty.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
python_dependencies:
2+
- build-essential
3+
- libbz2-dev
4+
- libdb-dev
5+
- libexpat1-dev
6+
- libffi-dev
7+
- libgdbm-dev
8+
- liblzma-dev
9+
- libncurses-dev
10+
- libreadline-dev
11+
- libsqlite3-dev
12+
- libssl-dev
13+
- python-dev
14+
- tk-dev
15+
- zlib1g-dev

0 commit comments

Comments
 (0)