From a6ca6ebca57d915d4f46801613a49e43938d7d4a Mon Sep 17 00:00:00 2001 From: xuhe Date: Thu, 26 Sep 2024 14:13:10 +0800 Subject: [PATCH] Add setup.py file for build --- setup.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..8a9edc2d --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +import os +import sys + +from setuptools import Extension, setup + +NO_EXTENSIONS = ( + bool(os.environ.get("FROZENLIST_NO_EXTENSIONS")) + or sys.implementation.name != "cpython" +) + +if NO_EXTENSIONS: + print("*********************") + print("* Pure Python build *") + print("*********************") + ext_modules = None +else: + print("*********************") + print("* Accelerated build *") + print("*********************") + ext_modules = [Extension("frozenlist._frozenlist", ["frozenlist/_frozenlist.c"])] + + +setup( + ext_modules=ext_modules, +)