diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fe0320..472399d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,9 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - uses: ilammy/msvc-dev-cmd@v1 + - name: Install Rii + run: | + make build - name: Test with CC=${{ matrix.compiler }} env: CC: ${{ matrix.compiler }} diff --git a/Makefile b/Makefile index df68475..06b7dde 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: test clean build deploy test_deploy +.PHONY: test clean build test: python setup.py test @@ -6,11 +6,13 @@ test: clean: rm -rf build tmp dist *.egg-info *.so .eggs + + build: - python setup.py sdist + pip install . -deploy: clean build - twine upload dist/* +# deploy: clean build +# twine upload dist/* -test_deploy: clean build - twine upload --repository-url https://test.pypi.org/legacy/ dist/* +# test_deploy: clean build +# twine upload --repository-url https://test.pypi.org/legacy/ dist/* diff --git a/pyproject.toml b/pyproject.toml index d2e63c5..d4a51cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "pybind11"] -build-backend = "setuptools.build_meta:__legacy__" \ No newline at end of file +requires = ["setuptools>=64", "pybind11>=2.9"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup.py b/setup.py index 7a562e7..768bd12 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ +from pybind11.setup_helpers import Pybind11Extension, build_ext from setuptools import setup, Extension, find_packages -from setuptools.command.build_ext import build_ext import sys import setuptools import re @@ -17,36 +17,12 @@ version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(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. """ - - def __init__(self, user=False): - try: - import pybind11 - except ImportError: - if subprocess.call([sys.executable, '-m', 'pip', 'install', 'pybind11']): - raise RuntimeError('pybind11 install failed.') - self.user = user - - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) - ext_modules = [ - Extension( + Pybind11Extension( 'main', ['src/main.cpp', 'src/pqkmeans.cpp'], # For c++ pqkmeans - include_dirs=[ - # Path to pybind11 headers - get_pybind_include(), - get_pybind_include(user=True) - ], language='c++', undef_macros=['NDEBUG'], # This makes sure assert() works ),