Skip to content

Commit

Permalink
Fix missing package_data (#49)
Browse files Browse the repository at this point in the history
* Fix missing template package_data

* Troubleshoot package data

* More package data troubleshooting

* More package data troubleshooting

---------

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Nov 21, 2023
1 parent 390d140 commit 57039d7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))

Expand Down Expand Up @@ -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,
Expand All @@ -72,8 +87,7 @@ def get_requirements(requirements_filename: str):
author_email='[email protected]',
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,
Expand Down

0 comments on commit 57039d7

Please sign in to comment.