mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-07-28 06:40:03 +00:00
Posix configuration fixes
This commit is contained in:
@ -10,7 +10,6 @@ class MariaDBConfiguration():
|
||||
version= ""
|
||||
includes= ""
|
||||
|
||||
|
||||
def mariadb_config(config, option):
|
||||
from os import popen
|
||||
file= popen("%s --%s" % (config, option))
|
||||
@ -20,7 +19,7 @@ def mariadb_config(config, option):
|
||||
if rc/256:
|
||||
data= []
|
||||
if rc/256 > 1:
|
||||
raise EnvironmentError("mariadb_config not found. Hint: you can specify environment variable MARIADB_CONFIG which points to the location of mariadb_config")
|
||||
raise EnvironmentError("mariadb_config not found.\nMake sure that MariaDB Connector/C is installed (e.g. on Debian or Ubuntu 'sudo apt-get install libmariadb-dev'\nIf mariadb_config is not installed in a default path, please set the environment variable MARIADB_CONFIG which points to the location of mariadb_config utility, e.g. MARIADB_CONFIG=/opt/mariadb/bin/mariadb_config")
|
||||
return data
|
||||
|
||||
|
||||
@ -31,16 +30,16 @@ def dequote(s):
|
||||
|
||||
def get_config():
|
||||
required_version="3.1.0"
|
||||
no_env= 0
|
||||
|
||||
try:
|
||||
config_prg= os.environ["MARIADB_CONFIG"]
|
||||
except KeyError:
|
||||
print("Please set the environment variable MARIADB_CONFIG which points to the location of the mariadb_config program")
|
||||
sys.exit(1)
|
||||
config_prg= 'mariadb_config'
|
||||
|
||||
cc_version= mariadb_config(config_prg, "cc_version")
|
||||
if cc_version[0] < required_version:
|
||||
print("MariaDB Connector/C required MariaDB Connector/C >= %s") % (required_version)
|
||||
print ('MariaDB Connector/Python requires MariaDB Connector/C >= %s, found version %s' % (required_version, cc_version[0]))
|
||||
sys.exit(2)
|
||||
cfg= MariaDBConfiguration()
|
||||
cfg.version= cc_version[0]
|
||||
|
Reference in New Issue
Block a user