44import errno
55import subprocess
66import logging
7- import urlparse
87import sys
8+ from urllib .parse import parse_qs
99sys .path .insert (0 , 'lib' )
1010import requests
1111
1212
1313def get_database_config (development_mode = False ):
14- if any (map (
15- lambda x : x .startswith ('MXRUNTIME_Database' ),
16- os .environ .keys ()
17- )):
14+ if any ([x .startswith ('MXRUNTIME_Database' ) for x in list (os .environ .keys ())]):
1815 return {}
1916
2017 url = get_database_uri_from_vcap ()
@@ -57,7 +54,7 @@ def get_database_config(development_mode=False):
5754
5855 if 'extra' in match .groupdict () and match .group ('extra' ):
5956 extra = match .group ('extra' ).lstrip ('?' )
60- jdbc_params = urlparse . parse_qs (extra )
57+ jdbc_params = parse_qs (extra )
6158 if 'sslmode' in jdbc_params :
6259 sslmode = jdbc_params ['sslmode' ]
6360 if sslmode and sslmode [0 ] == 'require' :
@@ -136,7 +133,7 @@ def get_database_uri_from_vcap():
136133
137134
138135def appdynamics_used ():
139- for k , v in os .environ .iteritems ():
136+ for k , v in os .environ .items ():
140137 if k .startswith ('APPDYNAMICS_' ):
141138 return True
142139 return False
@@ -150,7 +147,7 @@ def get_new_relic_license_key():
150147
151148
152149def get_blobstore_url (filename ):
153- main_url = os .environ .get ('BLOBSTORE' , 'http ://cdn.mendix.com' )
150+ main_url = os .environ .get ('BLOBSTORE' , 'https ://cdn.mendix.com' )
154151 if main_url [- 1 ] == '/' :
155152 main_url = main_url [0 :- 1 ]
156153 return main_url + filename
@@ -214,7 +211,7 @@ def download(url, destination):
214211 logging .debug ('downloading {url} to {destination}' .format (
215212 url = url , destination = destination
216213 ))
217- with open (destination , 'w ' ) as file_handle :
214+ with open (destination , 'wb ' ) as file_handle :
218215 response = requests .get (url , stream = True )
219216 if not response .ok :
220217 response .raise_for_status ()
@@ -249,7 +246,7 @@ def get_java_version(mx_version):
249246 default = '7'
250247 main_java_version = os .getenv ('JAVA_VERSION' , default )
251248
252- if main_java_version not in versions .keys ():
249+ if main_java_version not in list ( versions .keys () ):
253250 raise Exception (
254251 'Invalid Java version specified: %s'
255252 % main_java_version
@@ -258,7 +255,7 @@ def get_java_version(mx_version):
258255
259256
260257def get_mpr_file_from_dir (directory ):
261- mprs = filter ( lambda x : x .endswith ('.mpr' ), os . listdir ( directory ))
258+ mprs = [ x for x in os . listdir ( directory ) if x .endswith ('.mpr' )]
262259 if len (mprs ) == 1 :
263260 return os .path .join (directory , mprs [0 ])
264261 elif len (mprs ) > 1 :
0 commit comments