From 7477f9e0b08457bce087379d36f1e939e393924e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 4 Jan 2021 13:13:26 -0500 Subject: [PATCH] updated python setup files so that example data is loaded correctly --- python/MANIFEST.in | 1 + python/setup.py.in | 20 ++++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) create mode 100644 python/MANIFEST.in diff --git a/python/MANIFEST.in b/python/MANIFEST.in new file mode 100644 index 000000000..41d7f0c59 --- /dev/null +++ b/python/MANIFEST.in @@ -0,0 +1 @@ +recursive-include gtsam/Data * diff --git a/python/setup.py.in b/python/setup.py.in index 1ffe978f3..9aa4b71f4 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -1,6 +1,4 @@ -import glob -import os -import sys +"""Setup file to install the GTSAM package.""" try: from setuptools import setup, find_packages @@ -10,19 +8,17 @@ except ImportError: packages = find_packages(where=".") print("PACKAGES: ", packages) -data_path = '${GTSAM_SOURCE_DIR}/examples/Data/' -data_files_and_directories = glob.glob(data_path + '**', recursive=True) -data_files = [x for x in data_files_and_directories if not os.path.isdir(x)] - package_data = { '': [ - './*.so', - './*.dll', + "./*.so", + "./*.dll", + "Data/*" # Add the data files to the package + "Data/**/*" # Add the data files in subdirectories ] } # Cleaner to read in the contents rather than copy them over. -readme_contents = open("${PROJECT_SOURCE_DIR}/README.md").read() +readme_contents = open("${GTSAM_SOURCE_DIR}/README.md").read() setup( name='gtsam', @@ -49,9 +45,9 @@ setup( 'Programming Language :: Python :: 3', ], packages=packages, + include_package_data=True, package_data=package_data, - data_files=[('${GTSAM_PYTHON_DATASET_DIR}', data_files),], test_suite="gtsam.tests", - install_requires=["numpy"], + install_requires=open("${GTSAM_SOURCE_DIR}/python/requirements.txt").readlines(), zip_safe=False, )