def build_pyinstaller(): cwd = normpath(realpath(dirname(__file__))) print('[setup] Current working directory: %r' % cwd) build_dir = join(cwd, 'build') dist_dir = join(cwd, 'dist') helpers.delete(dist_dir) assert exists('setup.py'), 'must be run in hotspotter source directory' assert exists('../hotspotter/setup.py'), 'must be run in hotspotter source directory' assert exists('../hotspotter/hotspotter'), 'must be run in hotspotter source directory' assert exists('_setup'), 'must be run in hotspotter source directory' # Remove old files for rmdir in [build_dir, dist_dir]: if exists(rmdir): helpers.remove_file(rmdir) # Run the pyinstaller command (does all the work) _cmd('pyinstaller _setup/pyinstaller-hotspotter.spec') # Perform some post processing steps on the mac if sys.platform == 'darwin' and exists("dist/HotSpotter.app/Contents/"): copy_list = [ 'hsicon.icns', 'Info.plist' ] srcdir = '_setup' dstdir = 'dist/HotSpotter.app/Contents/Resources/' for srcname, dstname in copy_list: src = join(srcdir, srcname) dst = join(dstdir, dstname) helpers.copy(src, dst)
def build_pyinstaller(): cwd = normpath(realpath(dirname(__file__))) print('[setup] Current working directory: %r' % cwd) build_dir = join(cwd, 'build') dist_dir = join(cwd, 'dist') helpers.delete(dist_dir) assert exists('setup.py'), 'must be run in hotspotter source directory' assert exists( '../hotspotter/setup.py'), 'must be run in hotspotter source directory' assert exists('../hotspotter/hotspotter' ), 'must be run in hotspotter source directory' assert exists('_setup'), 'must be run in hotspotter source directory' # Remove old files for rmdir in [build_dir, dist_dir]: if exists(rmdir): helpers.remove_file(rmdir) # Run the pyinstaller command (does all the work) _cmd('pyinstaller _setup/pyinstaller-hotspotter.spec') # Perform some post processing steps on the mac if sys.platform == 'darwin' and exists("dist/HotSpotter.app/Contents/"): copy_list = ['hsicon.icns', 'Info.plist'] srcdir = '_setup' dstdir = 'dist/HotSpotter.app/Contents/Resources/' for srcname, dstname in copy_list: src = join(srcdir, srcname) dst = join(dstdir, dstname) helpers.copy(src, dst)
# Localize hessian affine code code_dir = join(expanduser('~'), 'code') hsdir = join(code_dir, 'hotspotter') extern_dir = join(hsdir, 'hstpl', 'extern_feat') hesaffsrc_dir = join(code_dir, 'hesaff') hesaffbuild_dir = join(hesaffsrc_dir, 'build') built_files = { 'linux2': ['hesaffexe', 'hesaffexe.ln', 'libhesaff.so'], 'win32': ['hesaffexe.exe', 'libhesaff.dll'], 'darwin': ['hesaffexe', 'hesaffexe.mac', 'libhesaff.dylib']}[sys.platform] filemap = { hesaffbuild_dir: built_files, hesaffsrc_dir: ['pyhesaff.py', 'ellipse.py', 'pyhesaffexe.py', 'ctypes_interface.py'], } for srcdir, fname_list in filemap.iteritems(): for fname in fname_list: src = join(srcdir, fname) dest = join(extern_dir, fname) try: helpers.copy(src, dest) except Exception as ex: print(ex) #raw_input('[_tpl/localize] Press enter to continue')
code_dir = join(expanduser('~'), 'code') hsdir = join(code_dir, 'hotspotter') extern_dir = join(hsdir, 'hstpl', 'extern_feat') hesaffsrc_dir = join(code_dir, 'hesaff') hesaffbuild_dir = join(hesaffsrc_dir, 'build') built_files = { 'linux2': ['hesaffexe', 'hesaffexe.ln', 'libhesaff.so'], 'win32': ['hesaffexe.exe', 'libhesaff.dll'], 'darwin': ['hesaffexe', 'hesaffexe.mac', 'libhesaff.dylib'] }[sys.platform] filemap = { hesaffbuild_dir: built_files, hesaffsrc_dir: ['pyhesaff.py', 'ellipse.py', 'pyhesaffexe.py', 'ctypes_interface.py'], } for srcdir, fname_list in filemap.iteritems(): for fname in fname_list: src = join(srcdir, fname) dest = join(extern_dir, fname) try: helpers.copy(src, dest) except Exception as ex: print(ex) #raw_input('[_tpl/localize] Press enter to continue')