Skip to content

Fix shared libraries load error #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Test

on: [ push ]

jobs:
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Contributing

## Context

This action is built as a composite action, for more details kindly refer
Expand Down
18 changes: 16 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Setup python amazon linux'
name: 'Setup python on amazon linux'
description: 'Adds support to install python in amazon linux'
inputs:
python-version:
Expand All @@ -11,6 +11,13 @@ inputs:
runs:
using: "composite"
steps:
- name: Ensure dependencies of python are installed
shell: bash
run: |
sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
sudo yum install -y tar gzip wget

- name: Find exact python version
id: find-exact-python-version
shell: bash
Expand Down Expand Up @@ -47,7 +54,14 @@ runs:
shell: bash
run: |
installation_directory=${{ steps.set-installation-directory.outputs.installation_directory }}
echo "${installation_directory}/bin" >> ${GITHUB_PATH}
echo "${installation_directory}/bin" >> "${GITHUB_PATH}"

echo "The following python binaries are now available in the PATH"
ls "${installation_directory}/bin"

echo "Linking python libraries.."
ls "${installation_directory}/lib"
ldconfig "${installation_directory}/lib"

branding:
icon: 'code'
Expand Down
11 changes: 2 additions & 9 deletions install-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ set -euo pipefail

# Follows the guidelines from https://realpython.com/installing-python/#how-to-build-python-from-source-code

function setup_build_prerequisites() {
sudo yum groupinstall -y "Development Tools"
sudo yum install -y tar gzip wget
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
}

function set_aliases() {
ln -sf "${python_installation_dir}/bin/python3" "${python_installation_dir}/bin/python"
ln -sf "${python_installation_dir}/bin/pip3" "${python_installation_dir}/bin/pip"
Expand All @@ -19,15 +13,14 @@ function setup_python() {
python_version="$1"
python_installation_dir="$2"

setup_build_prerequisites

mkdir -p "${python_installation_dir}"
temp_dir=$(mktemp -d)
pushd "${temp_dir}" >/dev/null
wget "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz"
tar -zxf "Python-${python_version}.tgz"
pushd "Python-${python_version}" >/dev/null
./configure --enable-optimizations --prefix="${python_installation_dir}"
# Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
./configure --prefix="${python_installation_dir}" --enable-shared
make -j 8
make install
popd >/dev/null
Expand Down