Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
6e97ead1
Commit
6e97ead1
authored
14 years ago
by
Kelly Washington
Browse files
Options
Downloads
Patches
Plain Diff
Add early exit to message template check if it hasn't changed.
parent
d3a9d6a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/cmake/TemplateCheck.cmake
+3
-3
3 additions, 3 deletions
indra/cmake/TemplateCheck.cmake
scripts/template_verifier.py
+21
-1
21 additions, 1 deletion
scripts/template_verifier.py
with
24 additions
and
4 deletions
indra/cmake/TemplateCheck.cmake
+
3
−
3
View file @
6e97ead1
...
@@ -5,10 +5,10 @@ include(Python)
...
@@ -5,10 +5,10 @@ include(Python)
macro
(
check_message_template _target
)
macro
(
check_message_template _target
)
add_custom_command
(
add_custom_command
(
TARGET
${
_target
}
TARGET
${
_target
}
P
OST_BUILD
P
RE_LINK
COMMAND
${
PYTHON_EXECUTABLE
}
COMMAND
${
PYTHON_EXECUTABLE
}
ARGS
${
SCRIPTS_DIR
}
/template_verifier.py
ARGS
${
SCRIPTS_DIR
}
/template_verifier.py
--mode=development --cache_master
--mode=development --cache_master
${
TEMPLATE_VERIFIER_OPTIONS
}
COMMENT
"Verifying message template"
COMMENT
"Verifying message template
- See http://wiki.secondlife.com/wiki/Template_verifier.py
"
)
)
endmacro
(
check_message_template
)
endmacro
(
check_message_template
)
This diff is collapsed.
Click to expand it.
scripts/template_verifier.py
+
21
−
1
View file @
6e97ead1
...
@@ -66,6 +66,7 @@ def add_indra_lib_path():
...
@@ -66,6 +66,7 @@ def add_indra_lib_path():
import
optparse
import
optparse
import
os
import
os
import
urllib
import
urllib
import
hashlib
from
indra.ipc
import
compatibility
from
indra.ipc
import
compatibility
from
indra.ipc
import
tokenstream
from
indra.ipc
import
tokenstream
...
@@ -233,6 +234,9 @@ def run(sysargs):
...
@@ -233,6 +234,9 @@ def run(sysargs):
parser
.
add_option
(
parser
.
add_option
(
'
-c
'
,
'
--cache_master
'
,
action
=
'
store_true
'
,
dest
=
'
cache_master
'
,
'
-c
'
,
'
--cache_master
'
,
action
=
'
store_true
'
,
dest
=
'
cache_master
'
,
default
=
False
,
help
=
"""
Set to true to attempt use local cached copy of the master template.
"""
)
default
=
False
,
help
=
"""
Set to true to attempt use local cached copy of the master template.
"""
)
parser
.
add_option
(
'
-f
'
,
'
--force
'
,
action
=
'
store_true
'
,
dest
=
'
force_verification
'
,
default
=
False
,
help
=
"""
Set to true to skip the sha_1 check and force template verification.
"""
)
options
,
args
=
parser
.
parse_args
(
sysargs
)
options
,
args
=
parser
.
parse_args
(
sysargs
)
...
@@ -269,8 +273,18 @@ def run(sysargs):
...
@@ -269,8 +273,18 @@ def run(sysargs):
print
"
current:
"
,
current_filename
print
"
current:
"
,
current_filename
current_url
=
'
file://%s
'
%
current_filename
current_url
=
'
file://%s
'
%
current_filename
# retrieve the contents of the local template
and check for syntax
# retrieve the contents of the local template
current
=
fetch
(
current_url
)
current
=
fetch
(
current_url
)
hexdigest
=
hashlib
.
sha1
(
current
).
hexdigest
()
if
not
options
.
force_verification
:
# Early exist if the template hasn't changed.
sha_url
=
"
%s.sha1
"
%
current_url
current_sha
=
fetch
(
sha_url
)
if
hexdigest
==
current_sha
:
print
"
Message template SHA_1 has not changed.
"
sys
.
exit
(
0
)
# and check for syntax
current_parsed
=
llmessage
.
parseTemplateString
(
current
)
current_parsed
=
llmessage
.
parseTemplateString
(
current
)
if
options
.
cache_master
:
if
options
.
cache_master
:
...
@@ -301,6 +315,12 @@ def explain(header, compat):
...
@@ -301,6 +315,12 @@ def explain(header, compat):
if
acceptable
:
if
acceptable
:
explain
(
"
--- PASS ---
"
,
compat
)
explain
(
"
--- PASS ---
"
,
compat
)
if
options
.
force_verification
==
False
:
print
"
Updating sha1 to %s
"
%
hexdigest
sha_filename
=
"
%s.sha1
"
%
current_filename
sha_file
=
open
(
sha_filename
,
'
w
'
)
sha_file
.
write
(
hexdigest
)
sha_file
.
close
()
else
:
else
:
explain
(
"
*** FAIL ***
"
,
compat
)
explain
(
"
*** FAIL ***
"
,
compat
)
return
1
return
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment