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
45301aed
Commit
45301aed
authored
Jul 11, 2012
by
Clément Schreiner
Browse files
Update for last model changes + small improvements.
parent
5d5e7015
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/native.py
View file @
45301aed
...
...
@@ -49,15 +49,29 @@ from sqlalchemy import orm
log
=
logging
.
getLogger
(
__name__
)
class
NativeResult
(
PluginResult
):
pass
class
NativeTest
(
PluginResult
):
"""
Result of the 'native' plugin for a package.
"""
@
property
def
is_native
(
self
):
return
self
.
data
[
'native'
].
value
==
'true'
orm
.
mapper
(
NativeResult
,
inherits
=
plugin_result_mapper
,
polymorphic_identity
=
'native'
)
@
property
def
severity
(
self
):
s
=
self
.
data
.
get
(
'severity'
,
None
)
return
s
if
s
is
None
else
s
.
value
class
NativePlugin
(
BasePlugin
):
result_model
=
NativeResult
def
__repr__
(
self
):
return
'Package is%s native'
%
(
' '
if
self
.
is_native
else
' not'
)
orm
.
mapper
(
NativeTest
,
inherits
=
plugin_result_mapper
,
polymorphic_identity
=
'native_test'
)
class
NativePlugin
(
BasePlugin
):
"""
Plugin checking whether a package is a native package.
"""
def
test_native
(
self
):
"""
Test to see whether the package is a native package.
...
...
@@ -65,14 +79,15 @@ class NativePlugin(BasePlugin):
log
.
debug
(
'Checking whether the package is native or not'
)
filecheck
=
filesystem
.
CheckFiles
()
native
=
filecheck
.
is_native_package
(
self
.
changes
)
is_
native
=
filecheck
.
is_native_package
(
self
.
changes
)
result
=
self
.
_new_result
()
if
native
:
result
=
self
.
_new_result
(
NativeTest
)
if
is_
native
:
# Most uploads will not be native, and especially on mentors, a native
# package is almost probably in error.
log
.
warning
(
'Package is native'
)
self
.
_add_data
(
result
,
native
=
'true'
)
self
.
_add_data
(
result
,
native
=
'true'
,
severity
=
constants
.
PLUGIN_SEVERITY_WARNING
)
else
:
log
.
debug
(
'Package is not native'
)
self
.
_add_data
(
result
,
native
=
'false'
,
...
...
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