Homebrew search from python module name (ShellScript)

Hello. Since homebrew can install some python modules, I searched homebrew by module name.

$ pip list --format=legacy --outdated | cut -d' ' -f 1 | ./pip_homebrew_search
.sh
numpy numpy ✔
GDAL osgeo/osgeo4mac/gdal2-python ✔
Pillow homebrew/science/pillow ✔

pip_homebrew_search.sh


#!/bin/sh
if [ $# == 0 ] && [ ! -p /dev/stdin ] ; then
  declare -a pymodules=(numpy GDAL Pillow)
else
  pymodules=(`cat "$@" | tr '\n' ' '`)
fi

brewModuleName () {
  GDAL="gdal2-python"
  eval mName=\$"${1}"
  [[ -z "${mName}" ]] && mName=`echo "$1" | tr '[A-Z]' '[a-z]'`
  echo "${mName}"
}

for e in "${pymodules[@]}"; do
  /bin/echo -n "${e} "
  brew search `brewModuleName $e`
done
exit $?

Recommended Posts

Homebrew search from python module name (ShellScript)
Use the nghttp2 Python module from Homebrew from pyenv's Python
Homebrew Python --Youtube Search Program
Install pyenv from Homebrew, install Python from pyenv
Homebrew Python Part 3-Amazon Product Search Program
[Python] Download original images from Google Image Search
Csv output from Google search with [Python]! 【Easy】
sql from python
How to add a Python module search path
MeCab from Python
Python collections module
Get data from GPS module at 10Hz in Python
Call your own python module from the ROS package
Install the latest Python from pyenv installed with homebrew
Sample of getting module name and class name in Python
Use thingsspeak from python
Touch MySQL from Python 3
Sequential search with Python
Python module (Python learning memo ④)
Operate Filemaker from Python
Use fluentd from python
Create a Python module
Changes from Python 2 to Python 3.0
[Python] Search (itertools) ABC167C
Binary search in Python
Python from or import
python original module import
Use MySQL from Python
Run python from excel
Install python from source
Execute command from Python
[Python] Search (NumPy) ABC165C
Binary search (python2.7) memo
[Python] Binary search ABC155D
Operate neutron from Python!
python bit full search
Linear search in Python
Use MySQL from Python
Binary search with python
Binary search with Python3
Operate LXC from Python
Manipulate riak from python
Force Python from Fortran
Use BigQuery from python.
Name identification using python
Execute command from python
Binary search in Python (binary search)
[Python] Read From Stdin
Use mecab-ipadic-neologd from python
Image collection by calling Bing Image Search API v5 from Python
Predict gender from name using Gender API and Pykakasi in Python
[Python] Read command line arguments from file name or stdin