Skip to content

Commit c46228f

Browse files
Use PEP 517 for packaging
1 parent cacc419 commit c46228f

File tree

5 files changed

+36
-38
lines changed

5 files changed

+36
-38
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var/
2626
.installed.cfg
2727
*.egg
2828
build-deb/
29+
_version.py
2930

3031
# PyInstaller
3132
# Usually these files are written by a python script from a template

canopen/__init__.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
from pkg_resources import get_distribution, DistributionNotFound
21
from .network import Network, NodeScanner
32
from .node import RemoteNode, LocalNode
43
from .sdo import SdoCommunicationError, SdoAbortedError
54
from .objectdictionary import import_od, ObjectDictionary, ObjectDictionaryError
65
from .profiles.p402 import BaseNode402
7-
8-
Node = RemoteNode
9-
106
try:
11-
__version__ = get_distribution(__name__).version
12-
except DistributionNotFound:
7+
from ._version import version as __version__
8+
except ImportError:
139
# package is not installed
1410
__version__ = "unknown"
1511

12+
Node = RemoteNode
13+
1614
__pypi_url__ = "https://pypi.org/project/canopen/"

pyproject.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to = "canopen/_version.py"

setup.cfg

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[metadata]
2+
name = canopen
3+
description = CANopen stack implementation
4+
long_description = file: README.rst
5+
project_urls =
6+
Documentation = http://canopen.readthedocs.io/en/stable/
7+
Source Code = https://github.com/christiansandberg/canopen
8+
author = Christian Sandberg
9+
author_email = [email protected]
10+
classifier =
11+
Development Status :: 5 - Production/Stable
12+
License :: OSI Approved :: MIT License
13+
Operating System :: OS Independent
14+
Programming Language :: Python :: 3 :: Only
15+
Intended Audience :: Developers
16+
Topic :: Scientific/Engineering
17+
18+
[options]
19+
packages = find:
20+
python_requires = >=3.6
21+
install_requires =
22+
python-can >= 3.0.0
23+
include_package_data = True

setup.py

+2-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup
22

3-
description = open("README.rst").read()
4-
# Change links to stable documentation
5-
description = description.replace("/latest/", "/stable/")
6-
7-
setup(
8-
name="canopen",
9-
url="https://github.com/christiansandberg/canopen",
10-
use_scm_version=True,
11-
packages=find_packages(),
12-
author="Christian Sandberg",
13-
author_email="[email protected]",
14-
description="CANopen stack implementation",
15-
keywords="CAN CANopen",
16-
long_description=description,
17-
license="MIT",
18-
platforms=["any"],
19-
classifiers=[
20-
"Development Status :: 5 - Production/Stable",
21-
"License :: OSI Approved :: MIT License",
22-
"Operating System :: OS Independent",
23-
"Programming Language :: Python :: 3",
24-
"Intended Audience :: Developers",
25-
"Topic :: Scientific/Engineering"
26-
],
27-
install_requires=["python-can>=3.0.0"],
28-
extras_require={
29-
"db_export": ["canmatrix"]
30-
},
31-
setup_requires=["setuptools_scm"],
32-
include_package_data=True
33-
)
3+
setup()

0 commit comments

Comments
 (0)