Skip to content

Commit

Permalink
Allow skip compilation check (rpy2#1077)
Browse files Browse the repository at this point in the history
* Allow skipping C-compiling checks.

* Fix typo.
  • Loading branch information
lgautier authored Nov 25, 2023
1 parent ba0dcd5 commit 83351ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release 3.5.15
==============

New features
------------

- Checking C compiling against the R shared library can be skipped with
the environment variable `RPY2_API_FORCE` set to `True`.


Bugs fixed
----------

Expand Down
17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def get_c_extension_status(libraries=['R'], include_dirs=None,
return status


def get_r_c_extension_status(r_home: typing.Optional[str]):
def get_r_c_extension_status(r_home: typing.Optional[str],
force_ok: bool = False):
if r_home is None:
return COMPILATION_STATUS.NO_R
c_ext = situation.CExtensionOptions()
Expand All @@ -114,9 +115,12 @@ def get_r_c_extension_status(r_home: typing.Optional[str]):
except subprocess.CalledProcessError as cpe:
warnings.warn(str(cpe))
return COMPILATION_STATUS.RFLAGS_ERROR
status = get_c_extension_status(libraries=c_ext.libraries,
include_dirs=c_ext.include_dirs,
library_dirs=c_ext.library_dirs)
if force_ok:
status = COMPILATION_STATUS.OK
else:
status = get_c_extension_status(libraries=c_ext.libraries,
include_dirs=c_ext.include_dirs,
library_dirs=c_ext.library_dirs)
return status


Expand All @@ -134,7 +138,10 @@ def run(self):

r_home = situation.get_r_home()
cffi_mode = situation.get_cffi_mode()
c_extension_status = get_r_c_extension_status(r_home)
c_extension_status = get_r_c_extension_status(
r_home,
force_ok = os.environ.get('RPY2_API_FORCE') == 'True'
)
ext_modules = []
if cffi_mode == situation.CFFI_MODE.ABI:
cffi_modules = ['rpy2/_rinterface_cffi_build.py:ffibuilder_abi']
Expand Down

0 comments on commit 83351ee

Please sign in to comment.