fix: bundle aisbf/ Python package in _share/ so share dir import works without site-packages

parent 62e93fe6
...@@ -32,7 +32,7 @@ from pathlib import Path ...@@ -32,7 +32,7 @@ from pathlib import Path
# Files and directories the share directory must contain for the server to start. # Files and directories the share directory must contain for the server to start.
_REQUIRED_FILES = ['aisbf.sh', 'main.py', 'requirements.txt'] _REQUIRED_FILES = ['aisbf.sh', 'main.py', 'requirements.txt']
_REQUIRED_DIRS = ['templates', 'static', 'config'] _REQUIRED_DIRS = ['templates', 'static', 'config', 'aisbf']
def _is_root(): def _is_root():
......
...@@ -49,7 +49,7 @@ class build_py(_build_py): ...@@ -49,7 +49,7 @@ class build_py(_build_py):
""" """
_SHARE_FILES = ['main.py', 'requirements.txt', 'aisbf.sh'] _SHARE_FILES = ['main.py', 'requirements.txt', 'aisbf.sh']
_SHARE_DIRS = ['templates', 'static', 'config'] _SHARE_DIRS = ['templates', 'static', 'config', 'aisbf']
def run(self): def run(self):
self._populate_share() self._populate_share()
...@@ -73,8 +73,10 @@ class build_py(_build_py): ...@@ -73,8 +73,10 @@ class build_py(_build_py):
src = root / dname src = root / dname
dst = share / dname dst = share / dname
if src.is_dir(): if src.is_dir():
# Exclude _share/ when copying the aisbf package — it's the
# directory we're currently building, so it must not recurse.
shutil.copytree(src, dst, shutil.copytree(src, dst,
ignore=shutil.ignore_patterns('__pycache__', '*.pyc', '*.pyo')) ignore=shutil.ignore_patterns('_share', '__pycache__', '*.pyc', '*.pyo'))
def _update_package_data(self): def _update_package_data(self):
"""Dynamically register every file copied into _share/ so setuptools """Dynamically register every file copied into _share/ so setuptools
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment