From ef27a6b682bbc77b02fa9931e7b8a68267a963c7 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 12 Mar 2018 18:06:48 -0400 Subject: [PATCH] Better import paths --- pipenv/__init__.py | 10 ++++++---- pipenv/pew/__main__.py | 9 +++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pipenv/__init__.py b/pipenv/__init__.py index 57648e8a79..8819dd967a 100644 --- a/pipenv/__init__.py +++ b/pipenv/__init__.py @@ -6,13 +6,15 @@ import os import sys + +PIPENV_ROOT = os.path.dirname(os.path.realpath(__file__)) +PIPENV_VENDOR = os.sep.join([PIPENV_ROOT, 'vendor']) +PIPENV_PATCHED = os.sep.join([PIPENV_ROOT, 'patched']) # Inject vendored directory into system path. -v_path = os.path.abspath(os.path.sep.join([os.path.dirname(os.path.realpath(__file__)), 'vendor'])) -sys.path.insert(0, v_path) +sys.path.insert(0, PIPENV_VENDOR) # Inject patched directory into system path. -v_path = os.path.abspath(os.path.sep.join([os.path.dirname(os.path.realpath(__file__)), 'patched'])) -sys.path.insert(0, v_path) +sys.path.insert(0, PIPENV_PATCHED) from .cli import cli from . import resolver diff --git a/pipenv/pew/__main__.py b/pipenv/pew/__main__.py index 3792ae1ffc..03b05700ee 100644 --- a/pipenv/pew/__main__.py +++ b/pipenv/pew/__main__.py @@ -1,14 +1,11 @@ import os import sys +from ..pipenv import PIPENV_VENDOR, PIPENV_PATCHED import pew -pipenv_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -pipenv_vendor = os.sep.join([pipenv_root, 'vendor']) -pipenv_patched = os.sep.join([pipenv_root, 'patched']) - if __name__ == '__main__': - sys.path.insert(0, pipenv_vendor) - sys.path.insert(0, pipenv_patched) + sys.path.insert(0, PIPENV_VENDOR) + sys.path.insert(0, PIPENV_PATCHED) pew.pew.pew()