Skip to content

Fix C coverage #20222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@ def build_extensions(self):
package.do_custom_build(env)
return super().build_extensions()

def build_extension(self, ext):
# When C coverage is enabled, the path to the object file is saved.
# Since we re-use source files in multiple extensions, libgcov will
# complain at runtime that it is trying to save coverage for the same
# object file at different timestamps (since each source is compiled
# again for each extension). Thus, we need to use unique temporary
# build directories to store object files for each extension.
orig_build_temp = self.build_temp
self.build_temp = os.path.join(self.build_temp, ext.name)
try:
super().build_extension(ext)
finally:
self.build_temp = orig_build_temp


def update_matplotlibrc(path):
# If packagers want to change the default backend, insert a `#backend: ...`
Expand Down