diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | .pre-commit-config.yaml | 19 | ||||
| -rw-r--r-- | Makefile | 122 | ||||
| -rw-r--r-- | python-nanobind.conf | 11 | ||||
| -rw-r--r-- | python-nanobind.spec | 200 | ||||
| -rw-r--r-- | sources | 2 |
6 files changed, 356 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b96494c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/nanobind-2.4.0.tar.gz +/*.src.rpm diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f26de03 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-ast + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + - id: fix-byte-order-marker + - id: detect-private-key + +exclude: ".*\\.patch" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5a8b51d --- /dev/null +++ b/Makefile @@ -0,0 +1,122 @@ +.DEFAULT_GOAL=help + +# See ~/.config/mock/<CONFIG>.cfg or /etc/mock/<CONFIG>.cfg +# Tweak this to centos-stream-9-x86_64 to build for CentOS +MOCK_CHROOT?=fedora-rawhide-x86_64 +MOCK_OPTS?= +MOCK_OPTS_DEFAULT?=--no-clean --no-cleanup-after $(MOCK_OPTS) +YYYYMMDD=$(shell date +%Y%m%d) +SOURCEDIR=$(shell pwd) +SPEC=python-nanobind.spec +# When nothing is given, this will be automatically determined +SRPM_PATH?= + +######### Get sources + +.PHONY: get-sources +## Downloads all sources we need for a build. +get-sources: + spectool -g --define "_sourcedir $(SOURCEDIR)" $(SPEC) + +######### Build SRPM + +.PHONY: srpm +## Builds an SRPM that can be used for a build. +srpm: get-sources + fedpkg --release f40 srpm + +# rpmbuild \ +# --define "_rpmdir $(SOURCEDIR)" \ +# --define "_sourcedir $(SOURCEDIR)" \ +# --define "_specdir $(SOURCEDIR)" \ +# --define "_srcrpmdir $(SOURCEDIR)" \ +# --define "_builddir $(SOURCEDIR)" \ +# -bs $(SPEC) + +######### Scrub mock chroot and cache + +.PHONY: scrub-chroot +## Completely remove the fedora chroot and cache. +scrub-chroot: + mock -r $(MOCK_CHROOT) --scrub all + +######### Do a mock build + +.PHONY: mockbuild +## Start a mock build of the SRPM. +mockbuild: srpm get-srpm + mock -r $(MOCK_CHROOT) $(MOCK_OPTS_DEFAULT) $(srpm_path) + +######### Edit-last-failing-script + +.PHONY: get-last-run-script +## Get the file that was last modified in /var/tmp/ within the chroot. +get-last-run-script: + $(eval last_run_script:=/var/tmp/$(shell ls -t1 /var/lib/mock/$(MOCK_CHROOT)/root/var/tmp | head -n1)) + $(info last_run_script=$(last_run_script)) + @echo > /dev/null + +.PHONY: edit-last-failing-script +## Opens the last failing or running script from mock in your editor +## of choice for you to edit it and later re-run it in mock with: +## "make mockbuild-rerun-last-script". +edit-last-failing-script: get-last-run-script + $$EDITOR /var/lib/mock/$(MOCK_CHROOT)/root$(last_run_script) + +######### Re-run the last failing script from mock + +.PHONY: mockbuild-rerun-last-script +## Re-runs the last failing or running script of your mock mockbuild. +mockbuild-rerun-last-script: get-last-run-script + mock --root=$(MOCK_CHROOT) --shell 'sh -e $(last_run_script)' + +.PHONY: help +# Based on https://gist.github.com/rcmachado/af3db315e31383502660 +## Display this help text. +help:/ + $(info Available targets) + $(info -----------------) + @awk '/^[a-zA-Z\-0-9]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + helpCommand = substr($$1, 0, index($$1, ":")-1); \ + if (helpMessage) { \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + gsub(/##/, "\n ", helpMessage); \ + } else { \ + helpMessage = "(No documentation)"; \ + } \ + printf "%-37s - %s\n", helpCommand, helpMessage; \ + lastLine = "" \ + } \ + { hasComment = match(lastLine, /^## (.*)/); \ + if(hasComment) { \ + lastLine=lastLine$$0; \ + } \ + else { \ + lastLine = $$0 \ + } \ + }' $(MAKEFILE_LIST) + +######### Version/Release helper targets to build name of SRPM + +.PHONY: get-version +## Determines the LLVM version given in the llvm.spec file. +get-version: + $(eval version:=$(shell grep -ioP 'Version:\s*\K[^\s]+' $(SPEC))) + $(info Version: $(version)) + @echo > /dev/null + +.PHONY: get-release +## Parses the spec file for the Release: tag +get-release: + $(eval release:=$(shell rpmautospec calculate-release $(SPEC) | grep -Po '[0-9]+')) + $(info Release: $(release)) + @echo > /dev/null + +.PHONY: get-srpm +## Determines the name of the SRPM used for release builds +## Can be overriden by giving "make ... SRPM_PATH=foo.src.rpm". +get-srpm: get-version get-release + $(eval srpm_path:=python-nanobind-${version}-${release}.*.src.rpm) + $(info SRPM Release: $(srpm_path)) + @echo > /dev/null
\ No newline at end of file diff --git a/python-nanobind.conf b/python-nanobind.conf new file mode 100644 index 0000000..8e5c4f4 --- /dev/null +++ b/python-nanobind.conf @@ -0,0 +1,11 @@ +automode = true +archful = false +summary = "nanobind: tiny and efficient C++/Python bindings" +pypi_version = "2.4.0" +pypi_name = "nanobind" +python_name = "python-nanobind" +url = "https://github.com/wjakob/nanobind" +source = "PyPI" +archive_name = "nanobind-2.4.0.tar.gz" +extras = [] +license_files_present = false diff --git a/python-nanobind.spec b/python-nanobind.spec new file mode 100644 index 0000000..81a07a3 --- /dev/null +++ b/python-nanobind.spec @@ -0,0 +1,200 @@ +# We are building with clang for faster/lower memory LTO builds. +# See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros +%global toolchain clang + +Name: python-nanobind +Version: 2.4.0 +Release: %autorelease +Summary: nanobind: tiny and efficient C++/Python bindings + +License: BSD-3-Clause +URL: https://github.com/wjakob/nanobind +Source: %{pypi_source nanobind} + +BuildArch: noarch +BuildRequires: clang +BuildRequires: cmake +BuildRequires: eigen3-devel +BuildRequires: ninja-build +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-scipy + +%global _description %{expand: +nanobind is a small binding library that exposes C++ types +in Python and vice versa. It is reminiscent of Boost.Python +and pybind11 and uses near-identical syntax. +In contrast to these existing tools, nanobind is more +efficient: bindings compile in a shorter amount of time, +produce smaller binaries, and have better runtime performance.} + +%description %_description + +%package -n python%{python3_pkgversion}-nanobind +Summary: %{summary} +%description -n python%{python3_pkgversion}-nanobind %_description + + +%package -n python%{python3_pkgversion}-nanobind-devel +Summary: Libraries and headers for nanobind +Requires: %{name} = %{version}-%{release} +Requires: python%{python3_pkgversion}-nanobind-ext-devel = %{version}-%{release} +%description -n python%{python3_pkgversion}-nanobind-devel +Development files for nanobind. + + +%package -n python%{python3_pkgversion}-nanobind-ext-devel +Summary: Development extensions for nanobind +License: MIT +Requires: %{name} = %{version}-%{release} +%description -n python%{python3_pkgversion}-nanobind-ext-devel +Development extensions for nanobind. + + +%prep +%autosetup -p1 -n nanobind-%{version} + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%cmake \ + -G Ninja \ + -DNB_TEST_STABLE_ABI=ON \ + -DNB_TEST_SHARED_BUILD=ON +%cmake_build +%pyproject_wheel + + +%install +%pyproject_install +# Remove not needed files +rm %{buildroot}%{python3_sitelib}/nanobind/cmake/darwin-ld-cpython.sym +rm %{buildroot}%{python3_sitelib}/nanobind/cmake/darwin-ld-pypy.sym +#%%pyproject_save_files 'nanobind' + + +%check +%_pyproject_check_import_allow_no_modules -t +cd %{__cmake_builddir} +%pytest + + +#%%files -n python%%{python3_pkgversion}-nanobind -f %%{pyproject_files} +%files -n python%{python3_pkgversion}-nanobind +%license LICENSE +%dir %{python3_sitelib}/nanobind +%dir %{python3_sitelib}/nanobind-%{version}.dist-info +%dir %{python3_sitelib}/nanobind-%{version}.dist-info/licenses +%dir %{python3_sitelib}/nanobind/__pycache__ +%{python3_sitelib}/nanobind-%{version}.dist-info/INSTALLER +%{python3_sitelib}/nanobind-%{version}.dist-info/METADATA +%{python3_sitelib}/nanobind-%{version}.dist-info/WHEEL +%{python3_sitelib}/nanobind-%{version}.dist-info/licenses/LICENSE +%{python3_sitelib}/nanobind/__init__.py +%{python3_sitelib}/nanobind/__main__.py +%{python3_sitelib}/nanobind/__pycache__/__init__.*.pyc +%{python3_sitelib}/nanobind/__pycache__/__main__.*.pyc +%{python3_sitelib}/nanobind/__pycache__/stubgen.*.pyc + + +%files -n python%{python3_pkgversion}-nanobind-devel +%license LICENSE +%dir %{python3_sitelib}/nanobind/include +%dir %{python3_sitelib}/nanobind/include/nanobind +%dir %{python3_sitelib}/nanobind/include/nanobind/eigen +%dir %{python3_sitelib}/nanobind/include/nanobind/intrusive +%dir %{python3_sitelib}/nanobind/include/nanobind/stl +%dir %{python3_sitelib}/nanobind/include/nanobind/stl/detail +%dir %{python3_sitelib}/nanobind/src +%dir %{python3_sitelib}/nanobind/cmake +%{python3_sitelib}/nanobind/cmake/nanobind-config-version.cmake +%{python3_sitelib}/nanobind/cmake/nanobind-config.cmake +%{python3_sitelib}/nanobind/include/nanobind/eigen/dense.h +%{python3_sitelib}/nanobind/include/nanobind/eigen/sparse.h +%{python3_sitelib}/nanobind/include/nanobind/eval.h +%{python3_sitelib}/nanobind/include/nanobind/intrusive/counter.h +%{python3_sitelib}/nanobind/include/nanobind/intrusive/counter.inl +%{python3_sitelib}/nanobind/include/nanobind/intrusive/ref.h +%{python3_sitelib}/nanobind/include/nanobind/make_iterator.h +%{python3_sitelib}/nanobind/include/nanobind/nanobind.h +%{python3_sitelib}/nanobind/include/nanobind/nb_accessor.h +%{python3_sitelib}/nanobind/include/nanobind/nb_attr.h +%{python3_sitelib}/nanobind/include/nanobind/nb_call.h +%{python3_sitelib}/nanobind/include/nanobind/nb_cast.h +%{python3_sitelib}/nanobind/include/nanobind/nb_class.h +%{python3_sitelib}/nanobind/include/nanobind/nb_defs.h +%{python3_sitelib}/nanobind/include/nanobind/nb_descr.h +%{python3_sitelib}/nanobind/include/nanobind/nb_enums.h +%{python3_sitelib}/nanobind/include/nanobind/nb_error.h +%{python3_sitelib}/nanobind/include/nanobind/nb_func.h +%{python3_sitelib}/nanobind/include/nanobind/nb_lib.h +%{python3_sitelib}/nanobind/include/nanobind/nb_misc.h +%{python3_sitelib}/nanobind/include/nanobind/nb_python.h +%{python3_sitelib}/nanobind/include/nanobind/nb_traits.h +%{python3_sitelib}/nanobind/include/nanobind/nb_tuple.h +%{python3_sitelib}/nanobind/include/nanobind/nb_types.h +%{python3_sitelib}/nanobind/include/nanobind/ndarray.h +%{python3_sitelib}/nanobind/include/nanobind/operators.h +%{python3_sitelib}/nanobind/include/nanobind/stl/array.h +%{python3_sitelib}/nanobind/include/nanobind/stl/bind_map.h +%{python3_sitelib}/nanobind/include/nanobind/stl/bind_vector.h +%{python3_sitelib}/nanobind/include/nanobind/stl/chrono.h +%{python3_sitelib}/nanobind/include/nanobind/stl/complex.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/chrono.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/nb_array.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/nb_dict.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/nb_list.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/nb_optional.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/nb_set.h +%{python3_sitelib}/nanobind/include/nanobind/stl/detail/traits.h +%{python3_sitelib}/nanobind/include/nanobind/stl/filesystem.h +%{python3_sitelib}/nanobind/include/nanobind/stl/function.h +%{python3_sitelib}/nanobind/include/nanobind/stl/list.h +%{python3_sitelib}/nanobind/include/nanobind/stl/map.h +%{python3_sitelib}/nanobind/include/nanobind/stl/optional.h +%{python3_sitelib}/nanobind/include/nanobind/stl/pair.h +%{python3_sitelib}/nanobind/include/nanobind/stl/set.h +%{python3_sitelib}/nanobind/include/nanobind/stl/shared_ptr.h +%{python3_sitelib}/nanobind/include/nanobind/stl/string.h +%{python3_sitelib}/nanobind/include/nanobind/stl/string_view.h +%{python3_sitelib}/nanobind/include/nanobind/stl/tuple.h +%{python3_sitelib}/nanobind/include/nanobind/stl/unique_ptr.h +%{python3_sitelib}/nanobind/include/nanobind/stl/unordered_map.h +%{python3_sitelib}/nanobind/include/nanobind/stl/unordered_set.h +%{python3_sitelib}/nanobind/include/nanobind/stl/variant.h +%{python3_sitelib}/nanobind/include/nanobind/stl/vector.h +%{python3_sitelib}/nanobind/include/nanobind/stl/wstring.h +%{python3_sitelib}/nanobind/include/nanobind/trampoline.h +%{python3_sitelib}/nanobind/include/nanobind/typing.h +%{python3_sitelib}/nanobind/src/buffer.h +%{python3_sitelib}/nanobind/src/common.cpp +%{python3_sitelib}/nanobind/src/error.cpp +%{python3_sitelib}/nanobind/src/hash.h +%{python3_sitelib}/nanobind/src/implicit.cpp +%{python3_sitelib}/nanobind/src/nb_combined.cpp +%{python3_sitelib}/nanobind/src/nb_enum.cpp +%{python3_sitelib}/nanobind/src/nb_func.cpp +%{python3_sitelib}/nanobind/src/nb_internals.cpp +%{python3_sitelib}/nanobind/src/nb_internals.h +%{python3_sitelib}/nanobind/src/nb_ndarray.cpp +%{python3_sitelib}/nanobind/src/nb_static_property.cpp +%{python3_sitelib}/nanobind/src/nb_type.cpp +%{python3_sitelib}/nanobind/src/trampoline.cpp +%{python3_sitelib}/nanobind/stubgen.py + + +%files -n python%{python3_pkgversion}-nanobind-ext-devel +%license ext/robin_map/LICENSE +%dir %{python3_sitelib}/nanobind/ext +%dir %{python3_sitelib}/nanobind/ext/robin_map +%dir %{python3_sitelib}/nanobind/ext/robin_map/include +%dir %{python3_sitelib}/nanobind/ext/robin_map/include/tsl +%{python3_sitelib}/nanobind/ext/robin_map/include/tsl/* + + +%changelog +%autochangelog
\ No newline at end of file @@ -0,0 +1,2 @@ +SHA512 (nanobind-2.4.0.tar.gz) = a380254d58b3fda540b6b58a25207f7022d66de51a6622cca9eb02b206658e5fc4dafb6e569877c5810a7ecd374a86e8b84ffe5c810414e131b40b5266c91a52 + |
