diff --git a/pyproject.toml b/pyproject.toml index 558acf1..4988208 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,6 @@ requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" -[project] -dynamic = ["version"] - [tool.setuptools_scm] write_to = "afqinsight/_version.py" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6f9aca8 --- /dev/null +++ b/setup.py @@ -0,0 +1,32 @@ +import os.path as op +import string + +from setuptools import setup +from setuptools_scm import get_version + + +def local_version(version): + """Patch in a version that can be uploaded to test PyPI.""" + scm_version = get_version() + if "dev" in scm_version: + gh_in_int = [] + for char in version.node: + if char.isdigit(): + gh_in_int.append(str(char)) + else: + gh_in_int.append(str(string.ascii_letters.find(char))) + return "".join(gh_in_int) + else: + return "" + + +opts = { + "use_scm_version": { + "write_to": op.join("afqinsight", "_version.py"), + "local_scheme": local_version, + } +} + + +if __name__ == "__main__": + setup(**opts)