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)
def clone_database(dbname): from hscom import params from hscom import helpers as util from os.path import join work_dir = params.get_workdir() dir1 = join(work_dir, dbname) dir2 = join(work_dir, dbname + 'Clone') util.delete(dir2) util.copy_all(dir1, dir2, '*') util.copy_all(join(dir1, 'images'), join(dir2, 'images'), '*') util.copy_all(join(dir1, '_hsdb'), join(dir2, '_hsdb'), '*') return dbname + 'Clone'
def clean(): assert exists('setup.py'), 'must be run in hotspotter directory' assert exists('../hotspotter/setup.py'), 'must be run in hotspotter directory' assert exists('../hotspotter/hotspotter'), 'must be run in hotspotter directory' assert exists('_setup'), 'must be run in hotspotter directory' cwd = normpath(realpath(dirname(__file__))) print('[setup] Current working directory: %r' % cwd) helpers.remove_files_in_dir(cwd, '*.pyc', recursive=True) helpers.remove_files_in_dir(cwd, '*.prof', recursive=True) helpers.remove_files_in_dir(cwd, '*.prof.txt', recursive=True) helpers.remove_files_in_dir(cwd, '*.lprof', recursive=True) helpers.remove_files_in_dir(cwd, 'HotSpotterApp.*.pkg', recursive=False) helpers.remove_files_in_dir(cwd + '/hotspotter', '*.so', recursive=False) helpers.remove_files_in_dir(cwd + '/hotspotter', '*.c', recursive=False) helpers.delete(join(cwd, 'dist')) helpers.delete(join(cwd, 'build')) helpers.delete(join(cwd, "'")) # idk where this file comes from
def clean(): assert exists('setup.py'), 'must be run in hotspotter directory' assert exists( '../hotspotter/setup.py'), 'must be run in hotspotter directory' assert exists( '../hotspotter/hotspotter'), 'must be run in hotspotter directory' assert exists('_setup'), 'must be run in hotspotter directory' cwd = normpath(realpath(dirname(__file__))) print('[setup] Current working directory: %r' % cwd) helpers.remove_files_in_dir(cwd, '*.pyc', recursive=True) helpers.remove_files_in_dir(cwd, '*.prof', recursive=True) helpers.remove_files_in_dir(cwd, '*.prof.txt', recursive=True) helpers.remove_files_in_dir(cwd, '*.lprof', recursive=True) helpers.remove_files_in_dir(cwd, 'HotSpotterApp.*.pkg', recursive=False) helpers.remove_files_in_dir(cwd + '/hotspotter', '*.so', recursive=False) helpers.remove_files_in_dir(cwd + '/hotspotter', '*.c', recursive=False) helpers.delete(join(cwd, 'dist')) helpers.delete(join(cwd, 'build')) helpers.delete(join(cwd, "'")) # idk where this file comes from
#!/usr/bin/env python # TODO: ADD COPYRIGHT TAG from __future__ import print_function, division from hscom import helpers as util from hsdev import test_api from hsgui import guitools from os.path import join import multiprocessing if __name__ == '__main__': multiprocessing.freeze_support() app, is_root = guitools.init_qtapp() hs, back = test_api.main(defaultdb=None, preload=False, app=app) # Build the test db name work_dir = back.get_work_directory() new_dbname = 'scripted_test_db' new_dbdir = join(work_dir, new_dbname) # Remove it if it exists util.delete(new_dbdir) back.new_database(new_dbdir) back.import_images_from_file() guitools.run_main_loop(app, is_root, back, frequency=100)