Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
aa
indexalist
Commits
464fab49
Commit
464fab49
authored
Dec 18, 2020
by
Michael Murtaugh
Browse files
normalize env variables
parent
874ff5c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
indexalist/data/templates/Sconstruct.py
View file @
464fab49
...
...
@@ -303,8 +303,8 @@ def add_attribute_to_links (src, attrname, attrvalue):
def
template_action
(
target
,
source
,
env
):
tpath
,
tname
=
os
.
path
.
split
(
env
.
Dictionary
().
get
(
"
index_template
"
))
rootpath
=
env
.
Dictionary
().
get
(
"
rootpath
"
)
tpath
,
tname
=
os
.
path
.
split
(
env
.
Dictionary
().
get
(
"
SCONS_TEMPLATE
"
))
rootpath
=
os
.
path
.
abspath
(
env
.
Dictionary
().
get
(
"
SCONS_ROOT
"
)
)
jenv
=
jinja2
.
Environment
(
loader
=
jinja2
.
FileSystemLoader
(
tpath
))
...
...
@@ -352,7 +352,7 @@ def template_action (target, source, env):
print
(
template
.
render
(
**
data
),
file
=
fout
)
# Template = Builder(action=template_action)
Template
=
Builder
(
action
=
Action
(
template_action
,
varlist
=
(
"
index_template"
,
"rootpath
"
)))
Template
=
Builder
(
action
=
Action
(
template_action
,
varlist
=
(
"
SCONS_TEMPLATE"
,
"SCONS_ROOT
"
)))
### Perform the build
builders
=
{
...
...
@@ -519,12 +519,10 @@ for folder, deps in depwalk("."):
depsmeta
.
append
(
file_meta
)
env
.
FolderMeta
(
target
=
folder_meta_path
,
source
=
deps
+
depsmeta
)
template_path
=
os
.
environ
.
get
(
"scons-template"
)
or
"templates/index.html"
root_path
=
os
.
environ
.
get
(
"scons-root"
)
or
rootdir
.
abspath
env
.
Template
(
target
=
os
.
path
.
join
(
folder
,
"index.html"
),
\
source
=
[
folder_meta_path
,
File
(
template_path
)],
\
index_template
=
template_path
,
\
rootpath
=
rootdir
.
abspath
)
SCONS_TEMPLATE
=
os
.
environ
.
get
(
"SCONS_TEMPLATE"
)
or
"templates/index.html"
,
\
SCONS_ROOT
=
os
.
environ
.
get
(
"SCONS_ROOT"
)
or
rootdir
.
abspath
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment