diff --git a/adstex.py b/adstex.py index 859797c..2d70f16 100644 --- a/adstex.py +++ b/adstex.py @@ -16,11 +16,11 @@ from builtins import input from collections import defaultdict from datetime import date -from distutils.version import StrictVersion from shutil import copyfile import ads import bibtexparser +import packaging.version import requests try: @@ -28,7 +28,7 @@ except ImportError: from urllib import unquote -__version__ = "0.3.11" +__version__ = "0.3.12" _this_year = date.today().year % 100 _this_cent = date.today().year // 100 @@ -36,7 +36,7 @@ _re_comment = re.compile(r"(?](?:(?!\n{2,})\s)*)*{((?:(?!\n{2,})[^{}])+)}", + r"\\(?:bibentry|[cC]ite[a-zA]{0,7})\*?(?:(?!\n{2,})\s)*(?:(?](?:(?!\n{2,})\s)*)*{((?:(?!\n{2,})[^{}])+)}", re.S, ) _re_fayear = re.compile(r"([A-Za-z-]+)(?:(?=[\W_])[^\s\d,]+)?((?:\d{2})?\d{2})") @@ -469,7 +469,7 @@ def main(): # check version try: - latest_version = StrictVersion( + latest_version = packaging.version.parse( requests.get( "https://pypi.python.org/pypi/adstex/json", timeout=0.1, ).json()["info"]["version"] @@ -477,7 +477,7 @@ def main(): except (requests.RequestException, KeyError, ValueError): pass else: - if latest_version > StrictVersion(__version__): + if latest_version > packaging.version.parse(__version__): msg = "A newer version of adstex (v{}) is now available!\n".format( latest_version ) diff --git a/setup.py b/setup.py index a48dd48..380cd62 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,10 @@ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", - "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", "Topic :: Scientific/Engineering :: Astronomy", ], keywords="bibtex ads", @@ -53,6 +56,7 @@ "ads>=0.12.3", "bibtexparser>=0.6.2", "requests>=2.0", + "packaging>=17.0", "future>=0.12.0 ; python_version < '3.0'", ], entry_points={"console_scripts": ["adstex=adstex:main"]},