-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add source distribution for Python package (#415)
Also improves setup.py and moves it to the repo's root directory.
- Loading branch information
Showing
6 changed files
with
125 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This is a manifest for the Python bindings | ||
include bindings/python/ckzg.c | ||
include bindings/python/README.md | ||
recursive-include blst * | ||
recursive-include lib * | ||
recursive-include inc * | ||
recursive-include src * | ||
include setup.py | ||
include LICENSE | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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")]) | ||
except Exception: | ||
pass | ||
check_call(["make", "-C", f("src"), "c_kzg_4844.o"]) | ||
super().run() | ||
|
||
|
||
def main(): | ||
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_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")], | ||
libraries=["blst"] | ||
) | ||
], | ||
cmdclass={ | ||
"build_ext": CustomBuild, | ||
} | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |