log.info('Installing Cli dependencies') path = create_temporary_copy("../../cli/requirements-generic.txt", "cli-requirements.txt") with fileinput.FileInput(path, inplace=True) as f: for l in f: print(l.replace("torch==1.1.0", torch_version()), end='') r = subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', path]) os.remove(path) if r.returncode != 0: log.fatal("Cli dependencies installation failed") exit(1) log.info('Cli dependencies successfully installed') ## Gui dependencies log.info('Installing Gui Dependencies') with cd("../../gui"): r = subprocess.run( ['yarn', 'install'], shell=True) if detected_os == OS.WIN else subprocess.run( ['yarn', 'install']) if r.returncode != 0: log.fatal("Gui Dependencies installation failed") exit(1) log.info('Gui Dependencies successfully installed') log.info('Installation completed!') log.info( 'Now you can run the build.py script to compile the project and get an easy-to-use binary' )
'--onedir', '--name=cli', '--distpath=../../dist', 'main.py', ] if detected_os == OS.LINUX: return pyinstaller_args if detected_os == OS.MAC: return pyinstaller_args if detected_os == OS.WIN: pyinstaller_args.extend( ['--add-binary=../third/msvcp/msvcp140.dll;.']) return pyinstaller_args log.info('Building Cli') with cd("../../cli"): cmd = [sys.executable, '-m', 'PyInstaller'] + pyinstaller_args() log.debug(cmd) r = subprocess.run(cmd) if r.returncode != 0: log.fatal("Cli building failed") exit(1) log.info('Cli successfully built') ## Build Gui if do_all or args.gui: log.info('Building Gui') with cd("../../gui"): r = subprocess.run( ['yarn', 'build'],
'--specpath=.', '-y', '--onedir', '--name=cli', 'main.py', ] if detected_os == OS.LINUX: return pyinstaller_args if detected_os == OS.MAC: return pyinstaller_args if detected_os == OS.WIN: pyinstaller_args.extend(['--add-binary=./third/msvcp/msvcp140.dll;.']) return pyinstaller_args log.info('Building Cli') with cd("../.."): cmd = [sys.executable, '-m', 'PyInstaller'] + pyinstaller_args() log.debug(cmd) r = subprocess.run(cmd) if r.returncode != 0: log.fatal("Cli build failed") exit(1) log.info('Cli successfully built') log.info('Build completed!') log.info( 'It should have generated a folder called dist/, inside you will find the final project files that you can share with everyone!' ) log.info('Enjoy and remember to respect the License!')