Skip to content

Commit e609fad

Browse files
committed
Fix failing unittests due to cext not available on windows
The unittest that requires c extensions fails on Windows due to the missing dll libraries not being copied to the build/lib folder. This patch uses the --install-data option form the install command to indicate where this files should be copied.
1 parent f6e0cd1 commit e609fad

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/cpy_distutils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
INSTALL_OPTIONS = [
7575
('byte-code-only=', None,
7676
"Remove Python .py files; leave byte code .pyc only"),
77+
('is-wheel', None,
78+
"Install beehaves as wheel package requires"),
7779
]
7880

7981

@@ -330,6 +332,7 @@ def _copy_vendor_libraries(self):
330332
if not self.with_mysql_capi or not is_wheel:
331333
return
332334

335+
log.info("Copying vendor files (dll libraries)")
333336
data_files = []
334337
vendor_libs = []
335338

@@ -890,7 +893,7 @@ class Install(install):
890893
user_options = install.user_options + CEXT_OPTIONS + INSTALL_OPTIONS + \
891894
CEXT_STATIC_OPTIONS
892895

893-
boolean_options = ['byte-code-only', 'static']
896+
boolean_options = ['byte-code-only', 'static', 'is-wheel']
894897
need_ext = False
895898

896899
def initialize_options(self):

tests/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import subprocess
4343
import errno
4444
import traceback
45+
from distutils.dist import Distribution
4546
from imp import load_source
4647
from functools import wraps
4748
from pkgutil import walk_packages
@@ -825,12 +826,21 @@ def install_connector(root_dir, install_dir, protobuf_include_dir,
825826
'clean', '--all', # necessary for removing the build/
826827
]
827828

829+
dist = Distribution()
830+
cmd_build = dist.get_command_obj('build')
831+
cmd_build.ensure_finalized()
832+
828833
cmd.extend([
829834
'install',
830835
'--root', install_dir,
831836
'--install-lib', '.',
832837
'--static',
838+
'--is-wheel'
833839
])
840+
if os.name == 'nt':
841+
cmd.extend([
842+
'--install-data', cmd_build.build_platlib
843+
])
834844

835845
if any((protobuf_include_dir, protobuf_lib_dir, protoc)):
836846
cmd.extend([
@@ -848,6 +858,7 @@ def install_connector(root_dir, install_dir, protobuf_include_dir,
848858
if extra_link_args:
849859
cmd.extend(['--extra-link-args', extra_link_args])
850860

861+
LOGGER.debug("Installing command: {0}".format(cmd))
851862
prc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
852863
stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
853864
cwd=root_dir)

0 commit comments

Comments
 (0)