Posix configuration fixes

This commit is contained in:
Georg Richter
2019-08-20 18:07:13 +02:00
parent 9aca6adcaa
commit 2cb584b5cb
2 changed files with 6 additions and 5 deletions

View File

@ -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]

View File

@ -9,6 +9,8 @@ from distutils.core import setup, Extension
if os.name == "posix":
from mariadb_posix import get_config
if os.name == "windows":
from mariadb_windows import get_config
cfg= get_config()