diodonfrost / ansible-role-python

Ansible role for compile and install Python 3
Apache License 2.0
11 stars 7 forks source link

Support for 3 digit python version #3

Open Grekkq opened 2 years ago

Grekkq commented 2 years ago
SUMMARY

During installation of python version >3.9 we encounter a problem with name of the installation directory, in the default python_path var you use python_version[:3] to get just main part but it generates problems when trying to install versions where there are 3 significant digits (eg. 3.10). Maybe we could split it by . and just get everything before second . (potential stackoverflow solution)?

STEPS TO REPRODUCE

Install python in version >3.9

roles:
  - role: diodonfrost.python
    become: yes
    vars:
      python_version: 3.10.4
EXPECTED RESULTS
/usr/local/python3.10/ would be default path to installation directory
ACTUAL RESULTS
/usr/local/python3.1/ only first 3 characters are being passed as a directory name
shushpan4eg commented 2 years ago

Hello @Grekkq there is a variable in defaults python_path: "/usr/local/python{{ python_version[:3] }}" you can change [:3] to [:4] and you'll get the desired outcome. I've encountered the same issue and that resolved it.

Grekkq commented 2 years ago

Thanks, yes i currently just override the default python_path:, but i think it makes sens to handle this case out of the box.

aairey commented 1 month ago

@Grekkq any chance we could get the linked PR reviewed?