mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
refactor(python): customize python package build
This commit is contained in:
@@ -16,13 +16,25 @@ class MakeExtension(Extension):
|
||||
self.sourcedir = os.path.abspath(sourcedir)
|
||||
|
||||
|
||||
def build_dir():
|
||||
return os.environ.get("CONCRETE_COMPILER_BUILD_DIR", "build/")
|
||||
|
||||
|
||||
class MakeBuild(build_ext):
|
||||
def run(self):
|
||||
for ext in self.extensions:
|
||||
self.build_extension(ext)
|
||||
|
||||
def build_extension(self, ext):
|
||||
subprocess.check_call(["make", "python-bindings"])
|
||||
cmd = ["make", f"BUILD_DIR={build_dir()}"]
|
||||
py_exec = os.environ.get("CONCRETE_COMPILER_Python3_EXECUTABLE")
|
||||
if py_exec:
|
||||
cmd.append(f"Python3_EXECUTABLE={py_exec}")
|
||||
ccache = os.environ.get("CONCRETE_COMPILER_CCACHE")
|
||||
if ccache:
|
||||
cmd.append(f"CCACHE={ccache}")
|
||||
cmd.append("python-bindings")
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
@@ -37,15 +49,15 @@ setuptools.setup(
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/zama-ai/homomorphizer",
|
||||
packages=setuptools.find_packages(
|
||||
where="build/tools/zamalang/python_packages/zamalang_core",
|
||||
where=build_dir() + "tools/zamalang/python_packages/zamalang_core",
|
||||
include=["zamalang", "zamalang.*"],
|
||||
)
|
||||
+ setuptools.find_namespace_packages(
|
||||
where="build/tools/zamalang/python_packages/zamalang_core",
|
||||
where=build_dir() + "tools/zamalang/python_packages/zamalang_core",
|
||||
include=["mlir", "mlir.*"],
|
||||
),
|
||||
install_requires=["numpy"],
|
||||
package_dir={"": "build/tools/zamalang/python_packages/zamalang_core"},
|
||||
package_dir={"": build_dir() + "tools/zamalang/python_packages/zamalang_core"},
|
||||
include_package_data=True,
|
||||
package_data={"": ["*.so"]},
|
||||
classifiers=[
|
||||
|
||||
Reference in New Issue
Block a user