Skip to content

Commit 37e40e6

Browse files
authored
Merge pull request #159 from iMichka/build
Build: migrate to pyproject.toml
2 parents 3a5534b + 14f1a64 commit 37e40e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+88
-123
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ jobs:
88
fail-fast: false
99
matrix:
1010
include:
11-
- os: ubuntu-20.04
12-
compiler: gcc
13-
version: "9"
14-
python-version: "3.6"
15-
castxml: "castxml"
16-
castxml-epic: 0
17-
cppstd: "-std=c++98"
18-
1911
- os: ubuntu-20.04
2012
compiler: gcc
2113
version: "9"
@@ -88,8 +80,9 @@ jobs:
8880
python-version: ${{ matrix.python-version }}
8981
- name: Display Python version
9082
run: python -c "import sys; print(sys.version)"
91-
- name: Install pycodestyle
92-
run: pip install pycodestyle
83+
- name: Install Python lib and test libs
84+
run: |
85+
pip install '.[test]'
9386
- name: Run pycodestyle
9487
run: pycodestyle . --exclude=docs
9588
- name: Setup castxml for Linux
@@ -103,9 +96,6 @@ jobs:
10396
- name: Setup castxml config
10497
if: matrix.compiler == 'gcc' && matrix.version == '9'
10598
run: mv unittests/configs/gcc9.cfg unittests/xml_generator.cfg;
106-
- name: Install Python lib and test libs
107-
run: |
108-
pip install .[test]
10999
- name: Run tests
110100
run: |
111101
export PATH=~/castxml/bin:$PATH

docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
import os
1717
import sphinx_rtd_theme
1818
import subprocess
19+
import importlib.metadata
1920

2021
# If extensions (or modules to document with autodoc) are in another directory,
2122
# add these directories to sys.path here. If the directory is relative to the
2223
# documentation root, use os.path.abspath to make it absolute, like shown here.
23-
sys.path.insert(0, os.path.abspath('.') + "/../")
24+
sys.path.insert(0, os.path.abspath('.') + "/../src")
2425

2526
from release_utils import utils # nopep8
2627

@@ -58,9 +59,9 @@
5859
# built documents.
5960
#
6061
# The short X.Y version.
61-
version = utils.find_version("../pygccxml/__init__.py")
62+
version = importlib.metadata.version("pygccxml")
6263
# The full version, including alpha/beta/rc tags.
63-
release = utils.find_version("../pygccxml/__init__.py")
64+
release = version
6465

6566
# The language for content autogenerated by Sphinx. Refer to documentation
6667
# for a list of supported languages.

docs/releasing.rst

Lines changed: 2 additions & 4 deletions

pyproject.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
4+
[project]
5+
name = "pygccxml"
6+
description = "Python package for easy C++ declarations navigation."
7+
authors = [
8+
{name = "Michka Popoff", email = "[email protected]"},
9+
{name = "Insight Software Consortium", email = "[email protected]"},
10+
{name = "Roman Yakovenko", email = "[email protected]"},
11+
]
12+
license = {file = "LICENSE.rst"}
13+
keywords = [
14+
"C++",
15+
"XML",
16+
"declaration parser",
17+
"CastXML",
18+
"gccxml",
19+
]
20+
version = "2.3.0"
21+
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Environment :: Console",
25+
"Intended Audience :: Developers",
26+
"Operating System :: MacOS :: MacOS X",
27+
"Operating System :: Microsoft :: Windows",
28+
"Operating System :: POSIX",
29+
"Programming Language :: Python :: 3.7",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Python :: 3.11",
34+
"Programming Language :: Python :: Implementation :: CPython",
35+
"Programming Language :: Python :: Implementation :: PyPy",
36+
"Topic :: Software Development",
37+
]
38+
39+
dependencies = [
40+
'importlib-metadata >= 4.6; python_version < "3.10"', # Not required for 3.8+, but fixes a stdlib bug
41+
]
42+
43+
[project.urls]
44+
Homepage = "https://github.com/CastXML/pygccxml"
45+
Documentation = "https://readthedocs.org/projects/pygccxml/"
46+
Repository = "https://github.com/CastXML/pygccxml"
47+
Changelog = "https://github.com/CastXML/pygccxml/CHANGELOG.md"
48+
49+
[options]
50+
python_requires = ">=3.7"
51+
52+
[project.optional-dependencies]
53+
test = [
54+
"coverage",
55+
"coveralls",
56+
"pycodestyle",
57+
]
58+
docs = [
59+
"sphinx",
60+
"sphinx_rtd_theme",
61+
]
62+
examples = [
63+
"notebook",
64+
]

release_utils/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

release_utils/utils.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

pygccxml/__init__.py renamed to src/pygccxml/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
2727
"""
2828

29+
import sys
2930
import warnings
3031

3132
from . import declarations
@@ -41,4 +42,16 @@
4142
# TODO:
4243
# 1. Add "explicit" property for constructors
4344

44-
__version__ = '2.3.0'
45+
version = sys.version_info
46+
47+
if version < (3, 8):
48+
import importlib_metadata as metadata
49+
elif version < (3, 9, 10) or (3, 10, 0) <= version < (3, 10, 2):
50+
try:
51+
import importlib_metadata as metadata
52+
except ModuleNotFoundError:
53+
from importlib import metadata
54+
else:
55+
from importlib import metadata
56+
57+
__version__ = metadata.version("pygccxml")

0 commit comments

Comments
 (0)