In Python setup file, change directory instead of using absolute paths (#419)
This commit is contained in:
parent
a874006744
commit
4d3e76d500
24
setup.py
24
setup.py
|
@ -1,29 +1,27 @@
|
||||||
|
from os import chdir
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from platform import system
|
from platform import system
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
from setuptools.command.build_ext import build_ext
|
from setuptools.command.build_ext import build_ext
|
||||||
from subprocess import check_call
|
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):
|
class CustomBuild(build_ext):
|
||||||
def run(self):
|
def run(self):
|
||||||
if system() == "Windows":
|
if system() == "Windows":
|
||||||
try:
|
try:
|
||||||
check_call([f("blst\\build.bat")])
|
check_call(["blst\\build.bat"])
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
check_call(["make", "-C", f("src"), "blst"])
|
check_call(["make", "-C", "src", "blst"])
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Change directory so we don't have to deal with paths.
|
||||||
|
setup_dir = Path(__file__).parent.resolve()
|
||||||
|
chdir(setup_dir)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="ckzg",
|
name="ckzg",
|
||||||
version="1.0.1",
|
version="1.0.1",
|
||||||
|
@ -31,15 +29,15 @@ def main():
|
||||||
author_email="security@ethereum.org",
|
author_email="security@ethereum.org",
|
||||||
url="https://github.com/ethereum/c-kzg-4844",
|
url="https://github.com/ethereum/c-kzg-4844",
|
||||||
description="Python bindings for 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",
|
long_description_content_type="text/markdown",
|
||||||
license="Apache-2.0",
|
license="Apache-2.0",
|
||||||
ext_modules=[
|
ext_modules=[
|
||||||
Extension(
|
Extension(
|
||||||
"ckzg",
|
"ckzg",
|
||||||
sources=[f("bindings/python/ckzg.c"), f("src/c_kzg_4844.c")],
|
sources=["bindings/python/ckzg.c", "src/c_kzg_4844.c"],
|
||||||
include_dirs=[f("inc"), f("src")],
|
include_dirs=["inc", "src"],
|
||||||
library_dirs=[f("lib")],
|
library_dirs=["lib"],
|
||||||
libraries=["blst"]
|
libraries=["blst"]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue