8000 Use local dir for build_temp if coverage enabled · matplotlib/matplotlib@bdfd2ff · GitHub
[go: up one dir, main page]

Skip to content

Commit bdfd2ff

Browse files
committed
Use local dir for build_temp if coverage enabled
1 parent b06715a commit bdfd2ff

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
run: |
156156
# Upgrade pip and setuptools and wheel to get as clean an install as
157157
# possible.
158-
python -m pip install --upgrade pip 'setuptools<64' wheel
158+
python -m pip install --upgrade pip setuptools wheel
159159
160160
# Install dependencies from PyPI.
161161
python -m pip install --upgrade $PRE \
@@ -224,9 +224,8 @@ jobs:
224224
git describe
225225
226226
# Set flag in a delayed manner to avoid issues with installing other
227-
# packages. Only enabling coverage on minimum versions run as both
228-
# need building using --no-build-isolation.
229-
if [[ "${{ matrix.name-suffix }}" == '(Minimum Versions)' ]]; then
227+
# packages
228+
if [[ "${{ runner.os }}" != 'macOS' ]]; then
230229
if [[ "$(lsb_release -r -s)" == "20.04" ]]; then
231230
export CPPFLAGS='--coverage -fprofile-abs-path'
232231
else
@@ -241,15 +240,15 @@ jobs:
241240
242241
cat mplsetup.cfg
243242
244-
# All dependencies must have been pre-installed, so that the minver
245-
# constraints are held.
246243
if [[ "${{ matrix.name-suffix }}" == '(Minimum Versions)' ]]; then
244+
# Minimum versions run does not use build isolation so that it
245+
# builds against the pre-installed minver dependencies.
247246
python -m pip install --no-deps --no-build-isolation -ve .
248247
else
249248
python -m pip install --no-deps -ve .
250249
fi
251250
252-
if [[ "${{ < E419 span class="x x-first x-last">matrix.name-suffix }}" == '(Minimum Versions)' ]]; then
251+
if [[ "${{ runner.os }}" != 'macOS' ]]; then
253252
unset CPPFLAGS
254253
fi
255254
@@ -271,7 +270,7 @@ jobs:
271270
--extract coverage.info $PWD/src/'*' $PWD/lib/'*'
272271
lcov --list coverage.info
273272
find . -name '*.gc*' -delete
274-
if: ${{ matrix.name-suffix == '(Minimum Versions)' }}
273+
if: ${{ runner.os != 'macOS' }}
275274
- name: Upload code coverage
276275
uses: codecov/codecov-action@v3
277276

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def has_flag(self, flagname):
7070

7171
class BuildExtraLibraries(setuptools.command.build_ext.build_ext):
7272
def finalize_options(self):
73+
# If coverage is enabled then need to keep the .o and .gcno files in a
74+
# non-temporary directory otherwise coverage info is not collected.
75+
cppflags = os.getenv('CPPFLAGS')
76+
if cppflags and '--coverage' in cppflags:
77+
self.build_temp = 'build'
78+
7379
self.distribution.ext_modules[:] = [
7480
ext
7581
for package in good_packages

0 commit comments

Comments
 (0)
0