Skip to content

Commit

Permalink
chore: move to setuptools_scm (scikit-build#422)
Browse files Browse the repository at this point in the history
* chore: move to setuptools_scm

* remove some missed versioneer related code
  • Loading branch information
mayeut authored Dec 2, 2023
1 parent 1f25241 commit 8d1f63d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 2,379 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/cmake/_version.py export-subst
.git_archival.txt export-subst
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ docs/_build
# IDE junk
.idea/*
*.swp

# Output from cibuildwheel
wheelhouse/

# Version
_version.py
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include LICENSE_BSD_3
recursive-exclude _skbuild *
recursive-exclude CMake-src *

include versioneer.py
include src/cmake/_version.py
include src/cmake/_version.pyi
include src/cmake/__init__.pyi
include src/cmake/py.typed
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
requires = [
"scikit-build>=0.12",
"setuptools>=42",
"setuptools-scm[toml]",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/cmake/_version.py"

[tool.cibuildwheel]
build = "cp39-*"
before-all = [
Expand Down Expand Up @@ -83,7 +87,7 @@ unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]
exclude = ["versioneer.py", "src/cmake/_version.py"]
exclude = ["src/cmake/_version.py"]
flake8-unused-arguments.ignore-variadic-names = true

[tool.ruff.per-file-ignores]
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
[tool:pytest]
testpaths = tests
addopts = -v --cov --cov-report xml

[versioneer]
VCS = git
versionfile_source = src/cmake/_version.py
versionfile_build = cmake/_version.py
style = pep440-post
tag_prefix = ''
11 changes: 0 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@

from skbuild import setup

# Add current folder to path
# This is required to import versioneer in an isolated pip build
# Prepending allows not to break on a non-isolated build when versioneer
# is already installed (c.f. https://github.com/scikit-build/cmake-python-distributions/issues/171)
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

import versioneer # noqa: E402

with open('README.rst', 'r') as fp:
readme = fp.read()

Expand All @@ -33,9 +25,6 @@ def parse_requirements(filename):
setup(
name='cmake',

version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),

author='Jean-Christophe Fillion-Robin',
author_email='[email protected]',

Expand Down
10 changes: 7 additions & 3 deletions src/cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import subprocess
import sys

from ._version import get_versions
from ._version import version as __version__

__all__ = ["__version__", "CMAKE_DATA", "CMAKE_BIN_DIR", "CMAKE_DOC_DIR", "CMAKE_SHARE_DIR", "cmake", "cpack", "ctest"]


def __dir__():
return __all__

__version__ = get_versions()['version']
del get_versions

CMAKE_DATA = os.path.join(os.path.dirname(__file__), 'data')

Expand Down
Loading

0 comments on commit 8d1f63d

Please sign in to comment.