Skip to content

Commit

Permalink
Implement numpy hack in setup.py to enable install under Poetry (#3363)
Browse files Browse the repository at this point in the history
* Closes #3362: Install issue poetry

* get rid of redundant exception handling

this code can never raise an exception, so we shouldn't be expecting
them

Co-authored-by: Michael Penkov <m@penkov.dev>
  • Loading branch information
jaymegordo and mpenkov authored Dec 3, 2022
1 parent b6ea788 commit 3331b82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ class CustomBuildExt(build_ext):
importing them at module level, because they may not be available yet.
"""
#
# Prevent numpy from thinking it is still in its setup process
# http://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
#
def finalize_options(self):
build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
# https://docs.python.org/2/library/__builtin__.html#module-__builtin__
__builtins__.__NUMPY_SETUP__ = False

import builtins
builtins.__NUMPY_SETUP__ = False

import numpy
self.include_dirs.append(numpy.get_include())
Expand Down

0 comments on commit 3331b82

Please sign in to comment.