aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--setup.py39
2 files changed, 38 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 234875f..67d6c2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ src/build/
Pipfile.lock
*.egg-info/
htmlcov/
+dist/
!.flake8
!.gitlab-ci.yml
diff --git a/setup.py b/setup.py
index ac72e02..edf5ec3 100644
--- a/setup.py
+++ b/setup.py
@@ -2,13 +2,45 @@ import setuptools
from grobid_tei_xml import __version__
+
+class UploadCommand(setuptools.Command):
+ """Support setup.py upload."""
+
+ description = 'Build and publish the package.'
+ user_options = []
+
+ @staticmethod
+ def status(s):
+ """Prints things in bold."""
+ print('\033[1m{0}\033[0m'.format(s))
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ try:
+ self.status('Removing previous builds...')
+ rmtree(os.path.join(here, 'dist'))
+ except OSError:
+ pass
+
+ self.status('Building Source and Wheel (universal) distribution…')
+ os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
+
+ self.status('Uploading the package to PyPI via Twine…')
+ os.system('twine upload dist/*')
+
+ sys.exit()
+
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="grobid_tei_xml",
version=__version__,
- python_requires=">=3.7",
author="Bryan Newbold",
author_email="bnewbold@archive.org",
description="parser and transforms for GROBID-flavor TEI-XML",
@@ -21,7 +53,7 @@ with open("README.md", "r") as fh:
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
- python_requires=">=3.8",
+ python_requires=">=3.7",
install_requires=[],
extras_require={"dev": [
#"isort",
@@ -31,4 +63,7 @@ with open("README.md", "r") as fh:
"pytest-cov",
"yapf",
],},
+ cmdclass={
+ 'upload': UploadCommand,
+ },
)