From 4ffe8ed0b9b2cbd79aad8902a5546b8f442f52fc Mon Sep 17 00:00:00 2001 From: Jelmer van der Linde Date: Mon, 30 Oct 2023 15:53:42 +0000 Subject: [PATCH] Fill in version and long description from files Messed up the 0.1.0 release. Next time we'll do better. --- setup.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 51cff8f..59b1a4d 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +import re +import os from setuptools import setup console_scripts = """ @@ -5,12 +7,21 @@ sacremoses=sacremoses.cli:cli """ +with open(os.path.join(os.path.dirname(__file__), 'sacremoses/__init__.py'), 'r') as fh: + match = re.search(r'''^__version__\s*=\s*(["'])(.+?)\1\s*$''', fh.read(), flags=re.MULTILINE) + assert match, "count not find __version__ in sacremoses/__init__.py" + version = match.group(2) + +with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as fh: + long_description = fh.read() + setup( name = 'sacremoses', packages = ['sacremoses'], - version = '0.1.0', + version = version, description = 'SacreMoses', - long_description = 'MosesTokenizer in Python', + long_description = long_description, + long_description_content_type = 'text/markdown', author = '', package_data={'sacremoses': ['data/perluniprops/*.txt', 'data/nonbreaking_prefixes/nonbreaking_prefix.*']}, url = 'https://github.com/hplt-project/sacremoses', @@ -23,4 +34,4 @@ install_requires = ['regex', 'click', 'joblib', 'tqdm'], entry_points=console_scripts, python_requires='>=3.8', -) +) \ No newline at end of file