Skip to content

Commit

Permalink
allow disabling cythonizing
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist committed Apr 2, 2024
1 parent a6f959d commit 2198407
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
import os.path
import sys
from os import getenv
from pathlib import Path
from setuptools import setup
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext

import numpy as np

CYTHON_DISABLED = getenv("PYQUANTE_CYTHON_DISABLED", "False").lower() in (
"true",
"1",
"t",
)

try:
from Cython.Build import cythonize

FILE_EXT = "pyx"
USE_CYTHON = True
CYTHON_AVAILABLE = True
print("Cython available")
except ImportError:
FILE_EXT = "c"
USE_CYTHON = False
CYTHON_AVAILABLE = False
print("Cython not available")

if CYTHON_AVAILABLE and not CYTHON_DISABLED:
print("Cython available and requested")
USE_CYTHON = True
else:
USE_CYTHON = False


_NUMPY_MACROS = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
ext_modules = [
Expand Down

0 comments on commit 2198407

Please sign in to comment.