From be50eb1d7ad626bb972e76dfcc2e895c1d203c8a Mon Sep 17 00:00:00 2001 From: Zhangyanrui123 <2844259537@qq.com> Date: Fri, 6 Nov 2026 22:26:48 +0800 Subject: [PATCH] build: prepare C++ 1.68.0 release metadata and legal materials --- CMakeLists.txt | 19 ++- DISCLAIMER | 8 ++ LICENSE | 222 +++++++++++++++++++++++++++++ MANIFEST.in | 27 +++- NOTICE | 12 ++ README.md | 31 ++-- THIRD_PARTY.md | 50 +++++++ licenses/nlohmann-json-LICENSE.txt | 21 +++ licenses/pybind11-LICENSE.txt | 29 ++++ pycasbin/CMakeLists.txt | 2 +- pycasbin/README.md | 19 ++- setup.py | 51 ++++++- 12 files changed, 465 insertions(+), 26 deletions(-) create mode 100644 DISCLAIMER create mode 100644 NOTICE create mode 100644 THIRD_PARTY.md create mode 100644 licenses/nlohmann-json-LICENSE.txt create mode 100644 licenses/pybind11-LICENSE.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 917862da..104a3865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required(VERSION 3.19) set(CMAKE_WARN_DEPRECATED ON) -set(PY_CASBIN_VERSION 1.1) +set(PY_CASBIN_VERSION 1.68.0) if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) # The value of this variable should be set prior to the first project() command invocation @@ -28,9 +28,9 @@ endif() project( casbin - VERSION 1.53.2 + VERSION 1.68.0 DESCRIPTION "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++" - HOMEPAGE_URL https://github.com/casbin/casbin-cpp + HOMEPAGE_URL https://github.com/apache/casbin-cpp LANGUAGES CXX C ) @@ -186,6 +186,19 @@ if(CASBIN_INSTALL) set(CASBIN_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/casbin" CACHE STRING "Path to the installed casbin CMake package files") + # Carry the exact source legal material into installed C++ packages. + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" CASBIN_BINARY_LICENSE) + string(FIND "${CASBIN_BINARY_LICENSE}" "setup.py contains build helper code" CASBIN_SOURCE_ONLY_LICENSE) + if(CASBIN_SOURCE_ONLY_LICENSE GREATER -1) + string(SUBSTRING "${CASBIN_BINARY_LICENSE}" 0 ${CASBIN_SOURCE_ONLY_LICENSE} CASBIN_BINARY_LICENSE) + endif() + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/licenses/nlohmann-json-LICENSE.txt" CASBIN_JSON_LICENSE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE-installed" + "${CASBIN_BINARY_LICENSE}\nThe installed library includes code compiled from nlohmann/json (MIT):\n\n${CASBIN_JSON_LICENSE}") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LICENSE-installed" + DESTINATION ${CMAKE_INSTALL_DATADIR}/casbin RENAME LICENSE) + install(FILES NOTICE DISCLAIMER DESTINATION ${CMAKE_INSTALL_DATADIR}/casbin) + # Installing headers install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/casbin diff --git a/DISCLAIMER b/DISCLAIMER new file mode 100644 index 00000000..8631ee2c --- /dev/null +++ b/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Casbin is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of +all newly accepted projects until a further review indicates that the +infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of +the code, it does indicate that the project has yet to be fully endorsed by +the ASF. diff --git a/LICENSE b/LICENSE index 261eeb9e..8610fc34 100644 --- a/LICENSE +++ b/LICENSE @@ -199,3 +199,225 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +---------------------------------------------------------------------- +Bundled third-party material +---------------------------------------------------------------------- + +include/casbin/exprtk/exprtk.hpp contains ExprTk by Arash Partow, under the +MIT license below. The upstream header and its attribution are preserved. + +Copyright (C) 1999-2024 Arash Partow + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to +do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +---------------------------------------------------------------------- +casbin/ip_parser/ and include/casbin/ip_parser/ contain C++ adaptations of +the Go net IP parsing code. The Go-derived portions use the following BSD +license; Casbin's contributions remain under Apache-2.0. + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +setup.py contains build helper code derived from pybind/cmake_example. +Its applicable license follows (Casbin metadata changes are Apache-2.0). + +Copyright (c) 2016 The Pybind Development Team, All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You are under no obligation whatsoever to provide any bug fixes, patches, or +upgrades to the features, functionality or performance of the source code +("Enhancements") to anyone; however, if you choose to make your Enhancements +available either publicly, or directly to the author of this software, without +imposing a separate written license agreement for such Enhancements, then you +hereby grant the following license: a non-exclusive, royalty-free perpetual +license to install, use, modify, prepare derivative works, incorporate into +other computer software, distribute, and sublicense such enhancements or +derivative works thereof, in binary and source code form. + +---------------------------------------------------------------------- +.gitignore incorporates the github/gitignore VisualStudio.gitignore template +under CC0 1.0 Universal: + +CC0 1.0 Universal + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator and +subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the +purpose of contributing to a commons of creative, cultural and scientific +works ("Commons") that the public can reliably and without fear of later +claims of infringement build upon, modify, incorporate in other works, reuse +and redistribute as freely as possible in any form whatsoever and for any +purposes, including without limitation commercial purposes. These owners may +contribute to the Commons to promote the ideal of a free culture and the +further production of creative, cultural and scientific works, or to gain +reputation or greater distribution for their Work in part through the use and +efforts of others. + +For these and/or other purposes and motivations, and without any expectation +of additional consideration or compensation, the person associating CC0 with a +Work (the "Affirmer"), to the extent that he or she is an owner of Copyright +and Related Rights in the Work, voluntarily elects to apply CC0 to the Work +and publicly distribute the Work under its terms, with knowledge of his or her +Copyright and Related Rights in the Work and the meaning and intended legal +effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not limited +to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, + and translate a Work; + + ii. moral rights retained by the original author(s) and/or performer(s); + + iii. publicity and privacy rights pertaining to a person's image or likeness + depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in + a Work; + + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation thereof, + including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world + based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, +applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and +unconditionally waives, abandons, and surrenders all of Affirmer's Copyright +and Related Rights and associated claims and causes of action, whether now +known or unknown (including existing as well as future claims and causes of +action), in the Work (i) in all territories worldwide, (ii) for the maximum +duration provided by applicable law or treaty (including future time +extensions), (iii) in any current or future medium and for any number of +copies, and (iv) for any purpose whatsoever, including without limitation +commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes +the Waiver for the benefit of each member of the public at large and to the +detriment of Affirmer's heirs and successors, fully intending that such Waiver +shall not be subject to revocation, rescission, cancellation, termination, or +any other legal or equitable action to disrupt the quiet enjoyment of the Work +by the public as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be +judged legally invalid or ineffective under applicable law, then the Waiver +shall be preserved to the maximum extent permitted taking into account +Affirmer's express Statement of Purpose. In addition, to the extent the Waiver +is so judged Affirmer hereby grants to each affected person a royalty-free, +non transferable, non sublicensable, non exclusive, irrevocable and +unconditional license to exercise Affirmer's Copyright and Related Rights in +the Work (i) in all territories worldwide, (ii) for the maximum duration +provided by applicable law or treaty (including future time extensions), (iii) +in any current or future medium and for any number of copies, and (iv) for any +purpose whatsoever, including without limitation commercial, advertising or +promotional purposes (the "License"). The License shall be deemed effective as +of the date CC0 was applied by Affirmer to the Work. Should any part of the +License for any reason be judged legally invalid or ineffective under +applicable law, such partial invalidity or ineffectiveness shall not +invalidate the remainder of the License, and in such case Affirmer hereby +affirms that he or she will not (i) exercise any of his or her remaining +Copyright and Related Rights in the Work or (ii) assert any associated claims +and causes of action with respect to the Work, in either case contrary to +Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + + b. Affirmer offers the Work as-is and makes no representations or warranties + of any kind concerning the Work, express, implied, statutory or otherwise, + including without limitation warranties of title, merchantability, fitness + for a particular purpose, non infringement, or the absence of latent or + other defects, accuracy, or the present or absence of errors, whether or not + discoverable, all to the greatest extent permissible under applicable law. + + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without limitation + any person's Copyright and Related Rights in the Work. Further, Affirmer + disclaims responsibility for obtaining any necessary consents, permissions + or other rights required for any use of the Work. + + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to this + CC0 or use of the Work. + +For more information, please see + diff --git a/MANIFEST.in b/MANIFEST.in index 3d6b5be1..0ab0d3ed 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,26 @@ -include README.md LICENSE +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +include README.md LICENSE NOTICE DISCLAIMER CMakeLists.txt .gitignore +recursive-include cmake *.cmake *.in +graft licenses graft include graft casbin -graft pycasbin/ -global-include CMakeLists.txt *.cmake +graft pycasbin +graft tests +graft examples +global-exclude __pycache__ *.py[cod] *.pyd *.so *.o *.obj diff --git a/NOTICE b/NOTICE new file mode 100644 index 00000000..65de9302 --- /dev/null +++ b/NOTICE @@ -0,0 +1,12 @@ +Apache Casbin (Incubating) - C++ +Copyright 2026 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (https://www.apache.org/). + +Historical notices from contributed Casbin source files: +Copyright 2020 The casbin Authors. All Rights Reserved. +Copyright 2021 The casbin Authors. All Rights Reserved. +Copyright 2022 The casbin Authors. All Rights Reserved. +Copyright 2023 The casbin Authors. All Rights Reserved. +Copyright 2026 The casbin Authors. All Rights Reserved. diff --git a/README.md b/README.md index 34c78a61..17d3dfbb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,17 @@ -Casbin-CPP +Apache Casbin C++ (Incubating) ==== -[![CI](https://github.com/casbin/casbin-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/casbin-cpp/actions/workflows/ci.yml) -[![GitHub release (latest by date)](https://img.shields.io/github/v/release/casbin/casbin-cpp)](https://github.com/casbin/casbin-cpp/releases/latest) +Apache Casbin is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of +all newly accepted projects until a further review indicates that the +infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of +the code, it does indicate that the project has yet to be fully endorsed by +the ASF. + +[![CI](https://github.com/apache/casbin-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/casbin-cpp/actions/workflows/ci.yml) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/casbin/casbin-cpp)](https://github.com/apache/casbin-cpp/releases/latest) [![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN) **News**: Are you still worried about how to write the correct Casbin policy? ``Casbin online editor`` is coming to help! Try it at: http://casbin.org/editor/ @@ -27,12 +36,12 @@ macOS | :heavy_check_mark: Available [Casbin](https://github.com/casbin/casbin) | [jCasbin](https://github.com/casbin/jcasbin) | [node-Casbin](https://github.com/casbin/node-casbin) | [PHP-Casbin](https://github.com/php-casbin/php-casbin) production-ready | production-ready | production-ready | production-ready -[![python](https://casbin.org/img/langs/python.png)](https://github.com/casbin/pycasbin) | [![dotnet](https://casbin.org/img/langs/dotnet.png)](https://github.com/casbin-net/Casbin.NET) | [![c++](https://casbin.org/img/langs/cpp.png)](https://github.com/casbin/casbin-cpp) | [![rust](https://casbin.org/img/langs/rust.png)](https://github.com/casbin/casbin-rs) +[![python](https://casbin.org/img/langs/python.png)](https://github.com/casbin/pycasbin) | [![dotnet](https://casbin.org/img/langs/dotnet.png)](https://github.com/casbin-net/Casbin.NET) | [![c++](https://casbin.org/img/langs/cpp.png)](https://github.com/apache/casbin-cpp) | [![rust](https://casbin.org/img/langs/rust.png)](https://github.com/casbin/casbin-rs) ----|----|----|---- -[PyCasbin](https://github.com/casbin/pycasbin) | [Casbin.NET](https://github.com/casbin-net/Casbin.NET) | [Casbin-CPP](https://github.com/casbin/casbin-cpp) | [Casbin-RS](https://github.com/casbin/casbin-rs) +[PyCasbin](https://github.com/casbin/pycasbin) | [Casbin.NET](https://github.com/casbin-net/Casbin.NET) | [Casbin-CPP](https://github.com/apache/casbin-cpp) | [Casbin-RS](https://github.com/casbin/casbin-rs) production-ready | production-ready | beta-test | production-ready -**Note**: PyCasbin-on-CPP is available to use. Refer to the [documentation](./bindings/README.md) for installation and usage. +**Note**: PyCasbin-on-CPP is available to use. Refer to the [documentation](./pycasbin/README.md) for installation and usage. ## Supported models @@ -129,7 +138,7 @@ include(FetchContent) FetchContent_Declare( casbin - GIT_REPOSITORY https://github.com/casbin/casbin-cpp.git + GIT_REPOSITORY https://github.com/apache/casbin-cpp.git GIT_TAG v1.38.1 ) @@ -169,7 +178,7 @@ You may integrate casbin into your CMake project through `find_package`. 1. Clone/checkout to [`casbin/casbin-cpp:master`](https://github.com/EmperorYP7/casbin-cpp/tree/ctest-setup) ```bash - git clone https://github.com/casbin/casbin-cpp.git + git clone https://github.com/apache/casbin-cpp.git ``` 2. Open terminal/cmd in the root directory of the project: @@ -217,7 +226,7 @@ You may integrate casbin into your CMake project through `find_package`. 1. Clone/checkout to [`casbin/casbin-cpp:master`](https://github.com/EmperorYP7/casbin-cpp/tree/ctest-setup) ```bash - git clone https://github.com/casbin/casbin-cpp.git + git clone https://github.com/apache/casbin-cpp.git ``` 2. Open terminal/cmd in the root directory of the project: @@ -366,7 +375,7 @@ Please read the [contributing guide](CONTRIBUTING.md). ## Contributors This project exists thanks to all the people who contribute. - + ## Star History @@ -379,5 +388,5 @@ This project is licensed under the [Apache 2.0 license](LICENSE). ## Contact If you have any issues or feature requests, please contact us. PR is welcomed. -- https://github.com/casbin/casbin-cpp/issues +- https://github.com/apache/casbin-cpp/issues - https://discord.gg/S5UjpzGZjN diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md new file mode 100644 index 00000000..02252dfa --- /dev/null +++ b/THIRD_PARTY.md @@ -0,0 +1,50 @@ + + +# Third-party source and build inputs + +The complete license texts and their exact file scopes are in LICENSE. +This inventory distinguishes bundled source from dependencies obtained during +a build; a dependency's build directory is not part of the source release. + +| Material | Source scope | Treatment | +| --- | --- | --- | +| ExprTk, Arash Partow | include/casbin/exprtk/exprtk.hpp | Retain the original MIT header and add its complete grant in LICENSE. The checked-in file is the project's historical copy introduced with its 0.0.3 update, not asserted to be byte-identical to today's upstream tag. | +| Go net IP parsing adaptations | casbin/ip_parser/ and include/casbin/ip_parser/ | Preserve/restore the Go copyright and BSD terms for the derived portions; Casbin-specific contributions retain their own Apache terms. Compare the historical introduction with Go net/ip.go and net/parse.go when reviewing provenance. | +| pybind/cmake_example build helper | setup.py | Retain its BSD attribution and terms in LICENSE; Casbin package metadata changes are separate contributions. | +| github/gitignore VisualStudio template | .gitignore | CC0 1.0; preserve the template's origin link and include CC0 in LICENSE. | +| Casbin logo and policy/test fixtures | assets/images/ and examples/ | Project assets and contributed fixtures; not third-party dependencies. | + +The upstream-selected build versions are unchanged. These commits record +the inspected snapshots; this patch does not replace the upstream tag refs +with immutable build pins: + +| Dependency | Version | Commit | Purpose / declared license | +| --- | --- | --- | --- | +| nlohmann/json | 3.12.0 | 55f93686c01528224f448c19128836e7df245f72 | Public header dependency / MIT; installed system packages >=3.10.1 remain supported | +| googletest | 1.18.0 | 063de7e9578f82b369302001269680b4b1553359 | Tests only / BSD-3-Clause | +| google/benchmark | 1.10.0 | a6b4a9f00b36c19af9997d68a1cf6e0b5b3d032c | Optional benchmarks / Apache-2.0; inspect its own NOTICE for separate binary distribution | +| pybind11 | 3.1.0 | 97bf890db679505a14dfe547a5e77bb2bd05dc90 | Optional local Python binding / BSD-3-Clause | + +An installed static library and the optional Python extension contain compiled +Casbin and ExprTk/IP parsing code; distribute the matching LICENSE, NOTICE and +DISCLAIMER with them. If packaging additional third-party binaries, account +for those actual contents independently. + +License texts under `licenses/` accompany local convenience builds that compile nlohmann/json and pybind11; their implementations are fetched separately and are not bundled in this source release. Installed C++ legal material includes the compiled JSON dependency and omits source-only build-helper/template terms. diff --git a/licenses/nlohmann-json-LICENSE.txt b/licenses/nlohmann-json-LICENSE.txt new file mode 100644 index 00000000..b5a10275 --- /dev/null +++ b/licenses/nlohmann-json-LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-2025 Niels Lohmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/licenses/pybind11-LICENSE.txt b/licenses/pybind11-LICENSE.txt new file mode 100644 index 00000000..e466b0df --- /dev/null +++ b/licenses/pybind11-LICENSE.txt @@ -0,0 +1,29 @@ +Copyright (c) 2016 Wenzel Jakob , All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of +external contributions to this project including patches, pull requests, etc. diff --git a/pycasbin/CMakeLists.txt b/pycasbin/CMakeLists.txt index 3104770e..038a9b8f 100644 --- a/pycasbin/CMakeLists.txt +++ b/pycasbin/CMakeLists.txt @@ -35,7 +35,7 @@ set_target_properties(pycasbin PROPERTIES ) # For in-source versioning macro -add_definitions(-DPY_CASBIN_VERSION=${PY_CASBIN_VERSION}) +add_definitions(-DPY_CASBIN_VERSION="${PY_CASBIN_VERSION}") target_link_libraries(pycasbin PRIVATE diff --git a/pycasbin/README.md b/pycasbin/README.md index d9eae1f9..ee3b091e 100644 --- a/pycasbin/README.md +++ b/pycasbin/README.md @@ -1,4 +1,17 @@ -## Language Bindings for `casbin-cpp` +# Apache Casbin C++ (Incubating): local Python bindings + +Apache Casbin is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of +all newly accepted projects until a further review indicates that the +infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of +the code, it does indicate that the project has yet to be fully endorsed by +the ASF. + +Use a dedicated virtual environment for these local bindings. The historical +`pycasbin` distribution name also identifies a different, pure-Python PyPI +project; this preparation does not add a PyPI publisher. At present, `casbin-cpp` provides language bindings for Python, we named it `pycasbin`. @@ -6,11 +19,11 @@ At present, `casbin-cpp` provides language bindings for Python, we named it `pyc ### Use `pip` install the `pycasbin` module -It is assumed you have `CMake >=v3.19` and `Python >= 3.6` installed. Current `pycasbin` only support `pip` install in local machine. +It is assumed you have `CMake >=v3.19` and `Python >= 3.9` installed. Current `pycasbin` only support `pip` install in local machine. 1. Clone/download the project: ```bash - git clone https://github.com/casbin/casbin-cpp.git + git clone https://github.com/apache/casbin-cpp.git ``` 2. Update `wheel setuptools`: diff --git a/setup.py b/setup.py index a7d9bbc1..da497bd9 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,42 @@ +# Copyright (c) 2016 The Pybind Development Team, All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# You are under no obligation whatsoever to provide any bug fixes, patches, or +# upgrades to the features, functionality or performance of the source code +# ("Enhancements") to anyone; however, if you choose to make your Enhancements +# available either publicly, or directly to the author of this software, without +# imposing a separate written license agreement for such Enhancements, then you +# hereby grant the following license: a non-exclusive, royalty-free perpetual +# license to install, use, modify, prepare derivative works, incorporate into +# other computer software, distribute, and sublicense such enhancements or +# derivative works thereof, in binary and source code form. + +# Adapted from pybind/cmake_example; Casbin metadata changes are Apache-2.0. + import os import re import subprocess @@ -47,6 +86,8 @@ def build_extension(self, ext): f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm "-DCMAKE_POLICY_VERSION_MINIMUM=3.5", + "-DCASBIN_BUILD_TEST=OFF", + "-DCASBIN_BUILD_BENCHMARK=OFF", ] build_args = [] # Adding CMake arguments set as environment variable @@ -123,11 +164,11 @@ def build_extension(self, ext): # logic and declaration, and simpler if you include description/version in a file. setup( name="pycasbin", - version="0.0.0", - description="An authorization library that supports access control models like ACL, RBAC, ABAC in Python", + version="1.68.0", + description="Apache Casbin (Incubating) C++ Python bindings for local builds", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/casbin/casbin-cpp", + url="https://github.com/apache/casbin-cpp", keywords=[ "casbin", "acl", @@ -139,7 +180,7 @@ def build_extension(self, ext): "access control", "permission", ], - ext_modules=[CMakeExtension("")], + ext_modules=[CMakeExtension("pycasbin")], cmdclass={"build_ext": CMakeBuild}, zip_safe=False, python_requires=">=3.9", @@ -155,5 +196,5 @@ def build_extension(self, ext): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - data_files=[desc_file], + license_files=["LICENSE", "NOTICE", "DISCLAIMER", "licenses/*.txt"], ) \ No newline at end of file