Skip to content

Commit 620da0a

Browse files
committed
Including compile in try statement
1 parent 77438bf commit 620da0a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

patchmatch/patch_match.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ def download_url_to_file(url, dst, hash_prefix=None, progress=True):
123123
if lib_name.startswith('libpatchmatch_'):
124124
pypatchmatch_lib = lib_name
125125

126+
try:
127+
# Compile if we didn't find a platform-compatible version (and it's not compiled already)
128+
if pypatchmatch_lib is None:
129+
pypatchmatch_lib = 'libpatchmatch.so'
130+
if not os.path.exists(osp.join(osp.dirname(__file__), pypatchmatch_lib)):
131+
import subprocess
132+
print('Compiling and loading c extensions from "{}".'.format(osp.realpath(osp.dirname(__file__))))
133+
# subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
134+
subprocess.check_call("make clean && make", cwd=osp.dirname(__file__), shell=True)
126135

127-
# Compile if we didn't find a platform-compatible version (and it's not compiled already)
128-
if pypatchmatch_lib is None:
129-
pypatchmatch_lib = 'libpatchmatch.so'
130-
if not os.path.exists(osp.join(osp.dirname(__file__), pypatchmatch_lib)):
131-
import subprocess
132-
print('Compiling and loading c extensions from "{}".'.format(osp.realpath(osp.dirname(__file__))))
133-
# subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
134-
subprocess.check_call("make clean && make", cwd=osp.dirname(__file__), shell=True)
135136

136-
try:
137137
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), pypatchmatch_lib))
138138
patchmatch_available = True
139139

0 commit comments

Comments
 (0)