From 1e80e96d5d5587bdd3dcf5c33e34f535ef9ed948 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Thu, 23 Nov 2023 20:19:13 +0100 Subject: [PATCH] Add pyproject.toml and move metadata to setup.cfg The pyproject.toml make the project buildable with pip without calling directly to setup.py. The metadata in setup.cfg makes the setup.py smaller and it's easier to modify metadata in the cfg file instead of using python directly. --- pyproject.toml | 3 +++ setup.cfg | 19 +++++++++++++++++++ setup.py | 31 +++++++++++-------------------- 3 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d8cbda7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,19 @@ +[metadata] +name = bink +version = 0.3.1 +author = Rafael Garcia +description = Runtime for Ink, a scripting language for writing interactive narrative +long_description = file: README.rst +license = Apache 2.0 +classifiers = + Programming Language :: Python :: 3 + +[options] +zip_safe = False +packages = find: + +[options.packages.find] +exclude = + tests* + dist* + build* diff --git a/setup.py b/setup.py index 61f5fd9..ba04d92 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,20 @@ """Package definition.""" -import setuptools, sys -from setuptools import find_packages, setup + + +import sys +from setuptools import setup, Distribution from wheel.bdist_wheel import bdist_wheel -from os import path -from io import open -class BinaryDistribution (setuptools.Distribution): + +class BinaryDistribution (Distribution): def has_ext_modules(self): return True + class BdistWheel(bdist_wheel): def get_tag(self): - return ('py3', 'none') + bdist_wheel.get_tag(self)[2:] + return ('py3', 'none') + super().get_tag()[2:] + def get_package_data(): plat_name_idx = None @@ -32,35 +35,23 @@ def get_package_data(): lib = 'bink.dll' else: raise RuntimeError('Unsupported platform: ' + plat_name) - + arch = "x86_64/" if "arm64" in plat_name or "aarch64" in plat_name: arch = "arm64/" lib = arch + lib - + return ['native/' + lib] # if it is not present, return ['native/*'] return ['native/*'] -description = open( - path.join(path.abspath(path.dirname(__file__)), 'README.rst'), - encoding='utf-8').read() setup( - name='bink', - packages=find_packages(exclude=['tests']), - version='0.3.1', - description='Runtime for Ink, a scripting language for writing interactive narrative', - long_description_content_type='text/x-rst', - long_description=description, - author='Rafael Garcia', - license='Apache 2.0', package_data={'bink': get_package_data()}, distclass = BinaryDistribution, cmdclass = { 'bdist_wheel': BdistWheel, }, - zip_safe=False # native libraries are included in the package )