Skip to content

Commit 021ac8a

Browse files
authored
Fix shell syntax in build_wheel (#11873)
Follow up to #11872 The cross repo split makes this a bit of a pain to test. Co-authored-by: hauntsaninja <>
1 parent 22d4f1d commit 021ac8a

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

misc/build_wheel.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ def create_environ(python_version: str) -> Dict[str, str]:
7575

7676
# lxml doesn't have a wheel for Python 3.10 on the manylinux image we use.
7777
# lxml has historically been slow to support new Pythons as well.
78-
env['CIBW_BEFORE_TEST'] = (
79-
'pip install -r <(grep -v lxml {project}/mypy/test-requirements.txt)'
80-
)
78+
env['CIBW_BEFORE_TEST'] = """
79+
(
80+
grep -v lxml {project}/mypy/test-requirements.txt > /tmp/test-requirements.txt
81+
&& cp {project}/mypy/mypy-requirements.txt /tmp/mypy-requirements.txt
82+
&& cp {project}/mypy/build-requirements.txt /tmp/build-requirements.txt
83+
&& pip install -r /tmp/test-requirements.txt
84+
)
85+
""".replace('\n', ' ')
8186

8287
# pytest looks for configuration files in the parent directories of where the tests live.
8388
# since we are trying to run the tests from their installed location, we copy those into
@@ -94,7 +99,7 @@ def create_environ(python_version: str) -> Dict[str, str]:
9499
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR -k 'not (reports.test or testreports)'
95100
96101
&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])')
97-
&& pytest $MYPYC_TEST_DIR -k 'not test_external'
102+
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPYC_TEST_DIR -k 'not test_external'
98103
)
99104
""".replace('\n', ' ')
100105

mypyc/test/config.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import os
22

3-
this_file_dir = os.path.dirname(os.path.realpath(__file__))
4-
prefix = os.path.dirname(os.path.dirname(this_file_dir))
3+
provided_prefix = os.getenv('MYPY_TEST_PREFIX', None)
4+
if provided_prefix:
5+
PREFIX = provided_prefix
6+
else:
7+
this_file_dir = os.path.dirname(os.path.realpath(__file__))
8+
PREFIX = os.path.dirname(os.path.dirname(this_file_dir))
59

6-
# Locations of test data files such as test case descriptions (.test).
7-
test_data_prefix = os.path.join(prefix, 'mypyc', 'test-data')
10+
# Location of test data files such as test case descriptions.
11+
test_data_prefix = os.path.join(PREFIX, 'mypyc', 'test-data')

0 commit comments

Comments
 (0)