Skip to content

Commit fe7a1a4

Browse files
committed
Temporary fix for compiling HPy ext in universal ABI mode
1 parent 9a8db4c commit fe7a1a4

File tree

1 file changed

+13
-1
lines changed
  • graalpython/lib-graalpython/modules/hpy/devel

1 file changed

+13
-1
lines changed

graalpython/lib-graalpython/modules/hpy/devel/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def is_hpy_extension(ext_name):
7474
dist.ext_modules = []
7575
dist.ext_modules += hpy_ext_modules
7676

77+
class HpyExtName(str):
78+
def split(self, /, sep=None, maxsplit=-1):
79+
res = str.split(self, sep, maxsplit)
80+
return [HpyExtName(x) for x in res]
81+
7782
hpy_devel = self
7883
base_class = dist.cmdclass.get('build_ext', build_ext)
7984
class build_hpy_ext(base_class):
@@ -94,9 +99,16 @@ def build_extension(self, ext):
9499
hpy_devel.fix_extension(ext, hpy_abi=self.distribution.hpy_abi)
95100
return base_class.build_extension(self, ext)
96101

102+
def get_ext_fullname(self, ext_name):
103+
fullname = super().get_ext_fullname(ext_name)
104+
if is_hpy_extension(fullname):
105+
# wrap name to be able to identify in 'get_ext_filename'
106+
return HpyExtName(fullname)
107+
return fullname
108+
97109
def get_ext_filename(self, ext_name):
98110
# this is needed to give the .hpy.so extension to universal extensions
99-
if is_hpy_extension(ext_name) and self.distribution.hpy_abi == 'universal':
111+
if (isinstance(ext_name, HpyExtName) or is_hpy_extension(ext_name)) and self.distribution.hpy_abi == 'universal':
100112
ext_path = ext_name.split('.')
101113
ext_suffix = '.hpy.so' # XXX Windows?
102114
return os.path.join(*ext_path) + ext_suffix

0 commit comments

Comments
 (0)