auto-semver/setup.py

76 lines
2.3 KiB
Python
Raw Normal View History

2023-06-30 23:40:58 +02:00
import re
from pathlib import Path, StrPath
2018-05-23 21:09:14 +02:00
2023-06-30 23:40:58 +02:00
# To use a consistent encoding
from codecs import open
2018-05-23 21:09:14 +02:00
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
2023-06-30 23:40:58 +02:00
here = Path(__file__).resolve().parent
2018-05-23 21:09:14 +02:00
# Get the long description from the README file
2023-06-30 23:40:58 +02:00
with open(Path(here, "README.md"), encoding="utf-8") as f:
2018-05-23 21:09:14 +02:00
long_description = f.read()
2023-06-30 23:40:58 +02:00
def find_version(*file_path: StrPath) -> str:
"""
Searches for the semantic version within the given path
:param file_path: Path to the file to search
:return: Semantic version as string
"""
version_file: str = open(Path(here, *file_path), "r").read()
version_match = re.search(r"^version = ['\"]([^'\"]*)['\"]", version_file, re.M)
if not version_match:
raise RuntimeError("Unable to find version string.")
2018-05-23 21:09:14 +02:00
2023-06-30 23:40:58 +02:00
return version_match.group(1)
2018-05-23 21:09:14 +02:00
2023-06-30 23:40:58 +02:00
setup(
name="semver",
version=find_version("semver", "__init__.py"),
description="Automatic Semantic Versioner",
2018-05-23 21:09:14 +02:00
long_description=long_description,
2023-06-30 23:40:58 +02:00
url="https://github.com/RightBrain-Networks/auto-semver",
2018-05-23 21:09:14 +02:00
# Author details
2023-06-30 23:40:58 +02:00
author="RightBrain Networks",
author_email="cloud@rightbrainnetworks.com",
2018-05-23 21:09:14 +02:00
# Choose your license
2023-06-30 23:40:58 +02:00
license="Apache2.0",
# ======== #
# Metadata #
# ======== #
2018-05-23 21:09:14 +02:00
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
2023-06-30 23:40:58 +02:00
"License :: OSI Approved :: Apache Software License",
# Development Status
"Development Status :: 3 - Alpha",
# Audience
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: Software Development :: Build Tools",
# Supported Python Versions
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
2018-05-23 21:09:14 +02:00
],
2023-06-30 23:40:58 +02:00
keywords=["Semantic", "Version", "Git", "Auto-Versioning"],
# ======= #
# Package #
# ======= #
packages=find_packages(exclude=["contrib", "docs", "tests"]),
install_requires=["argparse>=1.4.0"],
package_data={},
2018-05-23 21:09:14 +02:00
entry_points={
2023-06-30 23:40:58 +02:00
"console_scripts": [
"semver = semver:main",
"semver_get_version = semver.get_version:main",
2018-05-23 21:09:14 +02:00
],
},
)