Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.cmmi
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
Xavier Thompson
slapos.recipe.cmmi
Commits
d5199b9d
Commit
d5199b9d
authored
May 30, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Python 3
parent
26f3d2e9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+6
-6
slapos/recipe/cmmi/tests.py
slapos/recipe/cmmi/tests.py
+9
-8
No files found.
slapos/recipe/cmmi/__init__.py
View file @
d5199b9d
...
@@ -73,7 +73,7 @@ class Recipe(object):
...
@@ -73,7 +73,7 @@ class Recipe(object):
dependencies
=
[]
dependencies
=
[]
for
part
in
options
.
get
(
'dependencies'
,
''
).
split
():
for
part
in
options
.
get
(
'dependencies'
,
''
).
split
():
m
=
md5
()
m
=
md5
()
for
(
k
,
v
)
in
self
.
buildout
[
part
].
iteritem
s
():
for
v
in
self
.
buildout
[
part
].
value
s
():
m
.
update
(
v
)
m
.
update
(
v
)
dependencies
.
append
(
m
.
hexdigest
())
dependencies
.
append
(
m
.
hexdigest
())
options
[
'dependencies'
]
=
' '
.
join
(
dependencies
)
options
[
'dependencies'
]
=
' '
.
join
(
dependencies
)
...
@@ -194,7 +194,7 @@ class Recipe(object):
...
@@ -194,7 +194,7 @@ class Recipe(object):
elif
retcode
>
0
:
elif
retcode
>
0
:
log
.
error
(
'Command failed with exit code %s: %s'
%
(
retcode
,
args
))
log
.
error
(
'Command failed with exit code %s: %s'
%
(
retcode
,
args
))
raise
zc
.
buildout
.
UserError
(
'System error'
)
raise
zc
.
buildout
.
UserError
(
'System error'
)
except
OSError
,
e
:
except
OSError
as
e
:
log
.
error
(
'Command failed: %s: %s'
%
(
e
,
args
))
log
.
error
(
'Command failed: %s: %s'
%
(
e
,
args
))
raise
zc
.
buildout
.
UserError
(
'System error'
)
raise
zc
.
buildout
.
UserError
(
'System error'
)
return
files
.
splitlines
()
return
files
.
splitlines
()
...
@@ -202,8 +202,8 @@ class Recipe(object):
...
@@ -202,8 +202,8 @@ class Recipe(object):
def
check_promises
(
self
,
log
=
None
):
def
check_promises
(
self
,
log
=
None
):
result
=
True
result
=
True
log
=
logging
.
getLogger
(
self
.
name
)
log
=
logging
.
getLogger
(
self
.
name
)
for
path
in
filter
(
None
,
self
.
options
[
'promises'
].
splitlines
()
):
for
path
in
self
.
options
[
'promises'
].
splitlines
(
):
if
not
os
.
path
.
exists
(
path
):
if
path
and
not
os
.
path
.
exists
(
path
):
result
=
False
result
=
False
log
.
warning
(
'could not find promise "%s"'
%
path
)
log
.
warning
(
'could not find promise "%s"'
%
path
)
return
result
return
result
...
@@ -412,9 +412,9 @@ class Recipe(object):
...
@@ -412,9 +412,9 @@ class Recipe(object):
st_mode
=
os
.
stat
(
f_abspath
).
st_mode
st_mode
=
os
.
stat
(
f_abspath
).
st_mode
if
not
stat
.
S_ISREG
(
st_mode
):
if
not
stat
.
S_ISREG
(
st_mode
):
continue
continue
with
open
(
f_abspath
)
as
f
:
with
open
(
f_abspath
,
'rb'
)
as
f
:
header
=
f
.
readline
(
128
)
header
=
f
.
readline
(
128
)
if
header
.
startswith
(
'#!'
)
and
header
[
-
1
]
!=
'
\
n
'
:
if
header
.
startswith
(
b'#!'
)
and
header
[
-
1
]
!=
b
'
\
n
'
:
os
.
rename
(
f_abspath
,
f_abspath
+
'.shebang'
)
os
.
rename
(
f_abspath
,
f_abspath
+
'.shebang'
)
with
open
(
f_abspath
,
'w'
)
as
f
:
with
open
(
f_abspath
,
'w'
)
as
f
:
os
.
fchmod
(
f
.
fileno
(),
stat
.
S_IMODE
(
st_mode
))
os
.
fchmod
(
f
.
fileno
(),
stat
.
S_IMODE
(
st_mode
))
...
...
slapos/recipe/cmmi/tests.py
View file @
d5199b9d
...
@@ -135,8 +135,8 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -135,8 +135,8 @@ class NonInformativeTests(unittest.TestCase):
def
test_environment_restored_after_building_a_part
(
self
):
def
test_environment_restored_after_building_a_part
(
self
):
# Make sure the test variables do not exist beforehand
# Make sure the test variables do not exist beforehand
self
.
failIf
(
'HRC_FOO'
in
os
.
environ
)
self
.
assertFalse
(
'HRC_FOO'
in
os
.
environ
)
self
.
failIf
(
'HRC_BAR'
in
os
.
environ
)
self
.
assertFalse
(
'HRC_BAR'
in
os
.
environ
)
# Place a sentinel value to make sure the original environment is
# Place a sentinel value to make sure the original environment is
# maintained
# maintained
os
.
environ
[
'HRC_SENTINEL'
]
=
'sentinel'
os
.
environ
[
'HRC_SENTINEL'
]
=
'sentinel'
...
@@ -150,8 +150,8 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -150,8 +150,8 @@ class NonInformativeTests(unittest.TestCase):
# Make sure the test variables are not kept in the environment after
# Make sure the test variables are not kept in the environment after
# the part has been built.
# the part has been built.
self
.
failIf
(
'HRC_FOO'
in
os
.
environ
)
self
.
assertFalse
(
'HRC_FOO'
in
os
.
environ
)
self
.
failIf
(
'HRC_BAR'
in
os
.
environ
)
self
.
assertFalse
(
'HRC_BAR'
in
os
.
environ
)
# Make sure the sentinel value is still in the environment
# Make sure the sentinel value is still in the environment
self
.
assertEqual
(
os
.
environ
.
get
(
'HRC_SENTINEL'
),
'sentinel'
)
self
.
assertEqual
(
os
.
environ
.
get
(
'HRC_SENTINEL'
),
'sentinel'
)
...
@@ -224,7 +224,7 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -224,7 +224,7 @@ class NonInformativeTests(unittest.TestCase):
url
=
'%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
)
url
=
'%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
)
file
,
is_temp
=
recipe
.
download_file
(
url
)
file
,
is_temp
=
recipe
.
download_file
(
url
)
self
.
assertFalse
(
is_temp
)
self
.
assertFalse
(
is_temp
)
self
.
assertEqual
s
(
file
,
url
)
self
.
assertEqual
(
file
,
url
)
url
=
'ftp://ftp.gnu.org/welcome.msg'
url
=
'ftp://ftp.gnu.org/welcome.msg'
file
,
is_temp
=
recipe
.
download_file
(
url
)
file
,
is_temp
=
recipe
.
download_file
(
url
)
...
@@ -248,7 +248,7 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -248,7 +248,7 @@ class NonInformativeTests(unittest.TestCase):
},
},
prefix
=
buildout_prefix
prefix
=
buildout_prefix
)
)
self
.
assertEqual
s
(
recipe
.
options
.
get
(
'prefix'
),
buildout_prefix
)
self
.
assertEqual
(
recipe
.
options
.
get
(
'prefix'
),
buildout_prefix
)
recipe
=
self
.
make_recipe
({},
'test'
,
{
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
...
@@ -256,7 +256,7 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -256,7 +256,7 @@ class NonInformativeTests(unittest.TestCase):
},
},
prefix
=
buildout_prefix
prefix
=
buildout_prefix
)
)
self
.
assertEqual
s
(
recipe
.
options
.
get
(
'prefix'
),
self
.
dir
)
self
.
assertEqual
(
recipe
.
options
.
get
(
'prefix'
),
self
.
dir
)
def
test_get_installed_files
(
self
):
def
test_get_installed_files
(
self
):
prefix
=
os
.
path
.
join
(
self
.
dir
,
'test_parts/test_local'
)
prefix
=
os
.
path
.
join
(
self
.
dir
,
'test_parts/test_local'
)
...
@@ -292,7 +292,8 @@ class NonInformativeTests(unittest.TestCase):
...
@@ -292,7 +292,8 @@ class NonInformativeTests(unittest.TestCase):
recipe
.
buildout_prefix
=
prefix
recipe
.
buildout_prefix
=
prefix
file_list
=
recipe
.
get_installed_files
(
ref_path
)
file_list
=
recipe
.
get_installed_files
(
ref_path
)
installed_files
.
pop
(
2
)
installed_files
.
pop
(
2
)
self
.
assertEquals
(
set
([
os
.
path
.
relpath
(
f
,
prefix
)
for
f
in
file_list
]),
set
(
installed_files
))
self
.
assertEqual
(
set
(
os
.
path
.
relpath
(
f
,
prefix
)
for
f
in
file_list
),
set
(
installed_files
))
def
test_honor_buidlout_keep_compile_directory
(
self
):
def
test_honor_buidlout_keep_compile_directory
(
self
):
buildout
=
{
'keep-compile-dir'
:
'true'
}
buildout
=
{
'keep-compile-dir'
:
'true'
}
...
...
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