From f4aa063a56ba28130fb2d76ddec80aed5842e0c4 Mon Sep 17 00:00:00 2001 From: Xicheng Chang Date: Thu, 18 Dec 2014 14:31:42 -0800 Subject: [PATCH] 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 --- setup.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/setup.py b/setup.py index e6c7f984..fe6ff1eb 100644 --- a/setup.py +++ b/setup.py @@ -66,6 +66,14 @@ INSTALL_REQUIRES_DIR = os.path.join( with open(INSTALL_REQUIRES_DIR, 'r') as requires_file: 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( name='compass', @@ -94,6 +102,8 @@ setup( 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', ], + # data + data_files=DATA_FILES, # test, tests_require=['tox'], cmdclass={'test': Tox},