Skip to content

Commit e1e4425

Browse files
peeyushguptaGeert Vanderkelen
authored andcommitted
BUG21490865: Fix compiling CExtension with relocated libmysqlclient
Install fails with --with-mysql-capi option when libmysqlclient directory is renamed and the path does not contain '64' on 64 bit systems. The reason being file command without '-L' option doesn't derefer the symbolic links and doesn't print the architecture of the original file. We fix this by including '-L' option while using file command also we now don't check the path of the file to contain '64'. (cherry picked from commit 6475c80)
1 parent 5f4cac6 commit e1e4425

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/cpy_distutils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ def unix_lib_is64bit(lib_file):
121121
break
122122
lib_file = mysqlclient_lib
123123

124-
prc = Popen(['file', lib_file], stdin=PIPE, stderr=STDOUT, stdout=PIPE)
124+
prc = Popen(['file', '-L', lib_file], stdin=PIPE, stderr=STDOUT,
125+
stdout=PIPE)
125126
stdout = prc.communicate()[0]
127+
stdout = stdout.split(':')[1]
126128

127129
if 'x86_64' in stdout or 'x86-64' in stdout:
128130
return True
@@ -173,8 +175,10 @@ def get_mysql_config_info(mysql_config):
173175

174176
stdout = None
175177
try:
176-
proc = Popen(['file', lib], stdout=PIPE, universal_newlines=True)
178+
proc = Popen(['file', '-L', lib], stdout=PIPE,
179+
universal_newlines=True)
177180
stdout, _ = proc.communicate()
181+
stdout = stdout.split(':')[1]
178182
except OSError as exc:
179183
raise DistutilsExecError(
180184
"Although the system seems POSIX, the file-command could not "

0 commit comments

Comments
 (0)