Created
January 7, 2017 22:49
-
-
Save yrps/e801d30b048e0d2737b69f512239b61f to your computer and use it in GitHub Desktop.
Determine module requirements of uninstalled PyPI packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
# Determine module requirements of uninstalled PyPI packages. | |
# For installed modules, use `pip show package1 [ package2 ... ]` | |
script="$(basename "$0")" | |
[ $# -eq 0 ] && { | |
>&2 echo "Usage: $script package1 [ package2 ... ]" | |
exit 1 | |
} | |
tmpdir="/run/user/$(id -u)" | |
[ -w "$tmpdir" ] || tmpdir=/tmp | |
tmpdir="$tmpdir/$script" | |
[ -e "$tmpdir" ] && rm -r "$tmpdir" | |
pip download "$@" --dest "$tmpdir" --no-binary :all: | | |
sed -n 's/^Collecting \(.*\) (from \(.*\))/\2: \1/p' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment