2

My company requires that when we distribute a python package we must include a license agreement that the installer must agree to before the install proceeds. Any way to make pip interactive?

Example: pip install mypackage

No hanky panky!

Do you agree to the terms? : y

pip install continues....

1 Answers1

1

Have you tried piping yes?

yes | pip install mypackage

EDIT:

I don't think pip can do that, but you can script it:

cat license.txt
read -p "Do you agree to the terms? " -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
    pip install mypackage
fi

Brutally stolen from https://stackoverflow.com/a/1885534/1178781

Community
  • 1
  • 1
justderb
  • 2,835
  • 1
  • 25
  • 38
  • I think the question is how to make `pip` block and ask for confirmation, not how to provide the confirmation. – chepner Jun 13 '14 at 23:54