Commit bd707a12 by Xavier Antoviaque

Fix inclusion of static assets in pip package when not from source

parent 3f47c54b
......@@ -2,4 +2,5 @@
*.pyc
xblock_mentoring.egg-info
workbench.sqlite
templates/xml
mentoring/templates/xml
dist
......@@ -45,7 +45,6 @@ def load_resource(resource_path):
"""
Gets the content of a resource
"""
resource_path = os.path.join('..', resource_path)
resource_content = pkg_resources.resource_string(__name__, resource_path)
return unicode(resource_content)
......
......@@ -29,9 +29,10 @@ from setuptools import setup
# Functions #########################################################
def package_data(pkg, root):
def package_data(pkg, root_list):
"""Generic function to find package_data for `pkg` under `root`."""
data = []
for root in root_list:
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))
......@@ -70,5 +71,5 @@ setup(
'xblock.v1': BLOCKS,
'xblock.light_children': BLOCKS_CHILDREN,
},
package_data=package_data("mentoring", "static"),
package_data=package_data("mentoring", ["static", "templates"]),
)
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