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

Use pyproject.toml files for easier management #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions leapc-cffi/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include src/leapc_cffi/*
include src/scripts/*
include cffi_build.py
include src/leapc_cffi/LeapC.dll
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
_HERE = os.path.abspath(os.path.dirname(__file__))

# The resource directory needs to contain the LeapC headers and libraries
_RESOURCE_DIRECTORY = os.path.join(_HERE, "..", "leapc_cffi")
_RESOURCE_DIRECTORY = os.path.join(_HERE, "src/leapc_cffi")


def sanitise_leapc_header(input_str):
Expand Down Expand Up @@ -82,10 +82,6 @@ def sanitise_leapc_header(input_str):
ffibuilder = FFI()
ffibuilder.cdef(cffi_cdef, packed=True)

cffi_src_fpath = os.path.join(os.path.dirname(__file__), "cffi_src.h")
with open(cffi_src_fpath) as fp:
cffi_src = fp.read()

extra_link_args = {
"Windows": [],
"Linux": ["-Wl,-rpath=$ORIGIN"],
Expand All @@ -96,7 +92,7 @@ def sanitise_leapc_header(input_str):

ffibuilder.set_source(
"_leapc_cffi",
cffi_src,
"#include <LeapC.h>",
libraries=os_libraries[platform.system()],
include_dirs=[_RESOURCE_DIRECTORY],
library_dirs=[_RESOURCE_DIRECTORY],
Expand Down
24 changes: 24 additions & 0 deletions leapc-cffi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools >= 48.0", "cffi", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "leapc_cffi"
version = "0.0.1"
requires-python = ">= 3.8"
authors = [{name = "Ultraleap", email = "[email protected]"}]
description = "Python CFFI bindings for LeapC"
readme = "README.md"
license = {text = "Apache-2.0"}
keywords = ["leapc", "leap", "ultraleap", "hand tracking"]

[project.urls]
Homepage = "https://ultraleap.com"
Repository = "https://github.com/ultraleap/leapc-python-bindings.git"
Issues = "https://github.com/ultraleap/leapc-python-bindings/issues"

[tool.setuptools.exclude-package-data]
"*" = ["*.h", "*.lib"]

[tool.cibuildwheel]
archs = ["auto64"]
26 changes: 7 additions & 19 deletions leapc-cffi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,10 @@ def gather_leap_sdk():

gather_leap_sdk()

setuptools.setup(
name="leapc_cffi",
version="0.0.1",
author="Ultraleap",
description="Python CFFI bindings for LeapC",
long_description=long_description,
long_description_content_type="text/markdown",
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
include_package_data=True,
exclude_package_data={
"": ["*.h", "*.lib", "scripts/*"]
}, # Excluded from the installed package
python_requires=">=3.8",
setup_requires=["cffi"],
install_requires=["cffi"],
ext_package="leapc_cffi", # The location that the CFFI module will be built
cffi_modules=["src/scripts/cffi_build.py:ffibuilder"],
)
if __name__ == "__main__":
setuptools.setup(
#CFFI
package_dir={"": "src"},
ext_package="leapc_cffi", # The location that the CFFI module will be built
cffi_modules=["cffi_build.py:ffibuilder"],
)
1 change: 0 additions & 1 deletion leapc-cffi/src/scripts/cffi_src.h

This file was deleted.

1 change: 0 additions & 1 deletion leapc-python-api/MANIFEST.in

This file was deleted.

19 changes: 19 additions & 0 deletions leapc-python-api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[build-system]
requires = ["setuptools >= 48.0"]
build-backend = "setuptools.build_meta"

[project]
name = "leap"
version = "0.0.1"
dependencies = ["leapc-cffi @ git+https://github.com/ultraleap/leapc-python-bindings.git/#subdirectory=leapc-cffi"]
requires-python = ">= 3.8"
authors = [{name = "Ultraleap", email = "[email protected]"}]
description = "Python wrappers around LeapC bindings"
readme = "README.md"
license = {text = "Apache-2.0"}
keywords = ["leapc", "leap", "ultraleap", "hand tracking"]

[project.urls]
Homepage = "https://ultraleap.com"
Repository = "https://github.com/ultraleap/leapc-python-bindings.git"
Issues = "https://github.com/ultraleap/leapc-python-bindings/issues"
19 changes: 0 additions & 19 deletions leapc-python-api/setup.py

This file was deleted.