Restructure lib directory to install via pip

This change allows the currently existing modules to be imported from
the `osa_toolkit` package.

In order to install the python modules used by the inventory via
setup.py with pbr, we need to rename the lib directory to match the name
of the package we wish to install.

pbr doesn't allow for doing any kind of directory renaming within the
setup.{cfg,py} files, but we need to keep using it in order to consume
global requirements updates.

Change-Id: Idb7780f55e4a1fd77dd76becbf67c1ccbf220db7
This commit is contained in:
Nolan Brubaker 2017-03-02 11:45:21 -05:00
parent 4fb05ce306
commit 2be3319ac9
17 changed files with 12 additions and 9 deletions

View File

@ -20,7 +20,7 @@ import os
import sys
current_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
lib_path = os.path.join(current_path, '..', '..', 'lib')
lib_path = os.path.join(current_path, '..', '..', 'osa_toolkit')
sys.path.append(lib_path)
import generate

View File

@ -20,7 +20,7 @@ import os
import sys
cwd = os.path.abspath(os.path.dirname(__file__))
import_path = os.path.join(cwd, '..', 'lib')
import_path = os.path.join(cwd, '..', 'osa_toolkit')
sys.path.append(import_path)
import tools

View File

@ -27,7 +27,7 @@ import os
import sys
cwd = os.path.abspath(os.path.dirname(__file__))
import_path = os.path.join(cwd, '..', 'lib')
import_path = os.path.join(cwd, '..', 'osa_toolkit')
sys.path.append(import_path)
import manage

View File

@ -22,3 +22,6 @@ warnerrors = True
[wheel]
universal = 1
[files]
packages = osa_toolkit

View File

@ -17,7 +17,7 @@ from os import path
import sys
import unittest
LIB_DIR = 'lib'
LIB_DIR = 'osa_toolkit'
sys.path.append(path.join(os.getcwd(), LIB_DIR))

View File

@ -24,7 +24,7 @@ from test_inventory import get_inventory
from test_inventory import make_config
INV_DIR = 'playbooks/inventory'
LIB_DIR = 'lib'
LIB_DIR = 'osa_toolkit'
sys.path.append(path.join(os.getcwd(), LIB_DIR))
sys.path.append(path.join(os.getcwd(), INV_DIR))

View File

@ -23,7 +23,7 @@ import warnings
import yaml
INV_DIR = 'playbooks/inventory'
LIB_DIR = 'lib'
LIB_DIR = 'osa_toolkit'
sys.path.append(path.join(os.getcwd(), LIB_DIR))
sys.path.append(path.join(os.getcwd(), INV_DIR))

View File

@ -17,7 +17,7 @@ from os import path
import sys
import unittest
LIB_DIR = path.join(os.getcwd(), 'lib')
LIB_DIR = path.join(os.getcwd(), 'osa_toolkit')
sys.path.append(LIB_DIR)

View File

@ -18,7 +18,7 @@ import sys
import test_inventory
import unittest
MANAGE_DIR = path.join(os.getcwd(), 'lib')
MANAGE_DIR = path.join(os.getcwd(), 'osa_toolkit')
TARGET_DIR = path.join(os.getcwd(), 'tests', 'inventory')
sys.path.append(MANAGE_DIR)

View File

@ -154,7 +154,7 @@ commands =
coverage run -a {toxinidir}/tests/test_dictutils.py
coverage run -a {toxinidir}/tests/test_ip.py
coverage run -a {toxinidir}/tests/test_filesystem.py
coverage report --show-missing --include={toxinidir}/playbooks/inventory/*,{toxinidir}/lib/*
coverage report --show-missing --include={toxinidir}/playbooks/inventory/*,{toxinidir}/osa_toolkit/*
[testenv:linters]