Skip to content

Commit

Permalink
Use plural for template(s) data dir
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed May 26, 2019
1 parent d33c5f5 commit f3391f4
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js/webpack.config.js
Expand Up @@ -14,7 +14,7 @@ var rules = [
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: 'url-loader?limit=10000&mimetype=image/svg+xml' }
]

var distRoot = path.resolve(__dirname, '..', 'share', 'jupyter', 'voila', 'template', 'default', 'static')
var distRoot = path.resolve(__dirname, '..', 'share', 'jupyter', 'voila', 'templates', 'default', 'static')

module.exports = [
{
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Expand Up @@ -75,7 +75,7 @@ class NPM(Command):

node_modules = os.path.join(node_root, 'node_modules')

template_root = os.path.join(here, 'share', 'jupyter', 'voila', 'template', 'default', 'static')
template_root = os.path.join(here, 'share', 'jupyter', 'voila', 'templates', 'default', 'static')
targets = [
os.path.join(template_root, 'voila.js')
]
Expand Down Expand Up @@ -177,9 +177,9 @@ def _download_pycurl(self, url):
return buf.getvalue()

def run(self):
css_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'index.css')
theme_light_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'theme-light.css')
theme_dark_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'theme-dark.css')
css_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'index.css')
theme_light_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'theme-light.css')
theme_dark_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'theme-dark.css')

try:
css = self._download(css_url)
Expand All @@ -194,7 +194,7 @@ def run(self):
return

try:
os.mkdir(os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static'))
os.mkdir(os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static'))
except OSError: # Use FileExistsError from python 3.3 onward.
pass
with open(css_dest, 'wb+') as f:
Expand Down Expand Up @@ -241,7 +241,7 @@ def run(self):
]

# Add all the templates
for (dirpath, dirnames, filenames) in os.walk('share/jupyter/voila/template/'):
for (dirpath, dirnames, filenames) in os.walk('share/jupyter/voila/templates/'):
if filenames:
data_files.append((dirpath, [os.path.join(dirpath, filename) for filename in filenames]))

Expand Down
6 changes: 3 additions & 3 deletions voila/paths.py
Expand Up @@ -28,7 +28,7 @@ def collect_template_paths(
- nbconvert template paths,
- static paths,
- tornado template paths,
by looking in the standard Jupyter data directories (PREFIX/share/jupyter/voila/template)
by looking in the standard Jupyter data directories (PREFIX/share/jupyter/voila/templates)
with different prefix values (user directory, sys prefix, and then system prefix) which
allows users to override templates locally.
Expand All @@ -40,8 +40,8 @@ def collect_template_paths(
# relative to the package directory (first entry, meaning with highest precedence)
search_directories = []
if DEV_MODE:
search_directories.append(os.path.abspath(os.path.join(ROOT, '..', 'share', 'jupyter', 'voila', 'template')))
search_directories.extend(jupyter_path('voila', 'template'))
search_directories.append(os.path.abspath(os.path.join(ROOT, '..', 'share', 'jupyter', 'voila', 'templates')))
search_directories.extend(jupyter_path('voila', 'templates'))

found_at_least_one = False
for search_directory in search_directories:
Expand Down

0 comments on commit f3391f4

Please sign in to comment.