|
5 | 5 | import shutil |
6 | 6 | import sys |
7 | 7 | import zipfile |
8 | | -import re |
9 | 8 | import glob |
10 | 9 | from urllib.request import urlretrieve |
11 | 10 |
|
|
21 | 20 | # Note: Building GPL demosaic packs only works with libraw <= 0.18. |
22 | 21 | # See https://github.com/letmaik/rawpy/issues/72. |
23 | 22 | buildGPLCode = os.getenv('RAWPY_BUILD_GPL_CODE') == '1' |
| 23 | +useSystemLibraw = os.getenv('RAWPY_USE_SYSTEM_LIBRAW') == '1' |
24 | 24 |
|
25 | 25 | # don't treat mingw as Windows (https://stackoverflow.com/a/51200002) |
26 | 26 | isWindows = os.name == 'nt' and 'GCC' not in sys.version |
@@ -81,7 +81,7 @@ def use_pkg_config(): |
81 | 81 | # on a configure script, or cmake or other build infrastructure. |
82 | 82 | # A possible work-around could be to statically link against libraw. |
83 | 83 |
|
84 | | -if isWindows or isMac: |
| 84 | +if (isWindows or isMac) and not useSystemLibraw: |
85 | 85 | external_dir = os.path.abspath('external') |
86 | 86 | libraw_dir = os.path.join(external_dir, 'LibRaw') |
87 | 87 | cmake_build = os.path.join(external_dir, 'LibRaw-cmake', 'build') |
@@ -251,7 +251,7 @@ def mac_libraw_compile(): |
251 | 251 | # evil hack, check cmd line for relevant commands |
252 | 252 | # custom cmdclasses didn't work out in this case |
253 | 253 | 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 |
255 | 255 | if isWindows and needsCompile: |
256 | 256 | windows_libraw_compile() |
257 | 257 | package_data['rawpy'] = ['*.dll'] |
|
0 commit comments