Skip to content

Commit 8a39355

Browse files
authored
Merge pull request #9 from tgarc/master
add a 'pip install' step before building wheels
2 parents f734bff + 1b33c4c commit 8a39355

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

cibuildwheel/linux.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
5151
PATH=$PYBIN:$PATH sh -c {before_build}
5252
fi
5353
54-
"$PYBIN/pip" wheel . -w /tmp/linux_wheels
54+
# install the package first to take care of dependencies
55+
"$PYBIN/pip" install .
56+
57+
"$PYBIN/pip" wheel --no-deps . -w /tmp/linux_wheels
5558
done
5659
5760
for whl in /tmp/linux_wheels/*.whl; do
@@ -66,7 +69,8 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
6669
# Install packages and test
6770
for PYBIN in {pybin_paths}; do
6871
# Install the wheel we just built
69-
"$PYBIN/pip" install {package_name} --no-index -f /output
72+
"$PYBIN/pip" install {package_name} \
73+
--upgrade --force-reinstall --no-deps --no-index -f /output
7074
7175
# Install any requirements to run the tests
7276
if [ ! -z "{test_requires}" ]; then

cibuildwheel/macos.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ def shell(args, env=None, cwd=None):
5858
before_build_prepared = prepare_command(before_build, python=python, pip=pip)
5959
shell(shlex.split(before_build_prepared), env=env)
6060

61+
# install the package first to take care of dependencies
62+
shell([pip, 'install', project_dir], env=env)
63+
6164
# build the wheel to temp dir
6265
temp_wheel_dir = '/tmp/tmpwheel%s' % config.version
63-
shell([pip, 'wheel', project_dir, '-w', temp_wheel_dir], env=env)
66+
shell([pip, 'wheel', project_dir, '-w', temp_wheel_dir, '--no-deps'], env=env)
6467
temp_wheel = glob(temp_wheel_dir+'/*.whl')[0]
6568

6669
if temp_wheel.endswith('none-any.whl'):
@@ -72,8 +75,9 @@ def shell(args, env=None, cwd=None):
7275
# rebuild the wheel with shared libraries included and place in output dir
7376
shell(['delocate-wheel', '-w', output_dir, temp_wheel], env=env)
7477

75-
# install the wheel
76-
shell([pip, 'install', package_name, '--no-index', '--find-links', output_dir], env=env)
78+
# now install the package from the generated wheel
79+
shell([pip, 'install', package_name, '--upgrade', '--force-reinstall',
80+
'--no-deps', '--no-index', '--find-links', output_dir], env=env)
7781

7882
# test the wheel
7983
if test_requires:

cibuildwheel/windows.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,16 @@ def shell(args, env=None, cwd=None):
6666
before_build_prepared = prepare_command(before_build, python='python', pip='pip')
6767
shell([before_build_prepared], env=env)
6868

69+
# install the package first to take care of dependencies
70+
shell(['pip', 'install', project_dir], env=env)
71+
6972
# build the wheel
70-
shell(['pip', 'wheel', project_dir, '-w', output_dir], env=env)
73+
shell(['pip', 'wheel', project_dir, '-w', output_dir, '--no-deps'], env=env)
7174

7275
# install the wheel
73-
shell(['pip', 'install', package_name, '--no-index', '-f', output_dir], env=env)
76+
shell(['pip', 'install', package_name, '--upgrade',
77+
'--force-reinstall', '--no-deps', '--no-index', '-f',
78+
output_dir], env=env)
7479

7580
# test the wheel
7681
if test_requires:

0 commit comments

Comments
 (0)