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

In Python setup file, change directory instead of using absolute paths #419

Merged
merged 2 commits into from
Apr 25, 2024
Merged
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
24 changes: 11 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
from os import chdir
from pathlib import Path
from platform import system
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from subprocess import check_call

this_dir = Path(__file__).parent
long_description = (this_dir / "bindings/python/README.md").read_text()


def f(path_str):
return str(this_dir / path_str)


class CustomBuild(build_ext):
def run(self):
if system() == "Windows":
try:
check_call([f("blst\\build.bat")])
check_call(["blst\\build.bat"])
except Exception:
pass
check_call(["make", "-C", f("src"), "blst"])
check_call(["make", "-C", "src", "blst"])
super().run()


def main():
# Change directory so we don't have to deal with paths.
setup_dir = Path(__file__).parent.resolve()
chdir(setup_dir)

setup(
name="ckzg",
version="1.0.1",
author="Ethereum Foundation",
author_email="[email protected]",
url="https://github.com/ethereum/c-kzg-4844",
description="Python bindings for C-KZG-4844",
long_description=long_description,
long_description=Path("bindings/python/README.md").read_text(),
long_description_content_type="text/markdown",
license="Apache-2.0",
ext_modules=[
Extension(
"ckzg",
sources=[f("bindings/python/ckzg.c"), f("src/c_kzg_4844.c")],
include_dirs=[f("inc"), f("src")],
library_dirs=[f("lib")],
sources=["bindings/python/ckzg.c", "src/c_kzg_4844.c"],
include_dirs=["inc", "src"],
library_dirs=["lib"],
libraries=["blst"]
)
],
Expand Down
Loading