Skip to content

Commit

Permalink
Update patch_match.py for win
Browse files Browse the repository at this point in the history
  • Loading branch information
lkwq007 committed Oct 2, 2022
1 parent 4a102d5 commit e7aca56
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions patch_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
import numpy as np
from PIL import Image

try:
# If the Jacinle library (https://github.com/vacancy/Jacinle) is present, use its auto_travis feature.
from jacinle.jit.cext import auto_travis
auto_travis(__file__, required_files=['*.so'])
except ImportError as e:

import os
if os.name!="nt":
# Otherwise, fall back to the subprocess.
import subprocess
print('Compiling and loading c extensions from "{}".'.format(osp.realpath(osp.dirname(__file__))))
subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
# subprocess.check_call(['./travis.sh'], cwd=osp.dirname(__file__))
subprocess.check_call("make clean && make", cwd=osp.dirname(__file__), shell=True)


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


PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.so'))
if os.name!="nt":
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.so'))
else:
if not os.path.exists(osp.join(osp.dirname(__file__), 'libpatchmatch.dll')):
pass
PMLIB = ctypes.CDLL(osp.join(osp.dirname(__file__), 'libpatchmatch.dll'))

PMLIB.PM_set_random_seed.argtypes = [ctypes.c_uint]
PMLIB.PM_set_verbose.argtypes = [ctypes.c_int]
Expand Down

0 comments on commit e7aca56

Please sign in to comment.