aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-06-30 18:55:39 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2026-06-30 18:57:58 +0200
commitd84a1b2f9e8ccc4b19cfb90b5a11d4be2ef34479 (patch)
tree9ba76b58bc9a6ff9027979467b822a2b30805043
parent7d043001b956fb80116cf8eedcca1d5aaf2edbd4 (diff)
downloadpyouroboros-d84a1b2f9e8ccc4b19cfb90b5a11d4be2ef34479.tar.gz
pyouroboros-d84a1b2f9e8ccc4b19cfb90b5a11d4be2ef34479.zip
build: Add Pylint config
Add a PyLint section to pyproject.toml.
-rw-r--r--LICENSE14
-rw-r--r--pyproject.toml14
-rwxr-xr-xsetup.py36
3 files changed, 44 insertions, 20 deletions
diff --git a/LICENSE b/LICENSE
index a618b2b..c321e52 100644
--- a/LICENSE
+++ b/LICENSE
@@ -44,7 +44,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
-
+
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -102,7 +102,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-
+
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -153,7 +153,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-
+
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@@ -215,7 +215,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-
+
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -256,7 +256,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
-
+
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -308,7 +308,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-
+
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -341,4 +341,4 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS \ No newline at end of file
+ END OF TERMS AND CONDITIONS
diff --git a/pyproject.toml b/pyproject.toml
index 247142c..9a9f8b6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -21,3 +21,17 @@ Homepage = "https://ouroboros.rocks"
packages = ["ouroboros"]
[tool.setuptools_scm]
+
+[tool.pylint.main]
+extension-pkg-allow-list = ["_ouroboros_dev_cffi", "_ouroboros_irm_cffi"]
+ignored-modules = ["setuptools_scm", "_ouroboros_dev_cffi", "_ouroboros_irm_cffi"]
+
+[tool.pylint.format]
+max-line-length = 100
+
+[tool.pylint.design]
+max-args = 10
+max-positional-arguments = 10
+max-attributes = 10
+max-public-methods = 30
+
diff --git a/setup.py b/setup.py
index cdf1f55..6d8d160 100755
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,25 @@
+"""Build script for the PyOuroboros CFFI extensions.
+
+Resolves the ouroboros library version via ``pkg-config`` and the
+pyouroboros source version via ``setuptools_scm``, verifies that the
+``major.minor`` halves match, and delegates the actual build to the
+CFFI builders under ``ffi/``.
+"""
+
+from __future__ import annotations
+
import subprocess
import sys
from setuptools import setup
+from setuptools_scm import get_version
-def _get_ouroboros_version():
+def _get_ouroboros_version() -> str:
try:
out = subprocess.check_output(
['pkg-config', '--modversion', 'ouroboros-dev'],
- stderr=subprocess.DEVNULL
+ stderr=subprocess.DEVNULL,
)
return out.decode().strip()
except (subprocess.CalledProcessError, FileNotFoundError):
@@ -16,25 +27,24 @@ def _get_ouroboros_version():
"Is Ouroboros installed?")
-def _check_build_version_compat():
+def _check_build_version_compat() -> None:
try:
- from setuptools_scm import get_version
- pyouro_ver = get_version(root='.', relative_to=__file__)
- except Exception:
+ pyo7s_ver = get_version(root='.', relative_to=__file__)
+ except (LookupError, OSError):
return # no SCM info, skip check
- ouro_ver = _get_ouroboros_version()
+ o7s_ver = _get_ouroboros_version()
# setuptools_scm: '0.23.1.dev3+g<hash>' or '0.23.0'
# pkg-config: '0.23.0'
# Compare major.minor only.
- ouro_parts = ouro_ver.split('.')
- pyouro_parts = pyouro_ver.split('.')
+ o7s_parts = o7s_ver.split('.')
+ pyo7s_parts = pyo7s_ver.split('.')
- if ouro_parts[0] != pyouro_parts[0] or ouro_parts[1] != pyouro_parts[1]:
+ if o7s_parts[0] != pyo7s_parts[0] or o7s_parts[1] != pyo7s_parts[1]:
sys.exit(
- f"ERROR: Version mismatch: ouroboros {ouro_ver} "
- f"vs pyouroboros {pyouro_ver} "
+ f"ERROR: Version mismatch: ouroboros {o7s_ver} "
+ f"vs pyouroboros {pyo7s_ver} "
f"(major.minor must match)"
)
@@ -44,6 +54,6 @@ _check_build_version_compat()
setup(
cffi_modules=[
"ffi/pyouroboros_build_dev.py:ffibuilder",
- "ffi/pyouroboros_build_irm.py:ffibuilder"
+ "ffi/pyouroboros_build_irm.py:ffibuilder",
],
)