updated python setup files so that example data is loaded correctly

release/4.3a0
Varun Agrawal 2021-01-04 13:13:26 -05:00
parent 3a80b38a9a
commit 7477f9e0b0
2 changed files with 9 additions and 12 deletions

1
python/MANIFEST.in Normal file
View File

@ -0,0 +1 @@
recursive-include gtsam/Data *

View File

@ -1,6 +1,4 @@
import glob """Setup file to install the GTSAM package."""
import os
import sys
try: try:
from setuptools import setup, find_packages from setuptools import setup, find_packages
@ -10,19 +8,17 @@ except ImportError:
packages = find_packages(where=".") packages = find_packages(where=".")
print("PACKAGES: ", packages) 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 = { package_data = {
'': [ '': [
'./*.so', "./*.so",
'./*.dll', "./*.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. # 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( setup(
name='gtsam', name='gtsam',
@ -49,9 +45,9 @@ setup(
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
], ],
packages=packages, packages=packages,
include_package_data=True,
package_data=package_data, package_data=package_data,
data_files=[('${GTSAM_PYTHON_DATASET_DIR}', data_files),],
test_suite="gtsam.tests", test_suite="gtsam.tests",
install_requires=["numpy"], install_requires=open("${GTSAM_SOURCE_DIR}/python/requirements.txt").readlines(),
zip_safe=False, zip_safe=False,
) )