Commit bd707a12 by Xavier Antoviaque

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

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