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
Boxiang Sun
slapos.recipe.cmmi
Commits
d79e3f93
Commit
d79e3f93
authored
May 21, 2012
by
Kai Lautaportti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8/pyflakes cleanup.
parent
7efe6c6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
hexagonit/recipe/cmmi/__init__.py
hexagonit/recipe/cmmi/__init__.py
+3
-4
hexagonit/recipe/cmmi/tests.py
hexagonit/recipe/cmmi/tests.py
+19
-18
No files found.
hexagonit/recipe/cmmi/__init__.py
View file @
d79e3f93
import
hexagonit.recipe.download
import
errno
import
hexagonit.recipe.download
import
imp
import
logging
import
os
...
...
@@ -7,6 +7,7 @@ import shutil
import
subprocess
import
zc.buildout
class
Recipe
(
object
):
"""zc.buildout recipe for compiling and installing software"""
...
...
@@ -82,7 +83,6 @@ class Recipe(object):
# the third parameter
script
(
self
.
options
,
self
.
buildout
)
def
run
(
self
,
cmd
):
"""Run the given ``cmd`` in a child process."""
log
=
logging
.
getLogger
(
self
.
name
)
...
...
@@ -99,7 +99,6 @@ class Recipe(object):
log
.
error
(
'Command failed: %s: %s'
%
(
e
,
cmd
))
raise
zc
.
buildout
.
UserError
(
'System error'
)
def
install
(
self
):
log
=
logging
.
getLogger
(
self
.
name
)
parts
=
[]
...
...
@@ -108,7 +107,7 @@ class Recipe(object):
make_options
=
' '
.
join
(
self
.
options
.
get
(
'make-options'
,
''
).
split
())
make_targets
=
' '
.
join
(
self
.
options
.
get
(
'make-targets'
,
'install'
).
split
())
configure_options
=
self
.
options
.
get
(
'configure-options'
,
''
).
split
()
configure_options
=
self
.
options
.
get
(
'configure-options'
,
''
).
split
()
configure_cmd
=
self
.
options
.
get
(
'configure-command'
,
''
).
strip
()
if
not
configure_cmd
:
...
...
hexagonit/recipe/cmmi/tests.py
View file @
d79e3f93
...
...
@@ -13,15 +13,17 @@ import zc.buildout
import
zc.buildout.testing
import
zc.buildout.tests
optionflags
=
(
doctest
.
ELLIPSIS
|
doctest
.
NORMALIZE_WHITESPACE
|
doctest
.
REPORT_ONLY_FIRST_FAILURE
)
optionflags
=
(
doctest
.
ELLIPSIS
|
doctest
.
NORMALIZE_WHITESPACE
|
doctest
.
REPORT_ONLY_FIRST_FAILURE
)
def
setUp
(
test
):
zc
.
buildout
.
testing
.
buildoutSetUp
(
test
)
zc
.
buildout
.
testing
.
install
(
'hexagonit.recipe.download'
,
test
)
zc
.
buildout
.
testing
.
install_develop
(
'hexagonit.recipe.cmmi'
,
test
)
class
NonInformativeTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -33,7 +35,7 @@ class NonInformativeTests(unittest.TestCase):
if
var
.
startswith
(
'HRC_'
):
del
os
.
environ
[
var
]
def
write_file
(
self
,
filename
,
contents
,
mode
=
stat
.
S_IREAD
|
stat
.
S_IWUSR
):
def
write_file
(
self
,
filename
,
contents
,
mode
=
stat
.
S_IREAD
|
stat
.
S_IWUSR
):
path
=
os
.
path
.
join
(
self
.
dir
,
filename
)
fh
=
open
(
path
,
'w'
)
fh
.
write
(
contents
)
...
...
@@ -50,9 +52,9 @@ class NonInformativeTests(unittest.TestCase):
if
e
.
errno
!=
errno
.
EEXIST
:
raise
bo
=
{
'buildout'
:
{
'parts-directory'
:
parts_directory_path
,
'directory'
:
self
.
dir
,
'buildout'
:
{
'parts-directory'
:
parts_directory_path
,
'directory'
:
self
.
dir
,
}
}
bo
.
update
(
buildout
)
...
...
@@ -61,7 +63,7 @@ class NonInformativeTests(unittest.TestCase):
def
test_working_directory_restored_after_failure
(
self
):
compile_directory
=
os
.
path
.
join
(
self
.
dir
,
'compile_directory'
)
os
.
makedirs
(
compile_directory
)
recipe
=
self
.
make_recipe
({},
'test'
,
{
'path'
:
compile_directory
})
recipe
=
self
.
make_recipe
({},
'test'
,
{
'path'
:
compile_directory
})
os
.
chdir
(
self
.
dir
)
self
.
assertRaises
(
zc
.
buildout
.
UserError
,
recipe
.
install
)
...
...
@@ -72,7 +74,7 @@ class NonInformativeTests(unittest.TestCase):
os
.
makedirs
(
compile_directory
)
self
.
write_file
(
os
.
path
.
join
(
compile_directory
,
'configure'
),
'Dummy configure'
)
recipe
=
self
.
make_recipe
({},
'test'
,
{
'path'
:
compile_directory
})
self
.
make_recipe
({},
'test'
,
{
'path'
:
compile_directory
})
os
.
chdir
(
self
.
dir
)
self
.
assertEquals
(
self
.
dir
,
os
.
getcwd
())
...
...
@@ -107,7 +109,7 @@ class NonInformativeTests(unittest.TestCase):
tar
.
add
(
'Makefile'
)
tar
.
close
()
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
tarfile_path
})
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
tarfile_path
})
os
.
chdir
(
self
.
dir
)
try
:
...
...
@@ -137,8 +139,8 @@ class NonInformativeTests(unittest.TestCase):
self
.
assertEquals
(
os
.
environ
.
get
(
'HRC_SENTINEL'
),
'sentinel'
)
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
'environment'
:
'HRC_FOO=bar
\
n
HRC_BAR=foo'
})
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
'environment'
:
'HRC_FOO=bar
\
n
HRC_BAR=foo'
})
os
.
chdir
(
self
.
dir
)
recipe
.
install
()
...
...
@@ -151,13 +153,12 @@ class NonInformativeTests(unittest.TestCase):
def
test_run__unknown_command
(
self
):
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
)})
self
.
assertRaises
(
zc
.
buildout
.
UserError
,
lambda
:
recipe
.
run
(
'this-command-does-not-exist'
))
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
)})
self
.
assertRaises
(
zc
.
buildout
.
UserError
,
lambda
:
recipe
.
run
(
'this-command-does-not-exist'
))
def
test_call_script__bbb_for_callable_with_two_parameters
(
self
):
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__
),
})
# The hook script does not return anything so we (ab)use exceptions
...
...
@@ -178,8 +179,8 @@ class NonInformativeTests(unittest.TestCase):
os
.
environ
[
'HRC_TESTVAR'
]
=
'foo'
recipe
=
self
.
make_recipe
({},
'test'
,
{
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
'environment'
:
'HRC_TESTVAR=bar'
'url'
:
'file://%s/testdata/package-0.0.0.tar.gz'
%
os
.
path
.
dirname
(
__file__
),
'environment'
:
'HRC_TESTVAR=bar'
})
# The hook script does not return anything so we (ab)use exceptions
...
...
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