forked from cerc-io/stack-orchestrator
Try another way to access packaged files
This commit is contained in:
parent
0435a71b5e
commit
b4b1ec3df8
@ -25,6 +25,7 @@ from decouple import config
|
||||
import subprocess
|
||||
import click
|
||||
import importlib
|
||||
from pathlib import Path
|
||||
from .util import include_exclude_check
|
||||
|
||||
# TODO: find a place for this
|
||||
@ -43,9 +44,10 @@ def command(ctx, include, exclude):
|
||||
dry_run = ctx.obj.dry_run
|
||||
local_stack = ctx.obj.local_stack
|
||||
|
||||
# See: https://stackoverflow.com/a/20885799/1701505
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
from . import data
|
||||
container_build_dir = importlib.resources.path(data, "container-build")
|
||||
container_build_dir = Path(__file__).absolute().parent.joinpath("data", "container-build")
|
||||
print(f"dir is: {container_build_dir}")
|
||||
|
||||
if local_stack:
|
||||
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
||||
@ -59,6 +61,7 @@ def command(ctx, include, exclude):
|
||||
if not os.path.isdir(dev_root_path):
|
||||
print('Dev root directory doesn\'t exist, creating')
|
||||
|
||||
# See: https://stackoverflow.com/a/20885799/1701505
|
||||
with importlib.resources.open_text(data, "container-image-list.txt") as container_list_file:
|
||||
containers = container_list_file.read().splitlines()
|
||||
|
||||
|
3
setup.py
3
setup.py
@ -19,7 +19,8 @@ setup(
|
||||
install_requires=[requirements],
|
||||
python_requires='>=3.7',
|
||||
include_package_data=True,
|
||||
package_data={'': ['data/*.txt']},
|
||||
# See: https://github.com/pypa/setuptools/issues/1806
|
||||
package_data={'': ['data/*', 'data/*/*', 'data/*/*/*']},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Operating System :: OS Independent",
|
||||
|
Loading…
Reference in New Issue
Block a user