Skip to content

Commit

Permalink
python: only build required files before asking setup to build
Browse files Browse the repository at this point in the history
We only need our config.h and the swig wrapper, so skip building the
entire library only to rebuild it again via the amalgamation.
  • Loading branch information
jgriffiths committed Oct 31, 2023
1 parent 0b80526 commit a5df35a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@
# Run the autotools/make build up front to generate our sources,
# then build using the standard Python ext module machinery.
# (Windows requires source generation to be done separately).
import multiprocessing
import subprocess

abs_path = os.path.dirname(os.path.abspath(__file__)) + '/'

def call(args):
subprocess.check_call(args, cwd=abs_path, env=configure_env)
def call(args, cwd=abs_path):
subprocess.check_call(args, cwd=cwd, env=configure_env)

call(['./tools/cleanup.sh'])
call(['./tools/autogen.sh'])
call(['./configure'] + CONFIGURE_ARGS)
call(['make', '-j{}'.format(multiprocessing.cpu_count())])
call(['make', 'swig_python/swig_python_wrap.c'], abs_path + 'src/')

define_macros=[
('SWIG_PYTHON_BUILD', None),
Expand All @@ -66,7 +65,11 @@ def call(args):
'./src/secp256k1/include',
]

extra_compile_args = ['-flax-vector-conversions']
if is_windows:
include_dirs = ['./src/amalgamation/windows_config'] + include_dirs
extra_compile_args = []
else:
extra_compile_args = ['-flax-vector-conversions']

wally_ext = Extension(
'_wallycore',
Expand Down

0 comments on commit a5df35a

Please sign in to comment.