mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Stage the Python license file during builds (#9015)
Copy the repo-root LICENSE into the Python package directory for the duration of setup() so license_files = LICENSE remains valid without using deprecated parent-directory paths. Remove the staged copy after the build completes.
This commit is contained in:
@@ -12,33 +12,54 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(
|
|
||||||
name='flatbuffers',
|
_THIS_DIR = Path(__file__).resolve().parent
|
||||||
version='25.12.19',
|
_ROOT_LICENSE = _THIS_DIR.parent / 'LICENSE'
|
||||||
license='Apache 2.0',
|
_LOCAL_LICENSE = _THIS_DIR / 'LICENSE'
|
||||||
author='Derek Bailey',
|
|
||||||
author_email='derekbailey@google.com',
|
|
||||||
url='https://google.github.io/flatbuffers/',
|
def _stage_license_file():
|
||||||
long_description=(
|
if _LOCAL_LICENSE.exists() or not _ROOT_LICENSE.exists():
|
||||||
'Python runtime library for use with the '
|
return False
|
||||||
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
|
shutil.copyfile(_ROOT_LICENSE, _LOCAL_LICENSE)
|
||||||
'serialization format.'
|
return True
|
||||||
),
|
|
||||||
packages=['flatbuffers'],
|
_remove_staged_license = _stage_license_file()
|
||||||
include_package_data=True,
|
|
||||||
requires=[],
|
try:
|
||||||
description='The FlatBuffers serialization format for Python',
|
setup(
|
||||||
classifiers=[
|
name='flatbuffers',
|
||||||
'Intended Audience :: Developers',
|
version='25.12.19',
|
||||||
'Operating System :: OS Independent',
|
license='Apache 2.0',
|
||||||
'Programming Language :: Python',
|
author='Derek Bailey',
|
||||||
'Programming Language :: Python :: 3',
|
author_email='derekbailey@google.com',
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
url='https://google.github.io/flatbuffers/',
|
||||||
],
|
long_description=(
|
||||||
project_urls={
|
'Python runtime library for use with the '
|
||||||
'Documentation': 'https://google.github.io/flatbuffers/',
|
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
|
||||||
'Source': 'https://github.com/google/flatbuffers',
|
'serialization format.'
|
||||||
},
|
),
|
||||||
)
|
packages=['flatbuffers'],
|
||||||
|
include_package_data=True,
|
||||||
|
requires=[],
|
||||||
|
description='The FlatBuffers serialization format for Python',
|
||||||
|
classifiers=[
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'Operating System :: OS Independent',
|
||||||
|
'Programming Language :: Python',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||||
|
],
|
||||||
|
project_urls={
|
||||||
|
'Documentation': 'https://google.github.io/flatbuffers/',
|
||||||
|
'Source': 'https://github.com/google/flatbuffers',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
if _remove_staged_license and _LOCAL_LICENSE.exists():
|
||||||
|
_LOCAL_LICENSE.unlink()
|
||||||
|
|||||||
Reference in New Issue
Block a user