Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken pip install #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel", "numpy", "pybind11>=2.0.1"]
46 changes: 10 additions & 36 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import setuptools
import sys
import os
import setuptools

__version__ = '0.1'


class get_pybind_include(object):
"""Helper class to determine the pybind11 include path

The purpose of this class is to postpone importing pybind11
until it is actually installed, so that the ``get_include()``
method can be invoked. """
import tempfile

def __init__(self, user=False):
self.user = user
import numpy as np
import pybind11

def __str__(self):
import pybind11
return pybind11.get_include(self.user)


class get_numpy_include(object):
"""Helper class to determine the numpy include path

The purpose of this class is to postpone importing numpy
until it is actually installed, so that the ``get_include()``
method can be invoked. """

def __init__(self):
pass

def __str__(self):
import numpy as np
return np.get_include()
__version__ = '0.1'


ext_modules = [
Expand All @@ -43,9 +18,9 @@ def __str__(self):
['src/vectfit.cpp'],
include_dirs=[
# Path to pybind11 headers
get_pybind_include(),
get_pybind_include(user=True),
get_numpy_include(),
pybind11.get_include(),
pybind11.get_include(True),
np.get_include(),
os.path.join(sys.prefix, 'include'),
os.path.join(sys.prefix, 'Library', 'include')
],
Expand All @@ -59,7 +34,6 @@ def has_flag(compiler, flagname):
"""Return a boolean indicating whether a flag name is supported on
the specified compiler.
"""
import tempfile
with tempfile.NamedTemporaryFile('w', suffix='.cpp') as f:
f.write('int main (int argc, char **argv) { return 0; }')
try:
Expand Down Expand Up @@ -106,7 +80,7 @@ def build_extensions(self):

with open('README.md') as f:
long_description = f.read()

setup(
name='vectfit',
version=__version__,
Expand All @@ -116,7 +90,7 @@ def build_extensions(self):
description= 'Fast Relaxed Vector Fitting Implementation in C++',
long_description=long_description,
ext_modules=ext_modules,
install_requires=['pybind11>=2.0.1', 'numpy'],
install_requires=['numpy'],
cmdclass={'build_ext': BuildExt},
zip_safe=False,
)