xref: /aosp_15_r20/external/executorch/third-party/link_python.sh (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1#!/bin/bash
2# Copyright (c) Meta Platforms, Inc. and affiliates.
3# All rights reserved.
4#
5# This source code is licensed under the BSD-style license found in the
6# LICENSE file in the root directory of this source tree.
7
8# Links the path of python3 include directory to the first argument (for
9# example, a buck2 out directory).
10
11set -e
12
13# "-I/path/to/include -I/path/to/include" -> "/path/to/include"
14INCLUDE=$(python3-config --includes | cut -d' ' -f1 | sed -r 's/^.{2}//')
15
16ln -s "$INCLUDE" "$1"/include
17