Skip to content

Commit fc1da33

Browse files
authored
Merge pull request #24 from Erotemic/dev/2.1.3
Start branch for dev/2.1.3
2 parents eec646c + 7a84a1e commit fc1da33

4 files changed

Lines changed: 112 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
We [keep a Changelog](https://keepachangelog.com/en/1.0.0/) using [semantic versioning](https://semver.org/spec/v2.0.0.html).
44

55

6-
## [Version 2.1.2] - Unreleased
6+
## Version 2.1.3 - Unreleased
7+
8+
9+
## [Version 2.1.2] - Released 2025-08-23
710

811
### Changed
912

pyhesaff/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '2.1.2'
1+
__version__ = '2.1.3'
22
__author__ = 'Jon Crall'
33
__author_email__ = 'erotemic@gmail.com'
44
__url__ = 'https://github.com/Erotemic/pyhesaff'

pyhesaff/_pyhesaff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def detect_feats_in_image(img, **kwargs):
580580
>>> img = imread(img_fpath)
581581
>>> (kpts, vecs) = detect_feats_in_image(img)
582582
>>> # xdoctest: +REQUIRES(--show)
583-
>>> import plottool as pt
583+
>>> import plottool_ibeis as pt
584584
>>> pt.interact_keypoints.ishow_keypoints(img, kpts, vecs, ori=True,
585585
>>> ell_alpha=.4, color='distinct')
586586
>>> pt.set_figtitle('Detect Kpts in Image')
@@ -710,7 +710,7 @@ def extract_vecs(img_fpath, kpts, **kwargs):
710710
>>> print('errors.sum() = %r' % (errors.sum(),))
711711
>>> # VISUALIZTION
712712
>>> # xdoctest: +REQUIRES(--show)
713-
>>> import plottool as pt
713+
>>> import plottool_ibeis as pt
714714
>>> # Extract the underlying grayscale patches
715715
>>> img = imread(img_fpath)
716716
>>> patch_list = extract_patches(img, kpts)
@@ -765,7 +765,7 @@ def extract_patches(img_or_fpath, kpts, **kwargs):
765765
>>> py_patch_list_ = np.array(vt.get_warped_patches(img_or_fpath, kpts, patch_size=41)[0])
766766
>>> py_patch_list = np.array(vt.convert_image_list_colorspace(py_patch_list_, 'gray'))
767767
>>> # xdoctest: +REQUIRES(--show)
768-
>>> import plottool as pt
768+
>>> import plottool_ibeis as pt
769769
>>> ax = pt.draw_patches_and_sifts(cpp_patch_list, None, pnum=(1, 2, 1))
770770
>>> ax.set_title('C++ extracted')
771771
>>> ax = pt.draw_patches_and_sifts(py_patch_list, None, pnum=(1, 2, 2))
@@ -837,7 +837,7 @@ def extract_desc_from_patches(patch_list):
837837
>>> errors = (vecs_list.astype(float) - vecs_array.astype(float)).sum(axis=1)
838838
>>> print('Errors: %r' % (errors,))
839839
>>> # xdoctest: +REQUIRES(--show)
840-
>>> import plottool as pt
840+
>>> import plottool_ibeis as pt
841841
>>> ax = pt.draw_patches_and_sifts(patch_list, vecs_array, pnum=(1, 2, 1))
842842
>>> ax.set_title('patch extracted')
843843
>>> ax = pt.draw_patches_and_sifts(patch_list, vecs_list, pnum=(1, 2, 2))
@@ -907,7 +907,7 @@ def test_rot_invar():
907907
"""
908908
import cv2
909909
import vtool as vt
910-
import plottool as pt
910+
import plottool_ibeis as pt
911911
TAU = 2 * np.pi
912912
fnum = pt.next_fnum()
913913
NUM_PTS = 5 # 9

pyhesaff/ctypes_interface.py

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ def get_plat_specifier():
2020
"""
2121
Standard platform specifier used by distutils
2222
"""
23-
import distutils
23+
try:
24+
import distutils
25+
except ImportError:
26+
return get_plat_specifier2()
2427
try:
2528
plat_name = distutils.util.get_platform()
2629
except AttributeError:
@@ -31,8 +34,105 @@ def get_plat_specifier():
3134
return plat_specifier
3235

3336

37+
def _py_ver_str():
38+
"""Return 'MAJOR.MINOR' (e.g., '3.12')."""
39+
return f"{sys.version_info.major}.{sys.version_info.minor}"
40+
41+
42+
def _norm_arch():
43+
"""Normalize common architecture names to the ones your code expects."""
44+
import platform
45+
m = (platform.machine() or "").lower()
46+
if m in {"x86_64", "amd64"}:
47+
return "x86_64"
48+
if m in {"i386", "i686", "x86"}:
49+
return "i686"
50+
if m in {"aarch64", "arm64"}:
51+
return "arm64"
52+
return m or ("x86_64" if sys.maxsize > 2**32 else "i686")
53+
54+
55+
def get_plat_specifier2():
56+
"""
57+
Standard platform specifier (distutils-free).
58+
Mirrors your existing format: '.<plat>-<pyver>' + optional '-pydebug'.
59+
"""
60+
import sysconfig
61+
plat_name = sysconfig.get_platform() or sys.platform
62+
plat_specifier = f".{plat_name}-{_py_ver_str()}"
63+
if hasattr(sys, "gettotalrefcount"): # CPython debug builds
64+
plat_specifier += "-pydebug"
65+
return plat_specifier
66+
67+
68+
def get_candidate_plat_specifiers2():
69+
"""
70+
Produce a list of plausible platform suffixes without using distutils.
71+
Keeps your legacy candidates and adds a few modern ones (manylinux, macOS).
72+
"""
73+
import sysconfig
74+
arch = _norm_arch()
75+
py_ver = _py_ver_str()
76+
plat_name = sysconfig.get_platform() or sys.platform
77+
78+
plat_name_cands = [plat_name]
79+
80+
if sys.platform.startswith("linux"):
81+
# Keep broad fallbacks and add some manylinux variants that show up in practice.
82+
plat_name_cands += [
83+
"linux",
84+
"manylinux",
85+
"manylinux1",
86+
"manylinux2010",
87+
"manylinux2014",
88+
]
89+
# Wheel-style tags sometimes include glibc floor; include a couple likely ones.
90+
# (Your filenames use '-' not '_', but we’ll keep your format below.)
91+
if arch:
92+
plat_name_cands += [
93+
f"manylinux_2_17_{arch}",
94+
f"manylinux_2_5_{arch}",
95+
]
96+
97+
elif sys.platform.startswith("darwin"):
98+
# Keep your historical macOS entries; add modern versions and universal2.
99+
plat_name_cands += [
100+
"macosx-10.6",
101+
"macosx-10.7",
102+
"macosx-10.9",
103+
"macosx-10.12",
104+
"macosx-11.0",
105+
"macosx-12.0",
106+
"macosx-13.0",
107+
"macosx-10.6-intel",
108+
"macosx-10.7-intel",
109+
"macosx-10.9-intel",
110+
"macosx-10.12-intel",
111+
"macosx-11.0-universal2",
112+
"macosx-12.0-universal2",
113+
]
114+
115+
elif sys.platform.startswith("win32"):
116+
# Keep both in case filenames vary.
117+
plat_name_cands += ["win-amd64", "win32"]
118+
119+
spec_list = []
120+
for pn in plat_name_cands:
121+
spec_list.extend([
122+
f".{pn}-{py_ver}",
123+
f".{pn}-{arch}-{py_ver}",
124+
])
125+
126+
# Bare suffix (your original behavior)
127+
spec_list.append("")
128+
return spec_list
129+
130+
34131
def get_candidate_plat_specifiers():
35-
import distutils
132+
try:
133+
import distutils
134+
except ImportError:
135+
return get_candidate_plat_specifiers2()
36136
if sys.maxsize > 2 ** 32:
37137
arch = 'x86_64' # TODO: get correct arch spec
38138
else:

0 commit comments

Comments
 (0)