Force installation of dependencies in entry points

pull/2257/head
Jimmy Brisson 2016-07-26 14:08:26 -05:00
parent d2dbce0059
commit 0a2c35c62b
5 changed files with 44 additions and 0 deletions

View File

@ -26,6 +26,13 @@ from os.path import join, abspath, dirname
ROOT = abspath(join(dirname(__file__), ".."))
sys.path.insert(0, ROOT)
from tools.utils import install_from_pip
with open(join(ROOT, "requirements.txt")) as reqs:
for req in reqs:
install_from_pip(req)
import site
reload(site)
from tools.toolchains import TOOLCHAINS
from tools.toolchains import mbedToolchain

View File

@ -27,6 +27,14 @@ from os.path import join, abspath, dirname, isfile, isdir
ROOT = abspath(join(dirname(__file__), ".."))
sys.path.insert(0, ROOT)
from tools.utils import install_from_pip
with open(join(ROOT, "requirements.txt")) as reqs:
for req in reqs:
install_from_pip(req)
import site
reload(site)
from tools.utils import args_error
from tools.paths import BUILD_DIR
from tools.paths import RTOS_LIBRARIES
@ -50,6 +58,7 @@ from argparse import ArgumentTypeError
from tools.toolchains import mbedToolchain
from tools.settings import CLI_COLOR_MAP
if __name__ == '__main__':
# Parse Options
parser = get_default_options_parser()

View File

@ -3,6 +3,14 @@ from os.path import join, abspath, dirname, exists, basename
ROOT = abspath(join(dirname(__file__), ".."))
sys.path.insert(0, ROOT)
from tools.utils import install_from_pip
with open(join(ROOT, "requirements.txt")) as reqs:
for req in reqs:
install_from_pip(req)
import site
reload(site)
from shutil import move, rmtree
from argparse import ArgumentParser
from os import path

View File

@ -26,6 +26,14 @@ import fnmatch
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, ROOT)
from tools.utils import install_from_pip
with open(os.path.join(ROOT, "requirements.txt")) as reqs:
for req in reqs:
install_from_pip(req)
import site
reload(site)
from tools.test_api import test_path_to_name, find_tests, print_tests, build_tests, test_spec_from_test_builds
from tools.options import get_default_options_parser
from tools.build_api import build_project, build_library

View File

@ -318,3 +318,15 @@ def argparse_dir_not_parent(other):
else:
return not_parent
return parse_type
def install_from_pip(package):
import pkg_resources
try:
pkg_resources.working_set.require(package)
except (pkg_resources.DistributionNotFound, pkg_resources.VersionConflict):
import pip
try:
pip.main(['install', '--user', '-q', package])
except IOError as exc:
if exc.errno == 13:
print "please retry with sudo"