Migrate to pyproject.toml with setuptools_scm
Replace custom version management with setuptools_scm to eliminate source file modifications during installation. Version is now derived from git tags at build time without writing to tracked files. Changes: - Add pyproject.toml with full project metadata - Simplify setup.py to minimal backwards-compatible shim - Remove curateipsum/_version.py from version control - Add _version.py to .gitignore (auto-generated at build time) - Use PEP 440 compliant version strings Fixes #18
This commit is contained in:
51
setup.py
51
setup.py
@@ -1,48 +1,5 @@
|
||||
import setuptools
|
||||
import subprocess
|
||||
# Minimal setup.py for backwards compatibility
|
||||
# All configuration is in pyproject.toml
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
def get_version_from_vcs():
|
||||
ret_code, git_ver = subprocess.getstatusoutput("git describe")
|
||||
if ret_code != 0:
|
||||
from curateipsum._version import version
|
||||
return version
|
||||
|
||||
with open("curateipsum/_version.py", "w") as fd:
|
||||
fd.write("version = \"%s\"\n" % git_ver)
|
||||
return git_ver
|
||||
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="cura-te-ipsum",
|
||||
version=get_version_from_vcs(),
|
||||
author="Maks Snegov",
|
||||
author_email="snegov@spqr.link",
|
||||
url="https://github.com/snegov/cura-te-ipsum",
|
||||
description="Backup utility",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
project_urls={
|
||||
"Bug Tracker": "https://github.com/snegov/cura-te-ipsum/issues",
|
||||
"GitHub": "https://github.com/snegov/cura-te-ipsum",
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: System Administrators",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: System :: Archiving :: Backup",
|
||||
],
|
||||
packages=setuptools.find_packages(include=["curateipsum"]),
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"cura-te-ipsum = curateipsum.cli:main",
|
||||
],
|
||||
},
|
||||
python_requires=">=3.6",
|
||||
)
|
||||
setup()
|
||||
|
||||
Reference in New Issue
Block a user