Skip to content

Commit

Permalink
Added the pip user control flag
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jul 11, 2019
1 parent d1cd7f7 commit d987db3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/configuration.md
Expand Up @@ -174,3 +174,4 @@ The following are reserved configuration variables that modify Appier's behavior
| **LOCALE** | `str` | The default locale value to be used for language, region and any special variant preferences. |
| **APPIER_BASE_PATH** | `str` | Override the default base path for the app (calculated as a relative directory to the main app file) (default: `None`). |
| **HIGHLIGHTER** | `str` | The name of the syntax highlighting library to be used in the main set of Appier pages, including the default HTML error page (eg: `prism`, `highlight.js`) (default: `prism`). |
| **PIP_USER** | `bool` | If the appier controller `pip_install` operation should be done at an user level. |
4 changes: 3 additions & 1 deletion src/appier/util.py
Expand Up @@ -56,6 +56,7 @@
import subprocess

from . import smtp
from . import config
from . import legacy
from . import common
from . import defines
Expand Down Expand Up @@ -404,10 +405,11 @@ def ensure_pip(name, package = None, delayed = False):
except ImportError:
install_pip_s(package, delayed = delayed)

def install_pip(package, delayed = False, user = False):
def install_pip(package, delayed = False, user = None):
import pip #@UnusedImport
try: import pip._internal
except ImportError: pip._internal = None
user = config.conf("PIP_USER", False, cast = bool)
args = ["install", package]
if hasattr(pip._internal, "main"): pip_main = pip._internal.main
else: pip_main = pip.main #@UndefinedVariable
Expand Down

0 comments on commit d987db3

Please sign in to comment.