|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +set -e |
| 17 | +# download miniconda.sh |
| 18 | +if [[ `uname -s` == "Darwin" ]]; then |
| 19 | + if [[ `uname -m` == "arm64" ]]; then |
| 20 | + wget "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-arm64.sh" -O "miniconda.sh" |
| 21 | + else |
| 22 | + wget "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-x86_64.sh" -O "miniconda.sh" |
| 23 | + fi |
| 24 | +else |
| 25 | + wget "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-Linux-x86_64.sh" -O "miniconda.sh" |
| 26 | +fi |
| 27 | + |
| 28 | +# add the execution permission |
| 29 | +chmod +x miniconda.sh |
| 30 | + |
| 31 | +# create python virtual environment |
| 32 | +./miniconda.sh -b -p venv |
| 33 | + |
| 34 | +# activate the conda python virtual environment |
| 35 | +source venv/bin/activate "" |
| 36 | + |
| 37 | +# install PyFlink dependency |
| 38 | +if [[ $1 = "" ]]; then |
| 39 | + # install the latest version of pyflink |
| 40 | + pip install apache-flink |
| 41 | +else |
| 42 | + # install the specified version of pyflink |
| 43 | + pip install "apache-flink==$1" |
| 44 | +fi |
| 45 | + |
| 46 | +# deactivate the conda python virtual environment |
| 47 | +conda deactivate |
| 48 | + |
| 49 | +# remove the cached packages |
| 50 | +rm -rf venv/pkgs |
| 51 | + |
| 52 | +# package the prepared conda python virtual environment |
| 53 | +zip -r venv.zip venv |
0 commit comments