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
Emmanuel QUEVILLON
biomaj-migrate
Commits
cf824f23
Commit
cf824f23
authored
Feb 24, 2015
by
Olivier Sallou
Browse files
various fixes to generate a new biomaj listing
parent
ce5a9111
Changes
1
Show whitespace changes
Inline
Side-by-side
bin/biomaj-migrate.py
View file @
cf824f23
...
...
@@ -35,11 +35,12 @@ def migrate_bank(cur, bank):
prod
[
'remoterelease'
]
=
row
[
0
]
pathelts
=
prod
[
'path'
].
split
(
'/'
)
release_dir
=
pathelts
[
len
(
pathelts
)
-
1
]
prod
[
'prod_dir'
]
=
release_dir
pattern
=
re
.
compile
(
".*__(\d+)$"
)
relmatch
=
pattern
.
match
(
release_dir
)
if
relmatch
:
prod
[
'release'
]
=
prod
[
'release'
]
+
'__'
+
relmatch
.
group
(
1
)
b
=
Bank
(
bank
[
'name'
])
b
=
Bank
(
bank
[
'name'
]
,
no_log
=
True
)
prod_present
=
False
for
p
in
b
.
bank
[
'production'
]:
if
p
[
'release'
]
==
prod
[
'release'
]:
...
...
@@ -52,6 +53,20 @@ def migrate_bank(cur, bank):
b
.
session
.
_session
[
'status'
][
Workflow
.
FLOW_OVER
]
=
True
b
.
session
.
_session
[
'update'
]
=
True
b
.
save_session
()
# Listing files ?
root_files
=
[]
if
os
.
path
.
exists
(
prod
[
'path'
]):
root_files
=
os
.
listdir
(
prod
[
'path'
])
for
root_file
in
root_files
:
if
root_file
.
startswith
(
'listing.'
):
fileName
,
fileExtension
=
os
.
path
.
splitext
(
root_file
)
f
=
open
(
os
.
path
.
join
(
prod
[
'path'
],
root_file
),
'r'
)
listing
=
f
.
read
()
f
.
close
()
f
=
open
(
os
.
path
.
join
(
prod
[
'path'
],
'listingv1'
+
fileExtension
),
'w'
)
listing
=
"{
\"
files
\"
: [],
\"
name
\"
:
\"
"
+
fileExtension
.
replace
(
'.'
,
''
)
+
"
\"
,"
+
listing
+
"}"
f
.
write
(
listing
)
f
.
close
()
# Current link?
pathelts
=
prod
[
'path'
].
split
(
'/'
)
del
pathelts
[
-
1
]
...
...
@@ -149,4 +164,3 @@ def main():
if
__name__
==
'__main__'
:
main
()
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