Merge "Consistently set sys path when using local tools"

This commit is contained in:
Jenkins 2016-10-19 16:02:12 +00:00 committed by Gerrit Code Review
commit 039eb8d79a
4 changed files with 18 additions and 9 deletions

View File

@ -15,6 +15,9 @@
import os import os
import sys import sys
# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools instead of
# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join( PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../..')) os.path.dirname(os.path.realpath(__file__)), '../..'))
if PROJECT_ROOT not in sys.path: if PROJECT_ROOT not in sys.path:

View File

@ -16,11 +16,20 @@ import argparse
import os import os
import random import random
import string import string
import sys
import uuid import uuid
import yaml import yaml
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools instead of
# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../..'))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
def generate_RSA(bits=4096): def generate_RSA(bits=4096):
new_key = RSA.generate(bits, os.urandom) new_key = RSA.generate(bits, os.urandom)

View File

@ -37,13 +37,11 @@ from oslo_config import cfg
from requests import exceptions as requests_exc from requests import exceptions as requests_exc
import six import six
# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools instead of
# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join( PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../..')) os.path.dirname(os.path.realpath(__file__)), '../..'))
# NOTE(SamYaple): Update the search patch to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools/build.py
# instead of pip installed kolla-build tool
if PROJECT_ROOT not in sys.path: if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT) sys.path.insert(0, PROJECT_ROOT)

View File

@ -24,12 +24,11 @@ import pkg_resources
import prettytable import prettytable
import requests import requests
# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools instead of
# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join( PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..')) os.path.dirname(os.path.realpath(__file__)), '..'))
# NOTE(SamYaple): Update the search patch to prefer PROJECT_ROOT as the source
# of packages to import if we are using local tools/build.py
# instead of pip installed kolla-build tool
if PROJECT_ROOT not in sys.path: if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT) sys.path.insert(0, PROJECT_ROOT)