Skip to content

Commit cfab586

Browse files
committed
Modified: includes are now recursive (#233)
1 parent 61c8db8 commit cfab586

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

setup.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
import os
22
from setuptools import setup, find_packages
33

4+
5+
def package_files(directory):
6+
paths = []
7+
for (path, directories, filenames) in os.walk(directory):
8+
for filename in filenames:
9+
# Generate the path relative to the package
10+
rel_path = os.path.relpath(os.path.join(path, filename), directory)
11+
# Replace the directory base in the relative path with the correct package path
12+
package_path = os.path.join('libreforms_fastapi/app', rel_path)
13+
paths.append(package_path)
14+
return paths
15+
16+
# Walk the static and template directories to ensure contents included recursively
17+
static_files = package_files('libreforms_fastapi/app/static')
18+
template_files = package_files('libreforms_fastapi/app/templates')
19+
20+
421
def read_version():
522
with open('libreforms_fastapi/__metadata__.py', 'r') as f:
623
lines = f.readlines()
@@ -61,7 +78,7 @@ def read_version():
6178
#
6279
include_package_data=True,
6380
package_data={
64-
'libreforms_fastapi.app': ['static/*', 'templates/*.jinja'],
81+
'libreforms_fastapi.app': static_files + template_files,
6582
},
6683
extras_require={
6784
"data": install_extras_data,

0 commit comments

Comments
 (0)