Skip to content

Commit

Permalink
Split off the setuptools_scm versioning into a different pr #185 . Th…
Browse files Browse the repository at this point in the history
…e current PR now depends on this, as it relies on the eessi/testsuite/__init__.py file to provide a version
  • Loading branch information
Caspar van Leeuwen committed Sep 21, 2024
1 parent 446e4c8 commit 38ffee1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 43 deletions.
16 changes: 0 additions & 16 deletions eessi/testsuite/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
# If this is an installed package, setuptools_scm should have written the file _version.py in the current directory
try:
from ._version import __version__
except ImportError:
# Fallback for when the package is not installed, but git cloned. Note that this requires setuptools_scm to be
# available as a runtime dependency
try:
from setuptools_scm import get_version
# Using a relative path for relative_to doesn't work, because it will be relative to the current working
# directory (which could be anywhere)
# __file__ is the location of this init file (a full path), and this gives us a predictable path to the root
# (namely: two levels up)
# Note that if we ever move this __init__ file relative to the root of the git tree, we'll need to adjust this
__version__ = get_version(root='../..', relative_to=__file__)
except ImportError:
__version__ = "0.0.0" # fallback version if setuptools_scm is not available
10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
[build-system]
# Setuptools_scm<7 to be compatible with Python 3.6
requires = ["setuptools>=42", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "eessi-testsuite"
version = "0.3.2"
description = "Test suite for the EESSI software stack"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python"
]
requires-python = ">=3.6"
dynamic = ["version"]

[project.urls]
"Homepage" = "https://eessi.io/docs/test-suite"
"Bug Tracker" = "https://github.com/EESSI/test-suite/issues"

[tool.setuptools.packages.find]
include = ["eessi*"]

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "node-and-date"
write_to = "eessi/testsuite/_version.py"
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[metadata]
name = eessi-testsuite
version = 0.3.2
description = Test suite for the EESSI software stack
long_description = file: README.md
long_description_content_type = text/markdown
Expand All @@ -20,10 +21,6 @@ namespace_packages = eessi
[options.packages.find]
include = eessi*

[setuptools_scm]
version_scheme = guess-next-dev
local_scheme = node-and-date

[flake8]
max-line-length = 120
# ignore star imports (F403, F405)
Expand Down
16 changes: 1 addition & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
import setuptools
import sys

python_version = sys.version_info
if python_version < (3, 8):
scm_require = ['packaging<=21.3', 'setuptools_scm<7']
scm_arg_key = "write_to"
else:
scm_require = ['setuptools_scm>=8']
scm_arg_key = "version_file"


setuptools.setup(
use_scm_version={scm_arg_key: 'eessi/testsuite/_version.py'},
setup_requires=scm_require,
)
setuptools.setup()

0 comments on commit 38ffee1

Please sign in to comment.