Merge pull request #2576 from abretaud/ldap

Add python-ldap module to conditional requirements
This commit is contained in:
Dannon Baker
2016-07-27 10:10:50 -04:00
committed by GitHub
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -15,6 +15,7 @@ class ConditionalDependencies( object ):
self.config_file = config_file
self.config = None
self.job_runners = []
self.authenticators = []
self.conditional_reqs = []
self.parse_configs()
self.get_conditional_requirements()
@@ -31,6 +32,18 @@ class ConditionalDependencies( object ):
except (OSError, IOError):
pass
# Parse auth conf
auth_conf_xml = self.config.get(
"auth_config_file",
join( dirname( self.config_file ), 'auth_conf.xml' ) )
try:
for auth in ElementTree.parse( auth_conf_xml ).findall( 'authenticator' ):
auth_type = auth.find('type')
if auth_type is not None:
self.authenticators.append( auth_type.text )
except (OSError, IOError):
pass
def get_conditional_requirements( self ):
crfile = join( dirname( __file__ ), 'conditional-requirements.txt' )
for req in pkg_resources.parse_requirements( open( crfile ).readlines() ):
@@ -76,6 +89,10 @@ class ConditionalDependencies( object ):
# pygments is a dependency of weberror and only weberror
return self.check_weberror()
def check_python_ldap( self ):
return ('ldap' in self.authenticators or
'activedirectory' in self.authenticators)
def optional( config_file ):
rval = []
@@ -10,3 +10,4 @@ pbs_python
drmaa
statsd
# PyRods not in PyPI
python-ldap==2.4.25