summaryrefslogtreecommitdiff
path: root/tools/ppc64le-patch.py
blob: 2a8ff8e0a0c8ce7428834e0cece272c4afc291ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Except on bionic, Travis Linux base image for PPC64LE
platform lacks the proper
permissions to the directory ~/.cache/pip/wheels that allow
the user running travis build to install pip packages.
TODO: is someone tracking this issue? Maybe just move to bionic?
"""

import subprocess
import collections
import os


def patch():
    env = collections.defaultdict(str, os.environ)
    if env['TRAVIS_CPU_ARCH'] != 'ppc64le':
        return
    cmd = [
        'sudo',
        'chown',
        '-Rfv',
        '{USER}:{GROUP}'.format_map(env),
        os.path.expanduser('~/.cache/pip/wheels'),
    ]
    subprocess.Popen(cmd)


__name__ == '__main__' and patch()