Skip to content

Commit dc74c13

Browse files
thijsmieeboasson
authored andcommitted
Fixed release pipeline. Set upstream branch for test CI.
1 parent aeca1b9 commit dc74c13

File tree

10 files changed

+93
-63
lines changed

10 files changed

+93
-63
lines changed

.azure/publish-release.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,25 @@ trigger:
2121

2222
variables:
2323
# ---- COMMON ----
24-
CIBW_VERSION: "2.1.*"
25-
CIBW_SKIP: "pp*" # No PyPy builds
24+
CIBW_VERSION: "2.3.*"
25+
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *musllinux*" # No PyPy/32bit/musl builds
2626
# Run testing with pytest after each wheel build
2727
CIBW_TEST_REQUIRES: "pytest pytest-cov pytest-mock"
28-
CIBW_TEST_COMMAND: "pytest {package}/tests"
28+
CIBW_TEST_COMMAND: "pytest -s --verbose {package}/tests"
2929
# We can crosscompile for Apple Silicon ARM-based macs
3030
# But they are not actually available to run on
3131
# So these wheels cannot be tested in CI
3232
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
3333
CIBW_BUILD_VERBOSITY: 1
34+
PY_VERSION: "3.10"
3435

3536
# ---- BUILDER ----
3637
CLONE: >-
37-
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git main
38+
git clone --branch releases/0.9.x https://github.com/eclipse-cyclonedds/cyclonedds.git main
3839
CONFIGURE: >-
3940
mkdir -p build &&
4041
cd build &&
41-
cmake ../main -DCMAKE_INSTALL_PREFIX="$CYCLONEDDS_HOME" -DBUILD_SCHEMA=off -DENABLE_SHM=off -DENABLE_SSL=on -DENABLE_SECURITY=on -DENABLE_TOPIC_DISCOVERY=on -DENABLE_TYPE_DISCOVERY=on
42+
cmake ../main -DCMAKE_INSTALL_PREFIX="$CYCLONEDDS_HOME" -DENABLE_SHM=off -DENABLE_SSL=off -DENABLE_SECURITY=off -DENABLE_TOPIC_DISCOVERY=on -DENABLE_TYPE_DISCOVERY=on
4243
BUILD: >-
4344
cmake --build . --target install
4445
CIBW_BEFORE_ALL: >-
@@ -84,13 +85,16 @@ jobs:
8485
'Windows_Server_2019_64_bit':
8586
image: windows-2019
8687
CIBW_ARCHS: auto64
88+
CIBW_SKIP: "pp* *-win32 cp310*"
8789
CIBW_BEFORE_ALL_WINDOWS_PRE: >-
8890
$(CLONE) && $(CONFIGURE) -A x64 && $(BUILD)
89-
'Windows_Server_2019_32_bit':
91+
'Windows_Server_2019_64_bit_3_10_builds':
9092
image: windows-2019
91-
CIBW_ARCHS: auto32
93+
CIBW_ARCHS: auto64
94+
CIBW_BUILD: "cp310*"
95+
PY_VERSION: "3.9"
9296
CIBW_BEFORE_ALL_WINDOWS_PRE: >-
93-
$(CLONE) && $(CONFIGURE) -A Win32 && $(BUILD)
97+
$(CLONE) && $(CONFIGURE) -A x64 && $(BUILD)
9498
steps:
9599
- pwsh: |
96100
Write-Host "###vso[task.setvariable variable=STANDALONE_WHEELS;]1"

.azure/templates/build-cyclone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
steps:
1818
- bash: |
19-
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git cyclonedds_c
19+
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git cyclonedds_c --branch releases/0.9.x
2020
name: clone_cyclone
2121
displayName: Clone the CycloneDDS repository
2222
- bash: |
@@ -26,7 +26,7 @@ steps:
2626
displayName: Check the build type.
2727
- task: Cache@2
2828
inputs:
29-
key: cyclonedds_build | 4 | $(Agent.OS) | $(build_type) | cyclonedds_c/.git/refs/heads/master
29+
key: cyclonedds_build | 4 | $(Agent.OS) | $(build_type) | cyclonedds_c/.git/refs/heads/releases/0.9.x
3030
path: cyclone-$(Agent.OS)-$(build_type)
3131
cacheHitVar: CACHE_RESTORED
3232
name: cyclonedds_cache

.azure/templates/build-wheel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
steps:
1919
- task: UsePythonVersion@0
2020
displayName: Fetch Python
21+
inputs:
22+
versionSpec: $(PY_VERSION)
2123
- bash: |
2224
python -m pip install --user --upgrade pip
2325
pip install --user cibuildwheel==$(CIBW_VERSION)

