Skip to content

Commit

Permalink
fix: ci tests (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut authored Aug 4, 2024
1 parent 2c77014 commit 14c4282
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ target/
wheelhoust-*
tests/integration/testpackage/testpackage/testprogram
tests/integration/testpackage/testpackage/testprogram_nodeps
tests/integration/sample_extension/src/sample_extension.c
2 changes: 1 addition & 1 deletion tests/integration/internal_rpath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["cython", "setuptools"]
build-backend = "setuptools.build_meta"
requires = ["cython", "setuptools", "wheel"]
2 changes: 1 addition & 1 deletion tests/integration/multiple_top_level/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["cython", "setuptools"]
build-backend = "setuptools.build_meta"
requires = ["cython", "setuptools", "wheel"]
3 changes: 3 additions & 0 deletions tests/integration/nonpy_rpath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
3 changes: 3 additions & 0 deletions tests/integration/test_glibcxx_3_4_25/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
35 changes: 13 additions & 22 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
}
NUMPY_VERSION = NUMPY_VERSION_MAP[PYTHON_ABI_MAJ_MIN]
ORIGINAL_NUMPY_WHEEL = f"numpy-{NUMPY_VERSION}-{PYTHON_ABI}-linux_{PLATFORM}.whl"
ORIGINAL_SIX_WHEEL = "six-1.11.0-py2.py3-none-any.whl"
SHOW_RE = re.compile(
r'[\s](?P<wheel>\S+) is consistent with the following platform tag: "(?P<tag>\S+)"',
flags=re.DOTALL,
Expand Down Expand Up @@ -321,7 +320,7 @@ def test_repair_exclude(self, any_manylinux_container, io_folder):
build_cmd = (
f"cd {test_path} && "
"if [ -d ./build ]; then rm -rf ./build ./*.egg-info; fi && "
"python setup.py bdist_wheel -d /io"
"python -m pip wheel --no-deps -w /io ."
)
docker_exec(manylinux_ctr, ["bash", "-c", build_cmd])
filenames = os.listdir(io_folder)
Expand Down Expand Up @@ -426,23 +425,13 @@ def test_build_wheel_with_binary_executable(
def test_build_repair_pure_wheel(self, any_manylinux_container, io_folder):
policy, tag, manylinux_ctr = any_manylinux_container

if op.exists(op.join(WHEEL_CACHE_FOLDER, policy, ORIGINAL_SIX_WHEEL)):
# If six has already been built and put in cache, let's reuse this.
shutil.copy2(
op.join(WHEEL_CACHE_FOLDER, policy, ORIGINAL_SIX_WHEEL),
op.join(io_folder, ORIGINAL_SIX_WHEEL),
)
logger.info(f"Copied six wheel from {WHEEL_CACHE_FOLDER} to {io_folder}")
else:
docker_exec(manylinux_ctr, "pip wheel -w /io --no-binary=:all: six==1.11.0")
os.makedirs(op.join(WHEEL_CACHE_FOLDER, policy), exist_ok=True)
shutil.copy2(
op.join(io_folder, ORIGINAL_SIX_WHEEL),
op.join(WHEEL_CACHE_FOLDER, policy, ORIGINAL_SIX_WHEEL),
)
docker_exec(
manylinux_ctr,
"pip download --no-deps -d /io --only-binary=:all: six==1.16.0",
)

filenames = os.listdir(io_folder)
assert filenames == [ORIGINAL_SIX_WHEEL]
assert filenames == ["six-1.16.0-py2.py3-none-any.whl"]
orig_wheel = filenames[0]
assert "manylinux" not in orig_wheel

Expand Down Expand Up @@ -477,7 +466,7 @@ def test_build_wheel_depending_on_library_with_rpath(
(
"cd /auditwheel_src/tests/integration/testrpath &&"
"if [ -d ./build ]; then rm -rf ./build ./*.egg-info; fi && "
f"DTAG={dtag} python setup.py bdist_wheel -d /io"
f"DTAG={dtag} python -m pip wheel --no-deps -w /io ."
),
],
)
Expand Down Expand Up @@ -860,15 +849,17 @@ def test_build_wheel_with_image_dependencies(
# tested.

policy, tag, manylinux_ctr = any_manylinux_container

build_command = (
"cd /auditwheel_src/tests/integration/testdependencies && "
"if [ -d ./build ]; then rm -rf ./build ./*.egg-info; fi && "
f"WITH_DEPENDENCY={with_dependency} python -m pip wheel --no-deps -w /io ."
)
docker_exec(
manylinux_ctr,
[
"bash",
"-c",
"cd /auditwheel_src/tests/integration/testdependencies && "
f"WITH_DEPENDENCY={with_dependency} python setup.py -v build_ext -f "
"bdist_wheel -d /io",
build_command,
],
)

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/testdependencies/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
13 changes: 10 additions & 3 deletions tests/integration/testdependencies/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from os import getenv, path

from setuptools import Extension, setup

cmd = "gcc -shared -fPIC -D_GNU_SOURCE dependency.c -o libdependency.so -lm -lc"
subprocess.check_call(cmd.split())
from setuptools.command.build_ext import build_ext

define_macros = [("_GNU_SOURCE", None)]
libraries = []
Expand All @@ -19,9 +17,18 @@

libraries.extend(["m", "c"])


class BuildExt(build_ext):
def run(self) -> None:
cmd = "gcc -shared -fPIC -D_GNU_SOURCE dependency.c -o libdependency.so -lm -lc"
subprocess.check_call(cmd.split())
super().run()


setup(
name="testdependencies",
version="0.0.1",
cmdclass={"build_ext": BuildExt},
ext_modules=[
Extension(
"testdependencies",
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/testpackage/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
3 changes: 3 additions & 0 deletions tests/integration/testrpath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
35 changes: 21 additions & 14 deletions tests/integration/testrpath/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,34 @@
import subprocess

from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext


class BuildExt(build_ext):
def run(self) -> None:
cmd = "gcc -fPIC -shared -o b/libb.so b/b.c"
subprocess.check_call(cmd.split())
cmd = (
"gcc -fPIC -shared -o a/liba.so "
"-Wl,{dtags_flag} -Wl,-rpath=$ORIGIN/../b "
"-Ib a/a.c -Lb -lb"
).format(
dtags_flag=(
"--enable-new-dtags"
if os.getenv("DTAG") == "runpath"
else "--disable-new-dtags"
)
)
subprocess.check_call(cmd.split())
super().run()

cmd = "gcc -fPIC -shared -o b/libb.so b/b.c"
subprocess.check_call(cmd.split())
cmd = (
"gcc -fPIC -shared -o a/liba.so "
"-Wl,{dtags_flag} -Wl,-rpath=$ORIGIN/../b "
"-Ib a/a.c -Lb -lb"
).format(
dtags_flag=(
"--enable-new-dtags"
if os.getenv("DTAG") == "runpath"
else "--disable-new-dtags"
)
)
subprocess.check_call(cmd.split())

setup(
name="testrpath",
version="0.0.1",
packages=["testrpath"],
package_dir={"": "src"},
cmdclass={"build_ext": BuildExt},
ext_modules=[
Extension(
"testrpath/testrpath",
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/testsimple/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
3 changes: 3 additions & 0 deletions tests/integration/testzlib/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

0 comments on commit 14c4282

Please sign in to comment.