Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
a6c45fd6
Commit
a6c45fd6
authored
Aug 16, 2012
by
Clément Schreiner
Browse files
Update ubuntuversion to the new API.
parent
d59ea249
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/ubuntuversion.py
View file @
a6c45fd6
...
...
@@ -37,13 +37,24 @@ __license__ = 'MIT'
import
logging
from
debexpo.plugins
import
BasePlugin
from
debexpo.plugins
.api
import
*
from
debexpo.lib
import
constants
log
=
logging
.
getLogger
(
__name__
)
class
UbuntuVersionPlugin
(
BasePlugin
):
@
test_result
class
UbuntuVersionTest
(
PluginResult
):
in_ubuntu
=
bool_field
(
'in_ubuntu'
)
def
__str__
(
self
):
return
'The uploaded package {verb} "ubuntu" in the version'
.
format
(
'has'
if
self
.
in_ubuntu
else
'does not have'
)
class
UbuntuVersionPlugin
(
QAPlugin
):
@
importercmd
def
test_ubuntu_version
(
self
):
"""
Checks whether the word "ubuntu" exists in the package name.
...
...
@@ -51,10 +62,13 @@ class UbuntuVersionPlugin(BasePlugin):
log
.
debug
(
'Checking whether the package version contains the word "ubuntu"'
)
if
'ubuntu'
in
self
.
changes
[
'Version'
]:
log
.
error
(
'Package has ubuntu in the version'
)
self
.
_new_result
(
Test
,
in_ubuntu
=
True
,
severity
=
constants
.
PLUGIN_SEVERITY_CRITICAL
)
else
:
log
.
debug
(
'Package does not have ubuntu in the version'
)
# This isn't even worth setting an outcome.
else
:
log
.
error
(
'Package has ubuntu in the version'
)
self
.
failed
(
'The uploaded package has "ubuntu" in the version'
,
None
,
constants
.
PLUGIN_SEVERITY_CRITICAL
)
plugin
=
UbuntuVersionPlugin
models
=
[
UbuntuVersionTest
]
template
=
'default'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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