.azure/templates/publish-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ steps:
2626
name: install_twine
2727
displayName: Install Twine
2828
- bash: |
29-
python setup.py sdist
29+
BUILDING_SDIST=1 python setup.py sdist
3030
name: build_cyclonedds_src_dist
3131
displayName: Build CycloneDDS source distribution
3232
- task: DownloadSecureFile@1

buildhelp/bdist_wheel.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ def run(self):
2222
newlibdir = Path(self.bdist_dir) / 'cyclonedds' / '.libs'
2323

2424
os.makedirs(newlibdir, exist_ok=True)
25-
with open(Path(self.bdist_dir) / 'cyclonedds' / '__library__.py', "w", encoding='utf-8') as f:
26-
f.write("from pathlib import Path\n\n")
27-
f.write("in_wheel = True\n")
28-
f.write(f"library_path = Path(__file__).parent / '.libs' / '{cyclone.ddsc_library.name}'")
25+
(Path(self.bdist_dir) / 'cyclonedds' / '__library__.py').write_text(
26+
(Path(__file__).parent / "wheel_library.py").read_text()
27+
)
2928

3029
shutil.copy(cyclone.ddsc_library, newlibdir / cyclone.ddsc_library.name)
3130

3231
if cyclone.idlc_executable and cyclone.idlc_library:
3332
shutil.copy(cyclone.idlc_executable, newlibdir / cyclone.idlc_executable.name)
34-
shutil.copy(cyclone.idlc_library, newlibdir / cyclone.idlc_library.name)
35-
36-
for lib in cyclone.security_libs:
37-
shutil.copy(lib, newlibdir / lib.name)
3833

3934
super().run()

buildhelp/wheel_library.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# will be written to __library__.py
2+
from pathlib import Path
3+
import platform
4+
5+
in_wheel = True
6+
7+
dir = Path(__file__).parent.resolve()
8+
9+
if platform.system() == "Darwin":
10+
library_path = list((dir / ".dylibs").glob("libddsc*"))[0]
11+
elif platform.system() == "Windows":
12+
library_path = list((dir / ".." / "cyclonedds.libs").glob("ddsc*"))[0]
13+
else:
14+
library_path = list((dir / ".." / "cyclonedds.libs").glob("libddsc*"))[0]

clayer/pysertype.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,11 +1638,17 @@ ddspy_read_participant(PyObject *self, PyObject *args)
16381638
dds_sample_info_t* info = dds_alloc(sizeof(dds_sample_info_t) * Nu32);
16391639
struct dds_builtintopic_participant** rcontainer = dds_alloc(sizeof(struct dds_builtintopic_participant*) * Nu32);
16401640

1641+
if (!info || !rcontainer) {
1642+
PyErr_SetString(PyExc_Exception, "Could not allocate memory");
1643+
return NULL;
1644+
}
1645+
16411646
for(uint32_t i = 0; i < Nu32; ++i) {
16421647
rcontainer[i] = NULL;
16431648
}
16441649

16451650
sts = dds_read(reader, (void**) rcontainer, info, Nu32, Nu32);
1651+
16461652
if (sts < 0) {
16471653
return PyLong_FromLong((long) sts);
16481654
}

