Skip to content

Commit c5724b8

Browse files
committed
Make local rattler package builds prove Python and R loads
The rattler recipes need to build from the repository root, link R's final shared object against system TIFF, and keep generated R symbols parseable. The Python recipe path is corrected for the recipes/py location, while the R recipe explicitly enables conda TIFF and links libtiff into the R package load path. Constraint: User requested local rattler validation of the packaging pipeline Rejected: Rely on CMake's tttrlibR target alone | R CMD INSTALL relinks the package from the static core and must carry TIFF itself Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep Python-internal TIFF SWIG names underscored only outside SWIGR; R-generated wrappers cannot reference leading-underscore symbols Tested: rattler-build build --recipe recipes/py --variant python=3.11 --channel conda-forge --output-dir ./conda-bld --test native --log-style plain Tested: rattler-build build --recipe recipes/r --channel conda-forge --output-dir ./conda-bld --test native --log-style plain Tested: rattler-build build --render-only --with-solve for recipes/py, recipes/r, and recipes/docs Not-tested: Linux docs package build because recipes/docs is skipped on local macOS
1 parent 58c66dd commit c5724b8

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

ext/python/Tiff.i

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,25 @@
3232
%include "TiffArrayIO.h"
3333

3434
// One binding entry point per pixel type - the six concrete instantiations of
35-
// the single read_tiff/write_tiff template. Named with a leading underscore:
36-
// these are internal plumbing, users call imread()/imwrite().
35+
// the single read_tiff/write_tiff template. Python names them with a leading
36+
// underscore because users call imread()/imwrite(); R cannot parse generated
37+
// wrapper references to symbols starting with "_" (for example "f <- _name"),
38+
// so use R-safe names there.
39+
#ifdef SWIGR
40+
%template(tiff_read_u8) tttrlib::read_tiff<unsigned char>;
41+
%template(tiff_read_u16) tttrlib::read_tiff<unsigned short>;
42+
%template(tiff_read_u32) tttrlib::read_tiff<unsigned int>;
43+
%template(tiff_read_i32) tttrlib::read_tiff<int>;
44+
%template(tiff_read_f32) tttrlib::read_tiff<float>;
45+
%template(tiff_read_f64) tttrlib::read_tiff<double>;
46+
47+
%template(tiff_write_u8) tttrlib::write_tiff<unsigned char>;
48+
%template(tiff_write_u16) tttrlib::write_tiff<unsigned short>;
49+
%template(tiff_write_u32) tttrlib::write_tiff<unsigned int>;
50+
%template(tiff_write_i32) tttrlib::write_tiff<int>;
51+
%template(tiff_write_f32) tttrlib::write_tiff<float>;
52+
%template(tiff_write_f64) tttrlib::write_tiff<double>;
53+
#else
3754
%template(_tiff_read_u8) tttrlib::read_tiff<unsigned char>;
3855
%template(_tiff_read_u16) tttrlib::read_tiff<unsigned short>;
3956
%template(_tiff_read_u32) tttrlib::read_tiff<unsigned int>;
@@ -47,6 +64,7 @@
4764
%template(_tiff_write_i32) tttrlib::write_tiff<int>;
4865
%template(_tiff_write_f32) tttrlib::write_tiff<float>;
4966
%template(_tiff_write_f64) tttrlib::write_tiff<double>;
67+
#endif
5068

5169
// ---- Single, auto-dispatching user interface (Python) -----------------------
5270
#ifdef SWIGPYTHON

recipes/py/recipe.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package:
88
version: ${{ version }}
99

1010
source:
11-
path: ..
11+
path: ../..
1212

1313
build:
1414
number: 1

recipes/r/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ cmake -S .. -B . \
1515
-DBUILD_R_INTERFACE=ON \
1616
-DBUILD_LIBRARY=ON \
1717
-DWITH_AVX=OFF \
18+
-DWITH_TIFF=ON \
19+
-DWITH_TIFF_SYSTEM=ON \
1820
-DCMAKE_BUILD_TYPE=Release \
1921
-G Ninja
2022
ninja tttrlibR tttrlibStatic -j "${CPU_COUNT}"
@@ -39,7 +41,7 @@ INCDIRS="-I${ROOT}/include -I${ROOT}/src -I${ROOT}/thirdparty -I${ROOT}/thirdpar
3941
sed -e "s|@TTTRLIB_INCLUDE@|${ROOT}|g" \
4042
-e "s|@HDF5_CFLAGS@|${INCDIRS}|g" \
4143
-e "s|@TTTRLIB_LIBS@|${STATIC}|g" \
42-
-e "s|@HDF5_LIBS@|-L${PREFIX}/lib -lhdf5|g" \
44+
-e "s|@HDF5_LIBS@|-L${PREFIX}/lib -lhdf5 -ltiff|g" \
4345
ext/r/pkg/src/Makevars.in > ext/r/pkg/src/Makevars
4446
rm -f ext/r/pkg/src/Makevars.in
4547
printf 'CXX_STD = CXX17\n' >> ext/r/pkg/src/Makevars

recipes/r/recipe.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ requirements:
2929
# CHARACTER_POINTER); pin to R 4.4.x, matching the CI R test.
3030
- r-base >=4.4,<4.5
3131
- hdf5
32+
- libtiff
3233
- highfive
3334
- nlohmann_json
3435
- if: osx
@@ -38,6 +39,7 @@ requirements:
3839
run:
3940
- r-base >=4.4,<4.5 # keep in sync with the host pin above
4041
- hdf5
42+
- libtiff
4143
- if: osx
4244
then: llvm-openmp
4345
- if: linux

0 commit comments

Comments
 (0)