Skip to content

Commit

Permalink
Merge pull request conda-forge#17766 from goanpeca/add-stardist
Browse files Browse the repository at this point in the history
Add stardist recipe
  • Loading branch information
jaimergp authored Apr 7, 2022
2 parents e813eea + e4bb2c6 commit 04d3174
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
24 changes: 24 additions & 0 deletions recipes/stardist/clipper.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Boost Software License - Version 1.0 - August 17th, 2003
http://www.boost.org/LICENSE_1_0.txt

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
62 changes: 62 additions & 0 deletions recipes/stardist/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{% set name = "stardist" %}
{% set version = "0.8.1" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/stardist/stardist/archive/refs/tags/{{ version }}.tar.gz
sha256: 3d1049b2a136c44c619a858de9de67ffda96d2c51d07c1fcd8a958e87cc1b7e0
patches:
- setup.patch # [osx]

build:
script: {{ PYTHON }} -m pip install . -vv
number: 0

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- make
- llvm-openmp # [osx]
- libgomp # [linux]
host:
- numpy
- pip
- python
- setuptools
run:
- csbdeep >=0.6.3
- numba
- python
- scikit-image
- imageio
- {{ pin_compatible('numpy') }}

test:
imports:
- stardist
commands:
- pip list
# - pip check
requires:
- pip

about:
home: https://github.com/stardist/stardist
summary: StarDist
license: MIT
license_file:
- LICENSE.txt
- stardist/lib/external/qhull_src/COPYING.txt
# - stardist/lib/external/clipper # MISSING in repo!
- clipper.LICENSE.txt
# - stardist/lib/external/nanoflann # MISSING in repo!
- nanoflann.LICENSE.txt

extra:
recipe-maintainers:
- goanpeca
- jaimergp
28 changes: 28 additions & 0 deletions recipes/stardist/nanoflann.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Software License Agreement (BSD License)

Copyright 2008-2009 Marius Muja ([email protected]). All rights reserved.
Copyright 2008-2009 David G. Lowe ([email protected]). All rights reserved.
Copyright 2011 Jose L. Blanco ([email protected]). All rights reserved.

THE BSD LICENSE

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.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
37 changes: 37 additions & 0 deletions recipes/stardist/setup.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- setup.py 2022-04-06 13:34:29.000000000 +0200
+++ setup.py 2022-04-06 13:36:38.000000000 +0200
@@ -22,6 +22,24 @@
if compiler not in self.openmp_compile_args:
compiler = '*'

+ ## QHull has a mix of C and C++ source files
+ ## Setuptools will apply the same flags to all files
+ ## GCC warns about passing -std=c++11 for C files
+ ## but Clang errors out
+ ## We need to patch the responsible method to filter
+ ## the passed flags depending on the extension
+
+ # 1. keep a ref to the original _compile method
+ original__compile = self.compiler._compile
+ # 2. create a patched variant for the _compile method
+ def patched__compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
+ # remove c++ specific options for C files
+ if src.endswith('.c'):
+ extra_postargs = [arg for arg in extra_postargs if not arg.startswith("-std")]
+ return original__compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
+ # 3. monkey patch the method
+ self.compiler._compile = patched__compile
+
_extra_compile_args = list(ext.extra_compile_args)
_extra_link_args = list(ext.extra_link_args)
try:
@@ -33,6 +51,9 @@
ext.extra_compile_args = _extra_compile_args
ext.extra_link_args = _extra_link_args
super(build_ext_openmp, self).build_extension(ext)
+ finally:
+ # 4. restore to original, just in case
+ self.compiler._compile = original__compile


#------------------------------------------------------------------------------------

0 comments on commit 04d3174

Please sign in to comment.