forked from EESSI/test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Just stick to write_to for everything, and keep the setuptools_scm ve…
…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
Showing
2 changed files
with
2 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
) |