Skip to content

Commit 65a8f73

Browse files
authored
Allow explicit use of system libraw (#209)
1 parent 8523ab0 commit 65a8f73

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import shutil
66
import sys
77
import zipfile
8-
import re
98
import glob
109
from urllib.request import urlretrieve
1110

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

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

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

0 commit comments

Comments
 (0)