From 57039d7a972858da2198db095a2095bacfb4f490 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:26:41 -0800 Subject: [PATCH] Fix missing package_data (#49) * Fix missing template package_data * Troubleshoot package data * More package data troubleshooting * More package data troubleshooting --------- Co-authored-by: Daniel McKnight --- setup.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 20b98fbb..6f3e1f81 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from setuptools import setup, find_packages -from os import getenv, path +from os import getenv, path, walk BASE_PATH = path.abspath(path.dirname(__file__)) @@ -61,6 +61,21 @@ def get_requirements(requirements_filename: str): else: version = line.split("'")[1] + +def find_resource_files(): + base_path = path.join(BASE_PATH, "neon_diana_utils") + resource_base_dirs = ("docker", "templates") + package_data = [] + for res in resource_base_dirs: + if path.isdir(path.join(base_path, res)): + for (directory, _, files) in walk(path.join(base_path, res)): + if files: + package_data.append( + path.join(directory.replace(base_path, "").lstrip('/'), + '*')) + return package_data + + setup( name='neon-diana-utils', version=version, @@ -72,8 +87,7 @@ def get_requirements(requirements_filename: str): author_email='developers@neon.ai', license='BSD-3-Clause', packages=find_packages(), - package_data={'neon_diana_utils': ['templates/*', 'helm_charts/**'] - }, + package_data={'neon_diana_utils': find_resource_files()}, include_package_data=True, install_requires=get_requirements("requirements.txt"), zip_safe=True,