From 0afada1a0381ef20572ea79fa6a9b5ba6a5f7178 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 25 Jul 2024 20:51:38 -0400 Subject: [PATCH 1/2] Remove 3.12 deprecation warning... regarding the use of pkgdata --- mathics_scanner/characters.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mathics_scanner/characters.py b/mathics_scanner/characters.py index 8996ba0..39015a7 100644 --- a/mathics_scanner/characters.py +++ b/mathics_scanner/characters.py @@ -6,19 +6,25 @@ and Unicode/ASCII. """ -import re import os -import pkg_resources +import os.path as osp +import re try: import ujson except ImportError: import json as ujson -ROOT_DIR = pkg_resources.resource_filename("mathics_scanner", "") + +def get_srcdir() -> str: + filename = osp.normcase(osp.dirname(osp.abspath(__file__))) + return osp.realpath(filename) + + +ROOT_DIR = get_srcdir() # Load the conversion tables from disk -characters_path = os.path.join(ROOT_DIR, "data", "characters.json") +characters_path = osp.join(ROOT_DIR, "data", "characters.json") if os.path.exists(characters_path): with open(characters_path, "r") as f: _data = ujson.load(f) From 24e049bb6c6249e60bdcef198fd1b33786a1443d Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 25 Jul 2024 21:39:34 -0400 Subject: [PATCH 2/2] Set characer encoding on doctest --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8d58a59..294d9d6 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ inputrc-unicode: #: Run Mathics core checks check-mathics:: - $(PYTHON) -m mathics.docpipeline $o + MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m mathics.docpipeline $o #: Remove ChangeLog rmChangeLog: