Skip to content

Commit

Permalink
Allow explicit use of system libraw (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullus authored Aug 10, 2023
1 parent 8523ab0 commit 65a8f73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import shutil
import sys
import zipfile
import re
import glob
from urllib.request import urlretrieve

Expand All @@ -21,6 +20,7 @@
# Note: Building GPL demosaic packs only works with libraw <= 0.18.
# See https://github.com/letmaik/rawpy/issues/72.
buildGPLCode = os.getenv('RAWPY_BUILD_GPL_CODE') == '1'
useSystemLibraw = os.getenv('RAWPY_USE_SYSTEM_LIBRAW') == '1'

# don't treat mingw as Windows (https://stackoverflow.com/a/51200002)
isWindows = os.name == 'nt' and 'GCC' not in sys.version
Expand Down Expand Up @@ -81,7 +81,7 @@ def use_pkg_config():
# on a configure script, or cmake or other build infrastructure.
# A possible work-around could be to statically link against libraw.

if isWindows or isMac:
if (isWindows or isMac) and not useSystemLibraw:
external_dir = os.path.abspath('external')
libraw_dir = os.path.join(external_dir, 'LibRaw')
cmake_build = os.path.join(external_dir, 'LibRaw-cmake', 'build')
Expand Down Expand Up @@ -251,7 +251,7 @@ def mac_libraw_compile():
# evil hack, check cmd line for relevant commands
# custom cmdclasses didn't work out in this case
cmdline = ''.join(sys.argv[1:])
needsCompile = any(s in cmdline for s in ['install', 'bdist', 'build_ext'])
needsCompile = any(s in cmdline for s in ['install', 'bdist', 'build_ext']) and not useSystemLibraw
if isWindows and needsCompile:
windows_libraw_compile()
package_data['rawpy'] = ['*.dll']
Expand Down

0 comments on commit 65a8f73

Please sign in to comment.