Skip to content

Commit 1e80e96

Browse files
committed
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.
1 parent 30b883d commit 1e80e96

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[metadata]
2+
name = bink
3+
version = 0.3.1
4+
author = Rafael Garcia
5+
description = Runtime for Ink, a scripting language for writing interactive narrative
6+
long_description = file: README.rst
7+
license = Apache 2.0
8+
classifiers =
9+
Programming Language :: Python :: 3
10+
11+
[options]
12+
zip_safe = False
13+
packages = find:
14+
15+
[options.packages.find]
16+
exclude =
17+
tests*
18+
dist*
19+
build*

setup.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
"""Package definition."""
2-
import setuptools, sys
3-
from setuptools import find_packages, setup
2+
3+
4+
import sys
5+
from setuptools import setup, Distribution
46
from wheel.bdist_wheel import bdist_wheel
5-
from os import path
6-
from io import open
77

8-
class BinaryDistribution (setuptools.Distribution):
8+
9+
class BinaryDistribution (Distribution):
910
def has_ext_modules(self):
1011
return True
1112

13+
1214
class BdistWheel(bdist_wheel):
1315
def get_tag(self):
14-
return ('py3', 'none') + bdist_wheel.get_tag(self)[2:]
16+
return ('py3', 'none') + super().get_tag()[2:]
17+
1518

1619
def get_package_data():
1720
plat_name_idx = None
@@ -32,35 +35,23 @@ def get_package_data():
3235
lib = 'bink.dll'
3336
else:
3437
raise RuntimeError('Unsupported platform: ' + plat_name)
35-
38+
3639
arch = "x86_64/"
3740
if "arm64" in plat_name or "aarch64" in plat_name:
3841
arch = "arm64/"
3942

4043
lib = arch + lib
41-
44+
4245
return ['native/' + lib]
4346

4447
# if it is not present, return ['native/*']
4548
return ['native/*']
4649

47-
description = open(
48-
path.join(path.abspath(path.dirname(__file__)), 'README.rst'),
49-
encoding='utf-8').read()
5050

5151
setup(
52-
name='bink',
53-
packages=find_packages(exclude=['tests']),
54-
version='0.3.1',
55-
description='Runtime for Ink, a scripting language for writing interactive narrative',
56-
long_description_content_type='text/x-rst',
57-
long_description=description,
58-
author='Rafael Garcia',
59-
license='Apache 2.0',
6052
package_data={'bink': get_package_data()},
6153
distclass = BinaryDistribution,
6254
cmdclass = {
6355
'bdist_wheel': BdistWheel,
6456
},
65-
zip_safe=False # native libraries are included in the package
6657
)

0 commit comments

Comments
 (0)