summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2020-03-20 22:37:01 +0100
committerFederico Caselli <cfederico87@gmail.com>2022-05-07 10:52:34 +0000
commite12582952f7f7a6d4f4524b733b4bba0e357a733 (patch)
treeb5e9481469c2691bf61e6fcb73ab071c2a380d84
parent717202241e3ab30f97cea8f4ec5bbacfd4b180a8 (diff)
downloadalembic-e12582952f7f7a6d4f4524b733b4bba0e357a733.tar.gz
Use pep517 to install alembic.
Change-Id: If7b9e9fca39e6a6abe45900ff396345c778bbaa9
-rw-r--r--MANIFEST.in2
-rw-r--r--pyproject.toml7
-rw-r--r--setup.cfg7
-rw-r--r--setup.py37
4 files changed, 12 insertions, 41 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index cb795e0..dc8ec40 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -7,6 +7,4 @@ recursive-include tools *.py
include README* LICENSE CHANGES* tox.ini
prune docs/build/output
-exclude pyproject.toml
-
diff --git a/pyproject.toml b/pyproject.toml
index e766501..cd87f7c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,10 @@
+[build-system]
+build-backend = "setuptools.build_meta"
+requires = [
+ "setuptools>=47",
+ "wheel>=0.34",
+]
+
[tool.black]
line-length = 79
diff --git a/setup.cfg b/setup.cfg
index 5a5917b..9e0c131 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,12 +1,7 @@
[metadata]
name = alembic
-
-# version comes from setup.py; setuptools
-# can't read the "attr:" here without importing
-# until version 47.0.0 which is too recent
-
-
+version = attr: alembic.__version__
description = A database migration tool for SQLAlchemy.
long_description = file: README.rst
long_description_content_type = text/x-rst
diff --git a/setup.py b/setup.py
index 1ca5fd7..1a4f69a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,36 +1,7 @@
-import os
-import re
-import sys
-
+from setuptools import __version__
from setuptools import setup
-from setuptools.command.test import test as TestCommand
-
-
-v = open(os.path.join(os.path.dirname(__file__), "alembic", "__init__.py"))
-VERSION = (
- re.compile(r""".*__version__ = ["'](.*?)["']""", re.S)
- .match(v.read())
- .group(1)
-)
-v.close()
-
-
-class UseTox(TestCommand):
- RED = 31
- RESET_SEQ = "\033[0m"
- BOLD_SEQ = "\033[1m"
- COLOR_SEQ = "\033[1;%dm"
-
- def run_tests(self):
- sys.stderr.write(
- "%s%spython setup.py test is deprecated by pypa. Please invoke "
- "'tox' with no arguments for a basic test run.\n%s"
- % (self.COLOR_SEQ % self.RED, self.BOLD_SEQ, self.RESET_SEQ)
- )
- sys.exit(1)
+if not int(__version__.partition(".")[0]) >= 47:
+ raise RuntimeError(f"Setuptools >= 47 required. Found {__version__}")
-setup(
- version=VERSION,
- cmdclass={"test": UseTox},
-)
+setup()