Skip to content

Commit

Permalink
Just stick to write_to for everything, and keep the setuptools_scm ve…
Browse files Browse the repository at this point in the history
…rsion below 8 to stay compatible with python 3.6. Once we don't care about 3.6 compatibility anymore, we can upgrade to setuptools_scm and use version_file instead of write_to
  • Loading branch information
Caspar van Leeuwen committed Sep 20, 2024
1 parent a79b263 commit 3f0d174
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ include = ["eessi*"]
[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "node-and-date"
write_to = "eessi/testsuite/_version.py"
19 changes: 1 addition & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
import setuptools
import pkg_resources


# write_to got replaced by version_file starting from setuptools_scm v8.
def get_setuptools_scm_version():
try:
scm_version = pkg_resources.get_distribution("setuptools_scm").version
return tuple(map(int, scm_version.split(".")[:2])) # Convert version string to tuple, e.g., (8, 0)
except pkg_resources.DistributionNotFound:
return (0, 0) # If setuptools_scm is not found, assume version 0.0


scm_version = get_setuptools_scm_version()

if scm_version >= (8, 0):
scm_arg_key = "version_file"
else:
scm_arg_key = "write_to"

setuptools.setup(
use_scm_version={scm_arg_key: "eessi/testsuite/_version.py"},
use_scm_version={'write_to': 'eessi/testsuite/_version.py'},
setup_requires=['setuptools_scm'],
)

0 comments on commit 3f0d174

Please sign in to comment.