Skip to content

Commit

Permalink
Defer numpy import until we actually use it. This hopefully
Browse files Browse the repository at this point in the history
fixes chicken-n-egg error generating requirements list.
  • Loading branch information
sobomax committed May 26, 2024
1 parent df7441b commit 04bd137
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from os.path import exists, realpath, dirname, join as path_join
from sys import argv as sys_argv
from sysconfig import get_platform
import numpy as np

mod_name = 'G722'
mod_name_dbg = mod_name + '_debug'
Expand All @@ -14,7 +13,11 @@
mod_fname = mod_name + '_mod.c'
mod_dir = '' if exists(mod_fname) else 'python/'

compile_args = [f'-I{src_dir}', '-flto', f'-I{np.get_include()}']
def np_get_include():
import numpy as np
return np.get_include()

compile_args = [f'-I{src_dir}', '-flto', f'-I{np_get_include()}']
smap_fname = f'{mod_dir}symbols.map'
link_args = ['-flto',]
if not get_platform().startswith('macosx-'):
Expand Down

0 comments on commit 04bd137

Please sign in to comment.