cyclonedds/tools/wheel_idlc/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
1212
1313
This tool is used in wheels to perform the idlc command.
14-
The idlc binary is under cyclonedds/.libs/idlc, libs are under
15-
cyclonedds/.libs.
14+
The idlc binary is under cyclonedds/.libs/idlc, libs are under library_path.parent
1615
"""
1716

1817
import os
@@ -33,11 +32,13 @@ def command():
3332

3433
environ = os.environ.copy()
3534

35+
from cyclonedds.__library__ import library_path
36+
3637
if platform.system() == "Windows":
37-
environ["PATH"] = ";".join([str(libdir)] + environ.get("PATH", "").split(";"))
38+
environ["PATH"] = ";".join([str(library_path.parent)] + environ.get("PATH", "").split(";"))
3839
elif platform.system() == "Darwin":
39-
environ["DYLD_LIBRARY_PATH"] = ":".join([str(libdir)] + environ.get("DYLD_LIBRARY_PATH", "").split(":"))
40+
environ["DYLD_LIBRARY_PATH"] = ":".join([str(library_path.parent)] + environ.get("DYLD_LIBRARY_PATH", "").split(":"))
4041
else:
41-
environ["LD_LIBRARY_PATH"] = ":".join([str(libdir)] + environ.get("LD_LIBRARY_PATH", "").split(":"))
42+
environ["LD_LIBRARY_PATH"] = ":".join([str(library_path.parent)] + environ.get("LD_LIBRARY_PATH", "").split(":"))
4243

4344
os.execvpe(idlc, sys.argv[1:], environ)

setup.py

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,59 +29,62 @@
2929
long_description = f.read()
3030

3131

32-
cyclone = find_cyclonedds()
32+
if "BUILDING_SDIST" not in os.environ:
33+
cyclone = find_cyclonedds()
3334

34-
if not cyclone:
35-
print("Could not locate cyclonedds. Try to set CYCLONEDDS_HOME or CMAKE_PREFIX_PATH")
36-
import sys
37-
sys.exit(1)
35+
if not cyclone:
36+
print("Could not locate cyclonedds. Try to set CYCLONEDDS_HOME or CMAKE_PREFIX_PATH")
37+
import sys
38+
sys.exit(1)
3839

3940

40-
with open(this_directory / 'cyclonedds' / '__library__.py', "w", encoding='utf-8') as f:
41-
f.write("in_wheel = False\n")
42-
f.write(f"library_path = '{cyclone.ddsc_library}'")
41+
with open(this_directory / 'cyclonedds' / '__library__.py', "w", encoding='utf-8') as f:
42+
f.write("in_wheel = False\n")
43+
f.write(f"library_path = '{cyclone.ddsc_library}'")
4344

4445

45-
ext_modules = [
46-
Extension('cyclonedds._clayer', [
47-
'clayer/cdrkeyvm.c',
48-
'clayer/pysertype.c',
49-
'clayer/typeser.c'
50-
],
51-
include_dirs=[
52-
str(cyclone.include_path),
53-
str(this_directory / "clayer")
54-
],
55-
libraries=['ddsc'],
56-
library_dirs=[
57-
str(cyclone.library_path),
58-
str(cyclone.binary_path),
59-
]
60-
)
61-
]
62-
63-
if cyclone.idlc_library:
64-
ext_modules += [
65-
Library('cyclonedds._idlpy', [
66-
'idlpy/src/context.c',
67-
'idlpy/src/generator.c',
68-
'idlpy/src/naming.c',
69-
'idlpy/src/ssos.c',
70-
'idlpy/src/types.c',
71-
'idlpy/src/util.c'
46+
ext_modules = [
47+
Extension('cyclonedds._clayer', [
48+
'clayer/cdrkeyvm.c',
49+
'clayer/pysertype.c',
50+
'clayer/typeser.c'
7251
],
7352
include_dirs=[
7453
str(cyclone.include_path),
75-
str(this_directory / "idlpy" / "include")
54+
str(this_directory / "clayer")
7655
],
77-
libraries=['ddsc', 'cycloneddsidl'],
56+
libraries=['ddsc'],
7857
library_dirs=[
7958
str(cyclone.library_path),
80-
str(cyclone.binary_path)
59+
str(cyclone.binary_path),
8160
]
8261
)
8362
]
8463

64+
if cyclone.idlc_library:
65+
ext_modules += [
66+
Library('cyclonedds._idlpy', [
67+
'idlpy/src/context.c',
68+
'idlpy/src/generator.c',
69+
'idlpy/src/naming.c',
70+
'idlpy/src/ssos.c',
71+
'idlpy/src/types.c',
72+
'idlpy/src/util.c'
73+
],
74+
include_dirs=[
75+
str(cyclone.include_path),
76+
str(this_directory / "idlpy" / "include")
77+
],
78+
libraries=['ddsc', 'cycloneddsidl'],
79+
library_dirs=[
80+
str(cyclone.library_path),
81+
str(cyclone.binary_path)
82+
]
83+
)
84+
]
85+
else:
86+
ext_modules=[]
87+
8588

8689
setup(
8790
name='cyclonedds',

tests/test_loader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
from cyclonedds.internal import CycloneDDSLoaderException, load_cyclonedds
2-
from cyclonedds.__library__ import library_path
2+
from cyclonedds.__library__ import library_path, in_wheel
33
from pytest_mock import MockerFixture
4+
import pytest
45
import os
56

67

8+
if in_wheel:
9+
pytest.skip("Loader tests are not needed in wheels: loadpath is static.", allow_module_level=True)
10+
11+
712
def gen_test_loader(loadlist):
813
def load(path):
914
loadlist.append(path)

0 commit comments

Comments
 (0)