Add build dependency environment

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-05-15 15:58:31 -04:00
parent e5daea674f
commit 7339eb2a09
2 changed files with 24 additions and 7 deletions

View File

@@ -3,7 +3,8 @@ from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from mayan.apps.dependencies.classes import ( from mayan.apps.dependencies.classes import (
environment_development, environment_testing, PythonDependency environment_build, environment_development, environment_testing,
PythonDependency
) )
PythonDependency( PythonDependency(
@@ -444,3 +445,12 @@ PythonDependency(
environment=environment_testing, module=__name__, name='psutil', environment=environment_testing, module=__name__, name='psutil',
version_string='==5.6.1' version_string='==5.6.1'
) )
PythonDependency(
environment=environment_build, module=__name__, name='twine',
version_string='==1.9.1'
)
PythonDependency(
environment=environment_build, module=__name__, name='wheel',
version_string='==0.30.0'
)

View File

@@ -55,11 +55,12 @@ class DependencyEnvironment(object):
return force_text(self.label) return force_text(self.label)
environment_production = DependencyEnvironment( environment_build = DependencyEnvironment(
help_text=_( help_text=_(
'Normal environment for end users. A missing depedencies under this ' 'Environment used for building distributable packages of the '
'environment will result issues and error during normal use.' 'software. End users can ignore missing depedencies under this '
), label=_('Production'), name='production' 'environment.'
), label=_('Build'), name='build'
) )
environment_development = DependencyEnvironment( environment_development = DependencyEnvironment(
help_text=_( help_text=_(
@@ -67,6 +68,12 @@ environment_development = DependencyEnvironment(
'can ignore missing depedencies under this environment.' 'can ignore missing depedencies under this environment.'
), label=_('Development'), name='development' ), label=_('Development'), name='development'
) )
environment_production = DependencyEnvironment(
help_text=_(
'Normal environment for end users. A missing depedencies under this '
'environment will result issues and error during normal use.'
), label=_('Production'), name='production'
)
environment_testing = DependencyEnvironment( environment_testing = DependencyEnvironment(
help_text=_( help_text=_(
'Environment used running the test suit to verify the functionality ' 'Environment used running the test suit to verify the functionality '
@@ -191,10 +198,10 @@ class Dependency(object):
return Dependency.return_sorted(dependencies=dependencies) return Dependency.return_sorted(dependencies=dependencies)
@classmethod @classmethod
def get_for_attribute(cls, attribute_name, attribute_value): def get_for_attribute(cls, attribute_name, attribute_value, **kwargs):
result = [] result = []
for dependency in cls.get_all(): for dependency in cls.get_all(**kwargs):
if resolve_attribute(attribute=attribute_name, obj=dependency) == attribute_value: if resolve_attribute(attribute=attribute_name, obj=dependency) == attribute_value:
result.append(dependency) result.append(dependency)