Fix python shebang to match python3

In some of scripts we still have python shebang "#!/usr/bin/env python"
which fails in python3 hosts.
In packages it's fixed by adding pathfix.py tasks to spec files.
Add the same behavior here as we build from source, not packages.

Change-Id: I6d4f68f26b8b541bb79ae17f08015d5f27c9b7c3
This commit is contained in:
Sagi Shnaidman
2019-07-25 17:51:11 +03:00
parent c46e47dde1
commit 91292bca82
2 changed files with 34 additions and 0 deletions

View File

@@ -17,6 +17,24 @@
- "{{ python_version[python_v] }}-pip"
- "{{ python_version[python_v] }}-virtualenv"
- when: python_v == "py3"
block:
- name: Install python3-devel with provides pathfix.py
package:
name: python3-devel
state: present
become: true
- name: Create a script that fixes shebang for python3
template:
src: pathfix_repos.sh.j2
dest: "{{ workspace }}/pathfix_repos.sh"
mode: u=rwx
- name: Fix shebang path for python3
shell: bash {{ workspace }}/pathfix_repos.sh
- name: pip install tripleo items
become: true
pip:

View File

@@ -0,0 +1,16 @@
#!/usr/bin/bash
# In some of scripts we still have python shebang "#!/usr/bin/env python"
# which fails in python3 hosts.
# In packages it's fixed by adding pathfix.py tasks to spec files.
# Add the same behavior here as we build from source, not packages.
for python_file in "
{{ openstack_git_root }}/tripleo-image-elements/elements/os-svc-install/bin/map-services-tripleo
{{ openstack_git_root }}/diskimage-builder/diskimage_builder/lib/outfilter.py
{{ openstack_git_root }}/diskimage-builder/diskimage_builder/elements/package-installs/bin/package-installs-squash
{{ openstack_git_root }}/diskimage-builder/diskimage_builder/elements/svc-map/extra-data.d/10-merge-svc-map-files
{{ openstack_git_root }}/diskimage-builder/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror
{{ openstack_git_root }}/diskimage-builder/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/targetcli-wrapper
"
do
/usr/bin/pathfix.py -pni /usr/bin/python3 $python_file
done