Skip to content

Commit e7aca56

Browse files
committed
Update patch_match.py for win
1 parent 4a102d5 commit e7aca56

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

patch_match.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
import numpy as np
1515
from PIL import Image
1616

17-
try:
18-
# If the Jacinle library (https://github.com/vacancy/Jacinle) is present, use its auto_travis feature.
19-
from jacinle.jit.cext import auto_travis
20-
auto_travis(__file__, required_files=['*.so'])
21-
except ImportError as e:
17+
18+
import os
19+
if os.name!="nt":
2220
# Otherwise, fall back to the subprocess.
2321
import subprocess
2422
print('Compiling and loading c extensions from "{}".'.format(osp.realpath(osp.dirname(__file__))))
25-
subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
23+
# subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
24+
subprocess.check_call("make clean && make", cwd=osp.dirname(__file__), shell=True)
2625

2726

2827
__all__ = ['set_random_seed', 'set_verbose', 'inpaint', 'inpaint_regularity']
@@ -43,8 +42,12 @@ class CMatT(ctypes.Structure):
4342
('dtype', ctypes.c_int)
4443
]
4544

46-
47-
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.so'))
45+
if os.name!="nt":
46+
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.so'))
47+
else:
48+
if not os.path.exists(osp.join(osp.dirname(__file__), 'libpatchmatch.dll')):
49+
pass
50+
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.dll'))
4851

4952
PMLIB.PM_set_random_seed.argtypes = [ctypes.c_uint]
5053
PMLIB.PM_set_verbose.argtypes = [ctypes.c_int]

0 commit comments

Comments
 (0)