astropy / extension-helpers

Helpers to assist with building Python packages with compiled C/Cython extensions
https://extension-helpers.readthedocs.io
BSD 3-Clause "New" or "Revised" License
16 stars 12 forks source link

get_extensions: use shutil.copyfile to avoid PermissionError #59

Closed doronbehar closed 10 months ago

doronbehar commented 1 year ago

Without this change, packages that depend on this module (e.g astropy) may get a PermissionError on systems such as Nix and Guix. Because, when these systems attempt to build astropy, the built package astropy-extrnsion-helpers holds an src/compiler.c that has no write permissions - just like any other file in a built package in these systems. Then, when astropy tries to use the copied _compiler.c, it tries to open it with wb+. Using shutil.copyfile doesn't copy metadata.

codecov[bot] commented 1 year ago

Codecov Report

Merging #59 (796f3e7) into main (bc926f8) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #59   +/-   ##
=======================================
  Coverage   76.29%   76.29%           
=======================================
  Files           4        4           
  Lines         308      308           
=======================================
  Hits          235      235           
  Misses         73       73           
Files Changed Coverage Δ
extension_helpers/_setup_helpers.py 66.32% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more