Skip to content
Open
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
33 changes: 33 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,38 @@ def get_include_dirs():
return dirs


def get_library_dirs():
"""
Get the library directories for the current Conda environment.

Returns:
list: A list of paths to library directories in the current Conda environment.
"""
# Get the path to the current Conda environment
conda_prefix = os.environ.get('CONDA_PREFIX')
if not conda_prefix:
raise EnvironmentError("Not running inside a Conda environment. Ensure Conda is activated.")

# Library directories typically found in Conda environments
library_dirs = [
os.path.join(conda_prefix, 'lib'), # Default library directory
]

# Return only directories that actually exist
return [d for d in library_dirs if os.path.exists(d)]


# Example usage
if __name__ == "__main__":
try:
lib_dirs = get_conda_library_dirs()
print("Library directories in the current Conda environment:")
for dir in lib_dirs:
print(f" - {dir}")
except EnvironmentError as e:
print(str(e))


def get_fftw_libs():
if sys.platform.startswith("win"):
return ['libfftw3-3']
Expand Down Expand Up @@ -180,6 +212,7 @@ def make_pybind_extension(module, **kwargs):
osp.join(morlet_dir, 'morlet.i')],
swig_opts=['-c++'],
include_dirs=get_include_dirs(),
library_dirs=get_library_dirs(),
extra_compile_args=get_compiler_args(),
libraries=get_fftw_libs(),
),
Expand Down