Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
allow-prereleases: true

- name: Install/Upgrade Python dependencies
run: python -m pip install --upgrade pip wheel 'setuptools>=60.2'
run: python -m pip install --upgrade pip wheel 'setuptools>=60.2' 'setuptools-scm[toml]>=6.0'

- name: Build
run: |
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
run: python -c "import sys; print(hasattr(sys, 'gettotalrefcount'))"

- name: Install/Upgrade Python dependencies
run: python -m pip install --upgrade pip wheel
run: python -m pip install --upgrade pip wheel 'setuptools>=60.2' 'setuptools-scm[toml]>=6.0'

- name: Build
run: |
Expand Down Expand Up @@ -322,7 +322,7 @@ jobs:

check_py27_compat:
name: Check Python 2.7 compatibility
runs-on: 'ubuntu-20.04'
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[build-system]
requires = [ "setuptools>=64.0", "setuptools-scm[toml]>=6.0", "wheel>=0.34.2",]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
36 changes: 23 additions & 13 deletions test/hpy_devel/test_distutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,27 @@ def gen_project(self):
HPy_MODINIT(hpymod_legacy, moduledef)
""")

def _gen_file(self, fname, preamble, src):
"""Generate a file inside hpy_test_project"""
src = textwrap.dedent(preamble) + textwrap.dedent(src)
self.hpy_test_project.join(fname).write(src)

def gen_setup_py(self, src):
preamble = textwrap.dedent("""
preamble = """
from setuptools import setup, Extension
cpymod = Extension("cpymod", ["cpymod.c"])
hpymod = Extension("hpymod", ["hpymod.c"])
hpymod_legacy = Extension("hpymod_legacy", ["hpymod_legacy.c"])
""")
src = preamble + textwrap.dedent(src)
f = self.hpy_test_project.join('setup.py')
f.write(src)
"""
self._gen_file('setup.py', preamble, src)

def gen_pyproject_toml(self, src="[project]\nname = 'hpy_test_project'\nversion = '0.0.0'\n"):
preamble = """
[build-system]
requires = ["setuptools>=64.0", "hpy; implementation_name == 'cpython'"]
build-backend = "setuptools.build_meta"
"""
self._gen_file('pyproject.toml', preamble, src)

def get_docstring(self, modname):
cmd = f'import {modname}; print({modname}.__doc__)'
Expand Down Expand Up @@ -297,13 +308,11 @@ def test_dont_mix_cpython_and_universal_abis(self):
"""
# make sure that the build dirs for cpython and universal ABIs are
# distinct
self.gen_setup_py("""
setup(name = "hpy_test_project",
hpy_ext_modules = [hpymod],
install_requires = [],
)
""")
self.python('setup.py', 'install')
self.gen_setup_py("setup(hpy_ext_modules = [hpymod])")
self.gen_pyproject_toml()

command = ['-m', 'pip', 'install', '.', '-v', '--no-build-isolation']
self.python(*command)
# in the build/ dir, we should have 2 directories: temp and lib
build = self.hpy_test_project.join('build')
temps = build.listdir('temp*')
Expand All @@ -315,7 +324,8 @@ def test_dont_mix_cpython_and_universal_abis(self):
assert doc == 'hpymod with HPy ABI: cpython'

# now recompile with universal *without* cleaning the build
self.python('setup.py', '--hpy-abi=universal', 'install')
command.append('--config-settings=--global-option=--hpy-abi=universal')
self.python(*command)
# in the build/ dir, we should have 4 directories: 2 temp*, and 2 lib*
build = self.hpy_test_project.join('build')
temps = build.listdir('temp*')
Expand Down