From 20519ea7da9818b9c64a098a9ead772467b964f6 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 5 Nov 2024 08:49:44 +0100 Subject: [PATCH 01/18] Add tttrlib recipe --- recipes/tttrlib/LICENSE.txt | 27 ++++++ recipes/tttrlib/app_wrapper.c | 175 ++++++++++++++++++++++++++++++++++ recipes/tttrlib/bld.bat | 32 +++++++ recipes/tttrlib/build.sh | 26 +++++ recipes/tttrlib/meta.yaml | 68 +++++++++++++ 5 files changed, 328 insertions(+) create mode 100644 recipes/tttrlib/LICENSE.txt create mode 100644 recipes/tttrlib/app_wrapper.c create mode 100755 recipes/tttrlib/bld.bat create mode 100755 recipes/tttrlib/build.sh create mode 100644 recipes/tttrlib/meta.yaml diff --git a/recipes/tttrlib/LICENSE.txt b/recipes/tttrlib/LICENSE.txt new file mode 100644 index 0000000000000..66fe31cc38cc1 --- /dev/null +++ b/recipes/tttrlib/LICENSE.txt @@ -0,0 +1,27 @@ +BSD-3-Clause license +Copyright (c) 2015-2022, conda-forge contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. \ No newline at end of file diff --git a/recipes/tttrlib/app_wrapper.c b/recipes/tttrlib/app_wrapper.c new file mode 100644 index 0000000000000..326dceb63e296 --- /dev/null +++ b/recipes/tttrlib/app_wrapper.c @@ -0,0 +1,175 @@ +#include +#include +#include +#include + +/* + See: https://github.com/conda-forge/imp-feedstock/tree/main/recipe + IMP Python command line tools on Unix/Linux/Mac are typically named + without a .py extension (e.g. 'myapp' not 'myapp.py') and rely on a + #!/usr/bin/python line at the start of the file to tell the OS that + they are Python files. This doesn't work on Windows though, since + Windows relies on the file extension. + + To remedy this problem, we provide this wrapper. Compile with + cl app_wrapper.c shell32.lib + then copy the resulting app_wrapper.exe to myapp.exe and install in + the top-level Anaconda directory. Then a user should be able to simply + type 'myapp', and the right Python tool will be run. +*/ + +/* Get full path to fname in topdir */ +static char *get_new_full_path(const char *topdir, const char *fname) +{ + char *newpath = malloc(strlen(topdir) + strlen(fname) + 2); + strcpy(newpath, topdir); + strcat(newpath, "\\"); + strcat(newpath, fname); + return newpath; +} + +/* Get full path to this binary */ +static void get_full_path(char **dir, char **fname) +{ + char path[MAX_PATH * 2]; + size_t l; + char *ch; + DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2); + if (ret == 0) { + fprintf(stderr, "Failed to get executable name, code %d\n", GetLastError()); + exit(1); + } + l = strlen(path); + if (l > 4 && path[l - 4] == '.') { + /* Remove extension */ + path[l-4] = '\0'; + } + ch = strrchr(path, '\\'); + if (ch) { + *ch = '\0'; + *fname = strdup(ch + 1); + } else { + *fname = strdup(""); + } + *dir = strdup(path); +} + +/* Find where the parameters start in the command line (skip past the + executable name) */ +static char *find_param_start(char *cmdline) +{ + BOOL in_quote = FALSE, in_space = FALSE; + for (; *cmdline; cmdline++) { + /* Ignore spaces that are quoted */ + if (*cmdline == ' ' && !in_quote) { + in_space = TRUE; + } else if (*cmdline == '"') { + in_quote = !in_quote; + } + /* Return the first nonspace that follows a space */ + if (in_space && *cmdline != ' ') { + break; + } + } + return cmdline; +} + +/* Convert original parameters into those that python.exe wants (i.e. prepend + the name of the Python script) */ +static char *make_python_parameters(const char *orig_param, const char *binary) +{ + char *param = malloc(strlen(orig_param) + strlen(binary) + 4); + strcpy(param, "\""); + strcat(param, binary); + strcat(param, "\" "); + strcat(param, orig_param); + /*printf("python param %s\n", param);*/ + return param; +} + +/* Remove the last component of the path in place */ +static void remove_last_component(char *dir) +{ + char *pt; + if (!dir || !*dir) return; + /* Remove trailing slash if present */ + if (dir[strlen(dir)-1] == '\\') { + dir[strlen(dir)-1] = '\0'; + } + /* Remove everything after the last slash */ + pt = strrchr(dir, '\\'); + if (pt) { + *pt = '\0'; + } +} + +/* Get the full path to the Anaconda Python. */ +static char* get_python_binary(const char *topdir) +{ + char *python = malloc(strlen(topdir) + 12); + strcpy(python, topdir); + /* Remove last two components of the path (we are in Library/bin; python + is in the top-level directory) */ + remove_last_component(python); + remove_last_component(python); + strcat(python, "\\python.exe"); + return python; +} + +/* Run the given Python script, passing it the parameters we ourselves + were given. */ +static DWORD run_binary(const char *binary, const char *topdir) +{ + SHELLEXECUTEINFO si; + BOOL bResult; + char *param, *python = NULL; + param = strdup(GetCommandLine()); + + ZeroMemory(&si, sizeof(SHELLEXECUTEINFO)); + si.cbSize = sizeof(SHELLEXECUTEINFO); + /* Wait for the spawned process to finish, so that any output goes to the + console *before* the next command prompt */ + si.fMask = SEE_MASK_NO_CONSOLE | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS; + { + char *orig_param = param; + python = get_python_binary(topdir); + si.lpFile = python; + param = make_python_parameters(find_param_start(param), binary); + free(orig_param); + si.lpParameters = param; + } + si.nShow = SW_SHOWNA; + bResult = ShellExecuteEx(&si); + free(param); + free(python); + + if (bResult) { + if (si.hProcess) { + DWORD exit_code; + WaitForSingleObject(si.hProcess, INFINITE); + GetExitCodeProcess(si.hProcess, &exit_code); + CloseHandle(si.hProcess); + return exit_code; + } + } else { + fprintf(stderr, "Failed to start process, code %d\n", GetLastError()); + exit(1); + } + return 0; +} + +int main(int argc, char *argv[]) { + int is_python; + char *dir, *fname, *new_full_path; + DWORD return_code; + + get_full_path(&dir, &fname); + /*printf("%s, %s\n", dir, fname);*/ + new_full_path = get_new_full_path(dir, fname); + /*printf("new full path %s, %d\n", new_full_path, is_python);*/ + return_code = run_binary(new_full_path, dir); + free(dir); + free(fname); + free(new_full_path); + return return_code; +} diff --git a/recipes/tttrlib/bld.bat b/recipes/tttrlib/bld.bat new file mode 100755 index 0000000000000..2abc2a7c890fd --- /dev/null +++ b/recipes/tttrlib/bld.bat @@ -0,0 +1,32 @@ +cd %SRC_DIR% +git submodule update --recursive --init --remote + +echo "Build app wrapper" +:: build app wrapper +copy "%RECIPE_DIR%\app_wrapper.c" . +cl app_wrapper.c shell32.lib +if errorlevel 1 exit 1 + +rmdir b2 /s /q +mkdir b2 +cd b2 +for /f %%A in ('python -c "import platform; print(platform.python_version())"') do set python_version=%%A +echo Python version: %python_version% +cmake .. -G "NMake Makefiles" ^ + -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ + -DCMAKE_PREFIX_PATH="%PREFIX%" ^ + -DBUILD_PYTHON_INTERFACE=ON ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ + -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ + -DPYTHON_VERSION="%python_version%" ^ + -DBUILD_LIBRARY=ON +nmake install + + +:: Add wrappers to path for each Python command line tool +:: (all files without an extension) +cd %SRC_DIR%\bin +for /f %%f in ('dir /b *.py') do copy "%SRC_DIR%\bin\%%f" "%PREFIX%\Library\bin\%%f" +for /f %%f in ('dir /b *.') do copy "%SRC_DIR%\app_wrapper.exe" "%PREFIX%\Library\bin\%%f.exe" +if errorlevel 1 exit 1 diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh new file mode 100755 index 0000000000000..d0d2e2583e50b --- /dev/null +++ b/recipes/tttrlib/build.sh @@ -0,0 +1,26 @@ +mkdir b2 && cd b2 + +if [[ "${target_platform}" == osx-* ]]; then + # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" +fi + +cmake \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DBUILD_PYTHON_INTERFACE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \ + -DCMAKE_SWIG_OUTDIR="$SP_DIR" \ + -DBUILD_LIBRARY=ON \ + -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ + -G Ninja .. + +# On some platforms (notably aarch64 with Drone) builds can fail due to +# running out of memory. If this happens, try the build again; if it +# still fails, restrict to one core. +ninja install -k 0 || ninja install -k 0 || ninja install -j 1 + +# Copy programs to bin +cd $PREFIX/bin +cp $SRC_DIR/bin/* . \ No newline at end of file diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml new file mode 100644 index 0000000000000..bb0183895212a --- /dev/null +++ b/recipes/tttrlib/meta.yaml @@ -0,0 +1,68 @@ +{% set name = "tttrlib" %} +{% set version = "0.25.0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/Fluorescence-Tools/tttrlib/archive/refs/tags/v{{ version }}.tar.gz + sha256: e15604ef063257cd87d3bdf266c1d5a448189508f51cdc4156a93cb2b46fe807 + +build: + number: 0 + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - {{ stdlib("c") }} + - llvm-openmp # [osx] + - libgomp # [linux] + - pkg-config # [not win] + - cmake + - ninja + - make # [linux] + - doxygen + - swig 4.2.* + - python + - numpy + host: + - libboost-devel + - hdf5 + - python + - setuptools + - numpy + run: + - python + - tqdm + - click + - click-didyoumean + - {{ pin_compatible('numpy') }} + - scikit-image + - matplotlib-base + - hdf5 + +test: + imports: + - tttrlib + commands: + - tttrlib --help # [not win] + +about: + home: https://github.com/fluorescence-tools/tttrlib + summary: 'A file format agnostic library for time-resolved imaging and spectroscopic data' + description: | + tttrlib is a simple, fast, libray to read, write and process + time-resolved imaging and spectroscopic data. For speed, it + is written in C++ and wrapped for Python via SWIG. + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE.txt + doc_url: https://tttrlib.readthedocs.io/ + dev_url: https://github.com/fluorescence-tools/tttrlib + +extra: + recipe-maintainers: + - tpeulen + - khemmen From aaaf15afb18d8b113f29715e5c26fd27cdd70c6e Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 5 Nov 2024 09:23:45 +0100 Subject: [PATCH 02/18] Remove bld.bat --- recipes/tttrlib/bld.bat | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100755 recipes/tttrlib/bld.bat diff --git a/recipes/tttrlib/bld.bat b/recipes/tttrlib/bld.bat deleted file mode 100755 index 2abc2a7c890fd..0000000000000 --- a/recipes/tttrlib/bld.bat +++ /dev/null @@ -1,32 +0,0 @@ -cd %SRC_DIR% -git submodule update --recursive --init --remote - -echo "Build app wrapper" -:: build app wrapper -copy "%RECIPE_DIR%\app_wrapper.c" . -cl app_wrapper.c shell32.lib -if errorlevel 1 exit 1 - -rmdir b2 /s /q -mkdir b2 -cd b2 -for /f %%A in ('python -c "import platform; print(platform.python_version())"') do set python_version=%%A -echo Python version: %python_version% -cmake .. -G "NMake Makefiles" ^ - -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ - -DCMAKE_PREFIX_PATH="%PREFIX%" ^ - -DBUILD_PYTHON_INTERFACE=ON ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ - -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ - -DPYTHON_VERSION="%python_version%" ^ - -DBUILD_LIBRARY=ON -nmake install - - -:: Add wrappers to path for each Python command line tool -:: (all files without an extension) -cd %SRC_DIR%\bin -for /f %%f in ('dir /b *.py') do copy "%SRC_DIR%\bin\%%f" "%PREFIX%\Library\bin\%%f" -for /f %%f in ('dir /b *.') do copy "%SRC_DIR%\app_wrapper.exe" "%PREFIX%\Library\bin\%%f.exe" -if errorlevel 1 exit 1 From 828daf7920e399ebcf91b5ead40ad07cfee9b4c3 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 5 Nov 2024 09:24:01 +0100 Subject: [PATCH 03/18] Fix version issues --- recipes/tttrlib/meta.yaml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index bb0183895212a..96222679fc565 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -1,30 +1,28 @@ -{% set name = "tttrlib" %} -{% set version = "0.25.0" %} - package: - name: {{ name|lower }} - version: {{ version }} + name: tttrlib + version: "0.25.0" source: - url: https://github.com/Fluorescence-Tools/tttrlib/archive/refs/tags/v{{ version }}.tar.gz + url: https://github.com/Fluorescence-Tools/tttrlib/archive/refs/tags/v0.25.0.tar.gz sha256: e15604ef063257cd87d3bdf266c1d5a448189508f51cdc4156a93cb2b46fe807 build: number: 0 + run_exports: '{{ pin_subpackage("tttrlib", max_pin="x.x") }}' requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - {{ stdlib("c") }} - - llvm-openmp # [osx] - - libgomp # [linux] - - pkg-config # [not win] + - llvm-openmp # [osx] + - libgomp # [linux] + - pkg-config - cmake - ninja - - make # [linux] + - make # [linux] - doxygen - - swig 4.2.* + - swig <4.3.0 - python - numpy host: @@ -47,7 +45,7 @@ test: imports: - tttrlib commands: - - tttrlib --help # [not win] + - tttrlib --help about: home: https://github.com/fluorescence-tools/tttrlib From def59b27e94279c1548e7718afa88baf6b1baead Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:16:35 -0600 Subject: [PATCH 04/18] Update meta.yaml --- recipes/tttrlib/meta.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 96222679fc565..5c29d252d3b54 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -1,9 +1,12 @@ +{% set name = "tttrlib" %} +{% set version = "0.25.0" %} + package: - name: tttrlib - version: "0.25.0" + name: {{ name }} + version: {{ version }} source: - url: https://github.com/Fluorescence-Tools/tttrlib/archive/refs/tags/v0.25.0.tar.gz + url: https://github.com/Fluorescence-Tools/tttrlib/archive/refs/tags/v{{ version }}.tar.gz sha256: e15604ef063257cd87d3bdf266c1d5a448189508f51cdc4156a93cb2b46fe807 build: @@ -14,22 +17,19 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - - {{ stdlib("c") }} - - llvm-openmp # [osx] - - libgomp # [linux] - pkg-config - cmake - ninja - make # [linux] - doxygen - swig <4.3.0 - - python - - numpy host: - - libboost-devel + - llvm-openmp # [osx] + - libgomp # [linux] + - libboost-cpp - hdf5 - python - - setuptools + - pip - numpy run: - python @@ -49,7 +49,7 @@ test: about: home: https://github.com/fluorescence-tools/tttrlib - summary: 'A file format agnostic library for time-resolved imaging and spectroscopic data' + summary: 'A file format agnostic library for time-resolved imaging and spectroscopic data.' description: | tttrlib is a simple, fast, libray to read, write and process time-resolved imaging and spectroscopic data. For speed, it @@ -57,7 +57,7 @@ about: license: BSD-3-Clause license_family: BSD license_file: LICENSE.txt - doc_url: https://tttrlib.readthedocs.io/ + doc_url: https://tttrlib.readthedocs.io dev_url: https://github.com/fluorescence-tools/tttrlib extra: From a3e7d406fc5fa17a58ccd6de3c1aebb3cee5eb95 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:22:54 -0600 Subject: [PATCH 05/18] Update build.sh --- recipes/tttrlib/build.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh index d0d2e2583e50b..20ecefe97b93a 100755 --- a/recipes/tttrlib/build.sh +++ b/recipes/tttrlib/build.sh @@ -1,26 +1,32 @@ +#!/bin/bash + mkdir b2 && cd b2 if [[ "${target_platform}" == osx-* ]]; then # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" + export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER" +else + export CONFIG_ARGS="" fi -cmake \ - -DCMAKE_INSTALL_PREFIX="$PREFIX" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DBUILD_PYTHON_INTERFACE=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \ - -DCMAKE_SWIG_OUTDIR="$SP_DIR" \ - -DBUILD_LIBRARY=ON \ - -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ - -G Ninja .. +cmake -S .. -B . \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DBUILD_PYTHON_INTERFACE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \ + -DCMAKE_SWIG_OUTDIR="$SP_DIR" \ + -DBUILD_LIBRARY=ON \ + -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \ + -G Ninja \ + "${CONFIG_ARGS}" # On some platforms (notably aarch64 with Drone) builds can fail due to # running out of memory. If this happens, try the build again; if it # still fails, restrict to one core. -ninja install -k 0 || ninja install -k 0 || ninja install -j 1 +ninja install -k 0 || ninja install -k 0 || ninja install -j ${CPU_COUNT} # Copy programs to bin -cd $PREFIX/bin -cp $SRC_DIR/bin/* . \ No newline at end of file +chmod 0755 $SRC_DIR/bin/* +cp -f $SRC_DIR/bin/* $PREFIX/bin From f5611f3fa2351e27d89e1a0a08fc188713ca9479 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:23:29 -0600 Subject: [PATCH 06/18] Delete recipes/tttrlib/LICENSE.txt --- recipes/tttrlib/LICENSE.txt | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 recipes/tttrlib/LICENSE.txt diff --git a/recipes/tttrlib/LICENSE.txt b/recipes/tttrlib/LICENSE.txt deleted file mode 100644 index 66fe31cc38cc1..0000000000000 --- a/recipes/tttrlib/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -BSD-3-Clause license -Copyright (c) 2015-2022, conda-forge contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. \ No newline at end of file From db042c3bd7db0f898b6607c9db3b0f9c1574988f Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:30:31 -0600 Subject: [PATCH 07/18] Update meta.yaml --- recipes/tttrlib/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 5c29d252d3b54..e172baf18d8b4 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -26,7 +26,7 @@ requirements: host: - llvm-openmp # [osx] - libgomp # [linux] - - libboost-cpp + - boost-cpp - hdf5 - python - pip From 78a75c8e7ebc4f6f697f7319fe234fd819d8e45d Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:49:56 -0600 Subject: [PATCH 08/18] Update build.sh --- recipes/tttrlib/build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh index 20ecefe97b93a..4d381437b4311 100755 --- a/recipes/tttrlib/build.sh +++ b/recipes/tttrlib/build.sh @@ -15,8 +15,6 @@ cmake -S .. -B . \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DBUILD_PYTHON_INTERFACE=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \ - -DCMAKE_SWIG_OUTDIR="$SP_DIR" \ -DBUILD_LIBRARY=ON \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \ -G Ninja \ From 2f0d38ca2dc1e0f234a0cf4876118d9537254300 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 5 Nov 2024 13:20:45 +0100 Subject: [PATCH 09/18] Build environment uses python/numpy --- recipes/tttrlib/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index e172baf18d8b4..b44412d22ee67 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -23,6 +23,8 @@ requirements: - make # [linux] - doxygen - swig <4.3.0 + - python + - numpy host: - llvm-openmp # [osx] - libgomp # [linux] From e23517a2b7c8fe0ecb644387b30c598c04c0e508 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 5 Nov 2024 13:21:45 +0100 Subject: [PATCH 10/18] Remove Windows app wrapper bioconda does not build for windows -> remove windows app wrapper. --- recipes/tttrlib/app_wrapper.c | 175 ---------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 recipes/tttrlib/app_wrapper.c diff --git a/recipes/tttrlib/app_wrapper.c b/recipes/tttrlib/app_wrapper.c deleted file mode 100644 index 326dceb63e296..0000000000000 --- a/recipes/tttrlib/app_wrapper.c +++ /dev/null @@ -1,175 +0,0 @@ -#include -#include -#include -#include - -/* - See: https://github.com/conda-forge/imp-feedstock/tree/main/recipe - IMP Python command line tools on Unix/Linux/Mac are typically named - without a .py extension (e.g. 'myapp' not 'myapp.py') and rely on a - #!/usr/bin/python line at the start of the file to tell the OS that - they are Python files. This doesn't work on Windows though, since - Windows relies on the file extension. - - To remedy this problem, we provide this wrapper. Compile with - cl app_wrapper.c shell32.lib - then copy the resulting app_wrapper.exe to myapp.exe and install in - the top-level Anaconda directory. Then a user should be able to simply - type 'myapp', and the right Python tool will be run. -*/ - -/* Get full path to fname in topdir */ -static char *get_new_full_path(const char *topdir, const char *fname) -{ - char *newpath = malloc(strlen(topdir) + strlen(fname) + 2); - strcpy(newpath, topdir); - strcat(newpath, "\\"); - strcat(newpath, fname); - return newpath; -} - -/* Get full path to this binary */ -static void get_full_path(char **dir, char **fname) -{ - char path[MAX_PATH * 2]; - size_t l; - char *ch; - DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2); - if (ret == 0) { - fprintf(stderr, "Failed to get executable name, code %d\n", GetLastError()); - exit(1); - } - l = strlen(path); - if (l > 4 && path[l - 4] == '.') { - /* Remove extension */ - path[l-4] = '\0'; - } - ch = strrchr(path, '\\'); - if (ch) { - *ch = '\0'; - *fname = strdup(ch + 1); - } else { - *fname = strdup(""); - } - *dir = strdup(path); -} - -/* Find where the parameters start in the command line (skip past the - executable name) */ -static char *find_param_start(char *cmdline) -{ - BOOL in_quote = FALSE, in_space = FALSE; - for (; *cmdline; cmdline++) { - /* Ignore spaces that are quoted */ - if (*cmdline == ' ' && !in_quote) { - in_space = TRUE; - } else if (*cmdline == '"') { - in_quote = !in_quote; - } - /* Return the first nonspace that follows a space */ - if (in_space && *cmdline != ' ') { - break; - } - } - return cmdline; -} - -/* Convert original parameters into those that python.exe wants (i.e. prepend - the name of the Python script) */ -static char *make_python_parameters(const char *orig_param, const char *binary) -{ - char *param = malloc(strlen(orig_param) + strlen(binary) + 4); - strcpy(param, "\""); - strcat(param, binary); - strcat(param, "\" "); - strcat(param, orig_param); - /*printf("python param %s\n", param);*/ - return param; -} - -/* Remove the last component of the path in place */ -static void remove_last_component(char *dir) -{ - char *pt; - if (!dir || !*dir) return; - /* Remove trailing slash if present */ - if (dir[strlen(dir)-1] == '\\') { - dir[strlen(dir)-1] = '\0'; - } - /* Remove everything after the last slash */ - pt = strrchr(dir, '\\'); - if (pt) { - *pt = '\0'; - } -} - -/* Get the full path to the Anaconda Python. */ -static char* get_python_binary(const char *topdir) -{ - char *python = malloc(strlen(topdir) + 12); - strcpy(python, topdir); - /* Remove last two components of the path (we are in Library/bin; python - is in the top-level directory) */ - remove_last_component(python); - remove_last_component(python); - strcat(python, "\\python.exe"); - return python; -} - -/* Run the given Python script, passing it the parameters we ourselves - were given. */ -static DWORD run_binary(const char *binary, const char *topdir) -{ - SHELLEXECUTEINFO si; - BOOL bResult; - char *param, *python = NULL; - param = strdup(GetCommandLine()); - - ZeroMemory(&si, sizeof(SHELLEXECUTEINFO)); - si.cbSize = sizeof(SHELLEXECUTEINFO); - /* Wait for the spawned process to finish, so that any output goes to the - console *before* the next command prompt */ - si.fMask = SEE_MASK_NO_CONSOLE | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS; - { - char *orig_param = param; - python = get_python_binary(topdir); - si.lpFile = python; - param = make_python_parameters(find_param_start(param), binary); - free(orig_param); - si.lpParameters = param; - } - si.nShow = SW_SHOWNA; - bResult = ShellExecuteEx(&si); - free(param); - free(python); - - if (bResult) { - if (si.hProcess) { - DWORD exit_code; - WaitForSingleObject(si.hProcess, INFINITE); - GetExitCodeProcess(si.hProcess, &exit_code); - CloseHandle(si.hProcess); - return exit_code; - } - } else { - fprintf(stderr, "Failed to start process, code %d\n", GetLastError()); - exit(1); - } - return 0; -} - -int main(int argc, char *argv[]) { - int is_python; - char *dir, *fname, *new_full_path; - DWORD return_code; - - get_full_path(&dir, &fname); - /*printf("%s, %s\n", dir, fname);*/ - new_full_path = get_new_full_path(dir, fname); - /*printf("new full path %s, %d\n", new_full_path, is_python);*/ - return_code = run_binary(new_full_path, dir); - free(dir); - free(fname); - free(new_full_path); - return return_code; -} From 9bf368a3b6f834b7cc7c106be92668d3a193e90b Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:59:13 -0600 Subject: [PATCH 11/18] Update meta.yaml --- recipes/tttrlib/meta.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index b44412d22ee67..7dc514b52a873 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -20,12 +20,10 @@ requirements: - pkg-config - cmake - ninja - - make # [linux] - - doxygen - - swig <4.3.0 - - python - - numpy + - make host: + - swig <4.3.0 + - doxygen - llvm-openmp # [osx] - libgomp # [linux] - boost-cpp @@ -35,6 +33,8 @@ requirements: - numpy run: - python + - llvm-openmp # [osx] + - libgomp # [linux] - tqdm - click - click-didyoumean From c239340823f3e311bd13859b37392e4a80f0c801 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 05:36:19 -0600 Subject: [PATCH 12/18] try swig in build section --- recipes/tttrlib/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 7dc514b52a873..4ee787a5aae00 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -21,8 +21,8 @@ requirements: - cmake - ninja - make + - swig host: - - swig <4.3.0 - doxygen - llvm-openmp # [osx] - libgomp # [linux] From 2158694d598e8d12616100fd0b648d0266affc42 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 05:50:26 -0600 Subject: [PATCH 13/18] pin swig <4.3.0 --- recipes/tttrlib/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 4ee787a5aae00..1a0c71a0c94c3 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -21,7 +21,7 @@ requirements: - cmake - ninja - make - - swig + - swig <4.3.0 host: - doxygen - llvm-openmp # [osx] From e35d14b1eb46b687fe38f0e4f12247c33e6f9947 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:36:14 -0600 Subject: [PATCH 14/18] Update meta.yaml --- recipes/tttrlib/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 1a0c71a0c94c3..7dc514b52a873 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -21,8 +21,8 @@ requirements: - cmake - ninja - make - - swig <4.3.0 host: + - swig <4.3.0 - doxygen - llvm-openmp # [osx] - libgomp # [linux] From 6f8c5936c7cfd4b9a592a549c5f0716f0d0be636 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:37:40 -0600 Subject: [PATCH 15/18] Update build.sh --- recipes/tttrlib/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh index 4d381437b4311..1d728a4c8de2c 100755 --- a/recipes/tttrlib/build.sh +++ b/recipes/tttrlib/build.sh @@ -17,6 +17,7 @@ cmake -S .. -B . \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_LIBRARY=ON \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \ + -DPython3_ROOT_DIR="${PYTHON}" \ -G Ninja \ "${CONFIG_ARGS}" From 4a0ae5fd5145fccd485e77035a977448da7c73ff Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:44:45 -0600 Subject: [PATCH 16/18] Update build.sh --- recipes/tttrlib/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh index 1d728a4c8de2c..d27bf1de117b3 100755 --- a/recipes/tttrlib/build.sh +++ b/recipes/tttrlib/build.sh @@ -12,12 +12,12 @@ fi cmake -S .. -B . \ -DCMAKE_CXX_COMPILER="${CXX}" \ - -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DBUILD_PYTHON_INTERFACE=ON \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_LIBRARY=ON \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \ - -DPython3_ROOT_DIR="${PYTHON}" \ + -DPython3_ROOT_DIR="${PREFIX}/bin" \ -G Ninja \ "${CONFIG_ARGS}" From ec34809c403bd32ec9f6b040173028da0f40d9a3 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:26:21 -0600 Subject: [PATCH 17/18] Update build.sh --- recipes/tttrlib/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/tttrlib/build.sh b/recipes/tttrlib/build.sh index d27bf1de117b3..b4013e98b4ad8 100755 --- a/recipes/tttrlib/build.sh +++ b/recipes/tttrlib/build.sh @@ -17,7 +17,7 @@ cmake -S .. -B . \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_LIBRARY=ON \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \ - -DPython3_ROOT_DIR="${PREFIX}/bin" \ + -DPython_ROOT_DIR="${PREFIX}/bin" \ -G Ninja \ "${CONFIG_ARGS}" From f000548c0d51a018ac89c2c292e5ff70608d8224 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:30:24 -0600 Subject: [PATCH 18/18] Update meta.yaml --- recipes/tttrlib/meta.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/tttrlib/meta.yaml b/recipes/tttrlib/meta.yaml index 7dc514b52a873..d9b4c5bcb9146 100644 --- a/recipes/tttrlib/meta.yaml +++ b/recipes/tttrlib/meta.yaml @@ -11,6 +11,7 @@ source: build: number: 0 + skip: True # [osx and py > 310] run_exports: '{{ pin_subpackage("tttrlib", max_pin="x.x") }}' requirements: @@ -35,10 +36,11 @@ requirements: - python - llvm-openmp # [osx] - libgomp # [linux] + - boost-cpp - tqdm - click - click-didyoumean - - {{ pin_compatible('numpy') }} + - numpy - scikit-image - matplotlib-base - hdf5