File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ fortranobject_c = f2py_inc_dir / 'fortranobject.c'
4848# ---- HDF5 dependencies
4949hdf5_c = dependency (' hdf5' , required : true )
5050hdf5f = declare_dependency (link_args : [' -lhdf5_fortran' ], dependencies : [hdf5_c])
51- hdf5f_hl = declare_dependency (link_args : [' -lhdf5hl_fortran ' ], dependencies : [hdf5_c])
51+ hdf5f_hl = declare_dependency (link_args : [' -lhdf5_hl_fortran ' ], dependencies : [hdf5_c])
5252
5353# Optional: OpenMP
5454# omp_dep = dependency('openmp', required : false)
@@ -110,9 +110,19 @@ configure_file(
110110install_subdir (
111111 ' mapflpy' ,
112112 install_dir : py.get_install_dir(),
113+ exclude_directories : [' fortran' ],
113114 exclude_files : [
114115 ' _version.py.in' ,
115116 ' __pycache__' ,
116117 ' *.pyc' ,
117118 ]
118119)
120+
121+ # Install mapflpy/fortran/__init__.py separately, so that the install_subdir
122+ # above can exclude the entire fortran/ directory. Without this exclusion,
123+ # any compiled .so left in the source tree (e.g. from a dev install) would
124+ # be bundled into every wheel produced by "python -m build".
125+ install_data (
126+ ' mapflpy/fortran/__init__.py' ,
127+ install_dir : py.get_install_dir() / ' mapflpy' / ' fortran' ,
128+ )
Original file line number Diff line number Diff line change @@ -70,7 +70,17 @@ def _build_env(session: nox.Session) -> Path:
7070 * pyproject ["tool" ][PROJECT_NAME ].get ("conda" , []),
7171 channel = "conda-forge"
7272 )
73- session .env .update (_darwin_sdk_env ())
73+ env_dir = Path (session .env_dir ).resolve ()
74+ lib_dir = str (env_dir / "lib" )
75+ # Override CONDA_PREFIX so conda-forge gfortran's spec file uses this env's
76+ # lib dir for its implicit library search paths, not the active outer env.
77+ env = {"CONDA_PREFIX" : str (env_dir )}
78+ env .update (_darwin_sdk_env ())
79+ if platform .system () == "Darwin" :
80+ # Also pass an explicit rpath so delocate-wheel can bundle deps even
81+ # when meson would otherwise embed a @loader_path-relative path.
82+ env ["LDFLAGS" ] = (env .get ("LDFLAGS" , "" ) + f" -Wl,-rpath,{ lib_dir } " ).strip ()
83+ session .env .update (env )
7484
7585
7686def _dist_env (session : nox .Session ) -> Path :
You can’t perform that action at this time.
0 commit comments