Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
6cd15818
Commit
6cd15818
authored
Oct 05, 2016
by
Alain Takoudjou
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use regex to fix parse error on '+ =' when using buildout 2
parent
73c7af4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
slapos/recipe/softwaretype.py
slapos/recipe/softwaretype.py
+14
-10
No files found.
slapos/recipe/softwaretype.py
View file @
6cd15818
...
...
@@ -35,6 +35,7 @@ import slapos.slap
import
netaddr
import
logging
import
errno
import
re
import
zc.buildout
...
...
@@ -59,14 +60,16 @@ class SlapConfigParser(ConfigParser, object):
if
sys
.
version_info
[
0
]
>
2
:
return
super
(
SlapConfigParser
,
self
).
write
(
fp
)
regex
=
re
.
compile
(
r'^(.*)\
s+([+-]{
1})$'
)
if
self
.
_defaults
:
fp
.
write
(
"[%s]
\
n
"
%
DEFAULTSECT
)
for
(
key
,
value
)
in
self
.
_defaults
.
items
():
if
key
.
endswith
(
" +"
)
or
key
.
endswith
(
" -"
):
line
=
"%s += %s
\
n
"
%
(
key
.
replace
(
' +'
,
''
).
replace
(
' -'
,
''
),
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
else
:
line
=
"%s = %s
\
n
"
%
(
key
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
op
=
""
result
=
regex
.
match
(
key
)
if
result
is
not
None
:
key
,
op
=
result
.
groups
()
line
=
"%s %s= %s
\
n
"
%
(
key
,
op
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
fp
.
write
(
line
)
fp
.
write
(
"
\
n
"
)
for
section
in
self
.
_sections
:
...
...
@@ -75,11 +78,12 @@ class SlapConfigParser(ConfigParser, object):
if
key
==
"__name__"
:
continue
if
(
value
is
not
None
)
or
(
self
.
_optcre
==
self
.
OPTCRE
):
if
key
.
endswith
(
" +"
)
or
key
.
endswith
(
" -"
):
key
=
" += "
.
join
((
key
.
replace
(
' +'
,
''
).
replace
(
' -'
,
''
),
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
)))
else
:
key
=
" = "
.
join
((
key
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
)))
op
=
""
result
=
regex
.
match
(
key
)
if
result
is
not
None
:
key
,
op
=
result
.
groups
()
key
=
"%s %s= %s"
%
(
key
,
op
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
fp
.
write
(
"%s
\
n
"
%
key
)
fp
.
write
(
"
\
n
"
)
...
...
Alain Takoudjou
@alain.takoudjou
mentioned in commit
e473ed69
·
Oct 05, 2016
mentioned in commit
e473ed69
mentioned in commit e473ed696b902f2c3dace5199de1bf26072af9af
Toggle commit list
Write
Preview
Markdown
is supported
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