Use setup.py to install config data to python library

data under conf/ will be used by all test cases as the general
config data. Each unittest will override config data under this
dir with their specific attributes. This CL is to include config
data in the python lib.

Change-Id: I53b55591c7a70fd0a9f6634d509df6bfdeb604bd
This commit is contained in:
Xicheng Chang 2014-12-18 14:31:42 -08:00
parent d1ee9e7e36
commit f4aa063a56

View File

@ -66,6 +66,14 @@ INSTALL_REQUIRES_DIR = os.path.join(
with open(INSTALL_REQUIRES_DIR, 'r') as requires_file: with open(INSTALL_REQUIRES_DIR, 'r') as requires_file:
REQUIREMENTS = [line.strip() for line in requires_file if line != '\n'] REQUIREMENTS = [line.strip() for line in requires_file if line != '\n']
DATA_FILES_DIR = os.path.join(
os.path.dirname(__file__), 'conf')
DATA_FILES = []
for parent_dir, sub_dirs, files in os.walk(DATA_FILES_DIR):
if files == []:
pass
for file in files:
DATA_FILES.append((parent_dir, [os.path.join(parent_dir, file)]))
setup( setup(
name='compass', name='compass',
@ -94,6 +102,8 @@ setup(
'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
], ],
# data
data_files=DATA_FILES,
# test, # test,
tests_require=['tox'], tests_require=['tox'],
cmdclass={'test': Tox}, cmdclass={'test': Tox},