Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
75c37b81
Commit
75c37b81
authored
Jun 14, 2018
by
juga
Browse files
Remove v3bw file link if it exist
also fix link path
parent
0db63293
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/lib/v3bwfile.py
View file @
75c37b81
...
...
@@ -402,14 +402,21 @@ class V3BwFile(object):
def
write
(
self
,
output
):
log
.
info
(
'Writing v3bw file to %s'
,
output
)
out_dir
=
os
.
path
.
dirname
(
output
)
out_link
=
os
.
path
.
join
(
out_dir
,
'latest.v3bw'
)
if
os
.
path
.
exists
(
out_link
):
log
.
debug
(
'Deleting existing symlink before creating a new one.'
)
os
.
remove
(
out_link
)
# to keep test_generate.py working
if
output
!=
'/dev/stdout'
:
with
DirectoryLock
(
o
s
.
path
.
dirname
(
output
)
):
with
DirectoryLock
(
o
ut_dir
):
with
open
(
output
,
'wt'
)
as
fd
:
fd
.
write
(
str
(
self
.
header
))
for
line
in
self
.
bw_lines
:
fd
.
write
(
str
(
line
))
os
.
symlink
(
output
,
'latest.v3bw'
)
log
.
debug
(
'Creating symlink from {} to {}.'
.
format
(
output
,
out_link
))
os
.
symlink
(
output
,
out_link
)
else
:
with
open
(
output
,
'wt'
)
as
fd
:
fd
.
write
(
str
(
self
.
header
))
...
...
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