From d834cf74e37ef659d9eb090b54102f50ba4168c2 Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Thu, 22 Sep 2022 09:31:30 -0600 Subject: [PATCH 1/3] Fix "possible nested set" futurewarning --- adstex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adstex.py b/adstex.py index 859797c..fe9e7a9 100644 --- a/adstex.py +++ b/adstex.py @@ -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})") From e3be59d10851d44967b225730e9dc0e826a95ff4 Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Thu, 22 Sep 2022 09:37:57 -0600 Subject: [PATCH 2/3] switch to packaging.version.parse --- adstex.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adstex.py b/adstex.py index fe9e7a9..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: @@ -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 ) From 6af49153e03ae16c9055125b26e9723f66e58bac Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Thu, 22 Sep 2022 09:39:30 -0600 Subject: [PATCH 3/3] add packaging --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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"]},