diff --git a/.gitignore b/.gitignore index 2c28d02..3e725eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ .idea .vscode -pyquda/src/*.c -pyquda/src/*.cpp *.so .cache __pycache__ @@ -14,10 +12,12 @@ script logs DATA -# autogenerated wrapper +# autogenerated files pyquda/src/quda.pxd pyquda/src/pyquda.pyx pyquda/enum_quda.py +pyquda/src/*.c +pyquda/src/*.cpp # pycparser yacctab.py diff --git a/MANIFEST.in b/MANIFEST.in index 473c531..bf13f44 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,10 @@ +# .gitignore +exclude pyquda/src/quda.pxd +exclude pyquda/src/pyquda.pyx +exclude pyquda/enum_quda.py +exclude pyquda/src/*.c +exclude pyquda/src/*.cpp + exclude tests/* include pyquda_pyx.py include pycparser/LICENSE diff --git a/pyquda/__init__.py b/pyquda/__init__.py index 53344c3..61367ff 100644 --- a/pyquda/__init__.py +++ b/pyquda/__init__.py @@ -15,7 +15,7 @@ class SupportsWriteAndFlush(SupportsWrite[_T_contra], SupportsFlush, Protocol[_T from mpi4py import MPI -__version__ = "0.5.6" +__version__ = "0.6.0" from . import pyquda as quda from .field import LatticeInfo diff --git a/setup.py b/setup.py index c562f5c..2426289 100755 --- a/setup.py +++ b/setup.py @@ -1,17 +1,23 @@ import os -from distutils.core import Extension, setup +import sys +from setuptools import Extension, setup from Cython.Build import cythonize from pyquda_pyx import build_pyquda_pyx -assert "QUDA_PATH" in os.environ, "QUDA_PATH environment is needed to link against libquda" -quda_path = os.path.realpath(os.environ["QUDA_PATH"]) -build_pyquda_pyx(os.path.dirname(__file__), quda_path) -if os.path.exists(os.path.join(quda_path, "lib", "libquda.so")): +if "QUDA_PATH" in os.environ: + quda_path = os.path.realpath(os.environ["QUDA_PATH"]) + build_pyquda_pyx(os.path.dirname(__file__), quda_path) + if os.path.exists(os.path.join(quda_path, "lib", "libquda.so")): + _STATIC = False + elif os.path.exists(os.path.join(quda_path, "lib", "libquda.a")): + _STATIC = True + else: + raise FileNotFoundError(f"Cannot find libquda.so or libquda.a in {os.path.join(quda_path, 'lib')}") +elif "sdist" in sys.argv: + quda_path = "" _STATIC = False -elif os.path.exists(os.path.join(quda_path, "lib", "libquda.a")): - _STATIC = True else: - raise RuntimeError(f"Cannot find libquda.so or libquda.a in {os.path.join(quda_path, 'lib')}") + raise EnvironmentError("QUDA_PATH environment is needed to link against libquda") extensions = cythonize( [