diff --git a/.gitignore b/.gitignore index c519b0d..f939994 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ *.swp build dist -lunardate.egg-info/PKG-INFO +lunardate.egg-info diff --git a/lunardate.egg-info/SOURCES.txt b/lunardate.egg-info/SOURCES.txt deleted file mode 100644 index b37ab12..0000000 --- a/lunardate.egg-info/SOURCES.txt +++ /dev/null @@ -1,8 +0,0 @@ -LICENSE.txt -README.md -lunardate.py -setup.py -lunardate.egg-info/PKG-INFO -lunardate.egg-info/SOURCES.txt -lunardate.egg-info/dependency_links.txt -lunardate.egg-info/top_level.txt \ No newline at end of file diff --git a/lunardate.egg-info/dependency_links.txt b/lunardate.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/lunardate.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lunardate.egg-info/top_level.txt b/lunardate.egg-info/top_level.txt deleted file mode 100644 index 4f91082..0000000 --- a/lunardate.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -lunardate diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..07e10f1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools >= 77.0.3"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index d7f4ee8..31858de 100755 --- a/setup.py +++ b/setup.py @@ -1,14 +1,26 @@ #!/usr/bin/env python from setuptools import setup, find_packages +import os +import re -import lunardate +def get_version(): + with open( + os.path.join(os.path.dirname(__file__), "lunardate.py"), + "r", + encoding="utf-8", + ) as f: + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") setup(name='lunardate', - version=lunardate.__version__, + version=get_version(), py_modules = ['lunardate'], description = 'A Chinese Calendar Library in Pure Python', - long_description = lunardate.__doc__, + long_description = open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", author = 'LI Daobing', author_email = 'lidaobing@gmail.com', url = 'https://github.com/lidaobing/python-lunardate',