Skip to content

Commit

Permalink
Fix setuptools-scm version for Python 3.6 (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
Takishima committed Jul 10, 2022
1 parent 78afc11 commit 8d9e465
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Update `docker/setup-qemu-action` GitHub action to v2
- Fixed CentOS 7 configuration issue
- Remove deprecated `setup_requires` field in setup.cfg
- Fixed installation issue with newer versions of `setuptool-scm`and Python¨ 3.6

## [v0.7.3] - 2022-04-27

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[build-system]
requires = ["setuptools>=42", "wheel", "pybind11>=2", "setuptools_scm[toml]>=3.4"]
requires = ["setuptools>=42", "wheel", "pybind11>=2",
"setuptools_scm[toml]<7;python_version<'3.7'",
"setuptools_scm[toml]>6;python_version>='3.7'"]
build-backend = "setuptools.build_meta"

# ==============================================================================
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ classifier =
zip_safe = False
packages = find:
python_requires = >= 3
setup_requires =
setuptools_scm[toml]
pybind11 >= 2
install_requires =
matplotlib >= 2.2.3
networkx >= 2
Expand Down
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

try:
import setuptools_scm # noqa: F401 # pylint: disable=unused-import

_HAS_SETUPTOOLS_SCM = True
except ImportError:
_HAS_SETUPTOOLS_SCM = False


# ==============================================================================
# Helper functions and classes

Expand Down Expand Up @@ -645,9 +653,12 @@ def run_setup(with_cext):
else:
kwargs['ext_modules'] = []

# NB: Workaround for people calling setup.py without a proper environment containing setuptools-scm
# This can typically be the case when calling the `gen_reqfile` or `clang_tidy`commands
if not _HAS_SETUPTOOLS_SCM:
kwargs['version'] = '0.0.0'

setup(
use_scm_version={'local_scheme': 'no-local-version'},
setup_requires=['setuptools_scm'],
cmdclass={
'build_ext': BuildExt,
'clang_tidy': ClangTidy,
Expand Down

0 comments on commit 8d9e465

Please sign in to comment.