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
8881b47d
Commit
8881b47d
authored
11 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
MAINT-3331: On update, remove com.secondlife.indra.viewer.savedState.
parent
c7057c14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/viewer_components/updater/scripts/darwin/update_install.py
+32
-5
32 additions, 5 deletions
...iewer_components/updater/scripts/darwin/update_install.py
with
32 additions
and
5 deletions
indra/viewer_components/updater/scripts/darwin/update_install.py
+
32
−
5
View file @
8881b47d
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
import
os
import
os
import
sys
import
sys
import
cgitb
import
cgitb
from
contextlib
import
contextmanager
import
errno
import
errno
import
glob
import
glob
import
plistlib
import
plistlib
...
@@ -32,6 +33,11 @@
...
@@ -32,6 +33,11 @@
TITLE
=
"
Second Life Viewer Updater
"
TITLE
=
"
Second Life Viewer Updater
"
# Magic bundle identifier used by all Second Life viewer bundles
# Magic bundle identifier used by all Second Life viewer bundles
BUNDLE_IDENTIFIER
=
"
com.secondlife.indra.viewer
"
BUNDLE_IDENTIFIER
=
"
com.secondlife.indra.viewer
"
# Magic OS directory name that causes Cocoa viewer to crash on OS X 10.7.5
# (see MAINT-3331)
STATE_DIR
=
os
.
path
.
join
(
os
.
environ
[
"
HOME
"
],
"
Library
"
,
"
Saved Application State
"
,
BUNDLE_IDENTIFIER
+
"
.savedState
"
)
# Global handle to the MessageFrame so we can update message
# Global handle to the MessageFrame so we can update message
FRAME
=
None
FRAME
=
None
...
@@ -136,6 +142,23 @@ def write_marker(markerfile, markertext):
...
@@ -136,6 +142,23 @@ def write_marker(markerfile, markertext):
# try to log it -- otherwise shrug.
# try to log it -- otherwise shrug.
log
(
"
%s exception: %s
"
%
(
err
.
__class__
.
__name__
,
err
))
log
(
"
%s exception: %s
"
%
(
err
.
__class__
.
__name__
,
err
))
# ****************************************************************************
# Utility
# ****************************************************************************
@contextmanager
def
allow_errno
(
errn
):
"""
Execute body of
'
with
'
statement, accepting OSError with specific errno
'
errn
'
. Propagate any other exception, or an OSError with any other errno.
"""
try
:
# run the body of the 'with' statement
yield
except
OSError
,
err
:
# unless errno == passed errn, re-raise the exception
if
err
.
errno
!=
errn
:
raise
# ****************************************************************************
# ****************************************************************************
# Main script logic
# Main script logic
# ****************************************************************************
# ****************************************************************************
...
@@ -158,12 +181,9 @@ def fail(message):
...
@@ -158,12 +181,9 @@ def fail(message):
# Move the old updater.log file out of the way
# Move the old updater.log file out of the way
logname
=
os
.
path
.
join
(
logsdir
,
"
updater.log
"
)
logname
=
os
.
path
.
join
(
logsdir
,
"
updater.log
"
)
try
:
# Nonexistence is okay. Anything else, not so much.
with
allow_errno
(
errno
.
ENOENT
):
os
.
rename
(
logname
,
logname
+
"
.old
"
)
os
.
rename
(
logname
,
logname
+
"
.old
"
)
except
OSError
,
err
:
# Nonexistence is okay. Anything else, not so much.
if
err
.
errno
!=
errno
.
ENOENT
:
raise
# Open new updater.log.
# Open new updater.log.
global
LOGF
global
LOGF
...
@@ -345,6 +365,13 @@ def fail(message):
...
@@ -345,6 +365,13 @@ def fail(message):
log
(
"
touch
"
+
appdir
)
log
(
"
touch
"
+
appdir
)
os
.
utime
(
appdir
,
None
)
# set to current time
os
.
utime
(
appdir
,
None
)
# set to current time
# MAINT-3331: remove STATE_DIR. Empirically, this resolves a
# persistent, mysterious crash after updating our viewer on an OS
# X 10.7.5 system.
log
(
"
rm -rf
'
%s
'"
%
STATE_DIR
)
with
allow_errno
(
errno
.
ENOENT
):
shutil
.
rmtree
(
STATE_DIR
)
command
=
[
"
open
"
,
appdir
]
command
=
[
"
open
"
,
appdir
]
log
(
'
'
.
join
(
command
))
log
(
'
'
.
join
(
command
))
subprocess
.
check_call
(
command
,
stdout
=
LOGF
,
stderr
=
subprocess
.
STDOUT
)
subprocess
.
check_call
(
command
,
stdout
=
LOGF
,
stderr
=
subprocess
.
STDOUT
)
...
...
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