Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
slapos-mynij-dev
Commits
6cd15818
Commit
6cd15818
authored
Oct 05, 2016
by
Alain Takoudjou
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
Show 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
...
@@ -35,6 +35,7 @@ import slapos.slap
import
netaddr
import
netaddr
import
logging
import
logging
import
errno
import
errno
import
re
import
zc.buildout
import
zc.buildout
...
@@ -59,14 +60,16 @@ class SlapConfigParser(ConfigParser, object):
...
@@ -59,14 +60,16 @@ class SlapConfigParser(ConfigParser, object):
if
sys
.
version_info
[
0
]
>
2
:
if
sys
.
version_info
[
0
]
>
2
:
return
super
(
SlapConfigParser
,
self
).
write
(
fp
)
return
super
(
SlapConfigParser
,
self
).
write
(
fp
)
regex
=
re
.
compile
(
r'^(.*)\
s+([+-]{
1})$'
)
if
self
.
_defaults
:
if
self
.
_defaults
:
fp
.
write
(
"[%s]
\
n
"
%
DEFAULTSECT
)
fp
.
write
(
"[%s]
\
n
"
%
DEFAULTSECT
)
for
(
key
,
value
)
in
self
.
_defaults
.
items
():
for
(
key
,
value
)
in
self
.
_defaults
.
items
():
if
key
.
endswith
(
" +"
)
or
key
.
endswith
(
" -"
):
op
=
""
line
=
"%s += %s
\
n
"
%
(
key
.
replace
(
' +'
,
''
).
replace
(
' -'
,
''
),
result
=
regex
.
match
(
key
)
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
if
result
is
not
None
:
else
:
key
,
op
=
result
.
groups
()
line
=
"%s = %s
\
n
"
%
(
key
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
line
=
"%s %s= %s
\
n
"
%
(
key
,
op
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
fp
.
write
(
line
)
fp
.
write
(
line
)
fp
.
write
(
"
\
n
"
)
fp
.
write
(
"
\
n
"
)
for
section
in
self
.
_sections
:
for
section
in
self
.
_sections
:
...
@@ -75,11 +78,12 @@ class SlapConfigParser(ConfigParser, object):
...
@@ -75,11 +78,12 @@ class SlapConfigParser(ConfigParser, object):
if
key
==
"__name__"
:
if
key
==
"__name__"
:
continue
continue
if
(
value
is
not
None
)
or
(
self
.
_optcre
==
self
.
OPTCRE
):
if
(
value
is
not
None
)
or
(
self
.
_optcre
==
self
.
OPTCRE
):
if
key
.
endswith
(
" +"
)
or
key
.
endswith
(
" -"
):
op
=
""
key
=
" += "
.
join
((
key
.
replace
(
' +'
,
''
).
replace
(
' -'
,
''
),
result
=
regex
.
match
(
key
)
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
)))
if
result
is
not
None
:
else
:
key
,
op
=
result
.
groups
()
key
=
" = "
.
join
((
key
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
)))
key
=
"%s %s= %s"
%
(
key
,
op
,
str
(
value
).
replace
(
'
\
n
'
,
'
\
n
\
t
'
))
fp
.
write
(
"%s
\
n
"
%
key
)
fp
.
write
(
"%s
\
n
"
%
key
)
fp
.
write
(
"
\
n
"
)
fp
.
write
(
"
\
n
"
)
...
...
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