mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-10 04:10:19 +00:00
Posix configuration fixes
This commit is contained in:
@ -10,7 +10,6 @@ class MariaDBConfiguration():
|
|||||||
version= ""
|
version= ""
|
||||||
includes= ""
|
includes= ""
|
||||||
|
|
||||||
|
|
||||||
def mariadb_config(config, option):
|
def mariadb_config(config, option):
|
||||||
from os import popen
|
from os import popen
|
||||||
file= popen("%s --%s" % (config, option))
|
file= popen("%s --%s" % (config, option))
|
||||||
@ -20,7 +19,7 @@ def mariadb_config(config, option):
|
|||||||
if rc/256:
|
if rc/256:
|
||||||
data= []
|
data= []
|
||||||
if rc/256 > 1:
|
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
|
return data
|
||||||
|
|
||||||
|
|
||||||
@ -31,16 +30,16 @@ def dequote(s):
|
|||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
required_version="3.1.0"
|
required_version="3.1.0"
|
||||||
|
no_env= 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config_prg= os.environ["MARIADB_CONFIG"]
|
config_prg= os.environ["MARIADB_CONFIG"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("Please set the environment variable MARIADB_CONFIG which points to the location of the mariadb_config program")
|
config_prg= 'mariadb_config'
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
cc_version= mariadb_config(config_prg, "cc_version")
|
cc_version= mariadb_config(config_prg, "cc_version")
|
||||||
if cc_version[0] < required_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)
|
sys.exit(2)
|
||||||
cfg= MariaDBConfiguration()
|
cfg= MariaDBConfiguration()
|
||||||
cfg.version= cc_version[0]
|
cfg.version= cc_version[0]
|
||||||
|
Reference in New Issue
Block a user