def _write_script_windows(self, tf, name, contents): self._write_script_unix(tf, name+'-script.py', contents) arch = 'x64' if self.bitness == '64' else 'x86' src = win_cli_launchers.find_exe(arch) dst = self.scripts_path() + name + '.exe' tf.add(src, arcname=dst) self.record_file(dst) with open(src, 'rb') as f: self._py_record_file(dst, f.read())
def prepare_bin_directory(target, commands, bitness=32): exe_src = win_cli_launchers.find_exe('x64' if bitness == 64 else 'x86') for name, command in commands.items(): shutil.copy(exe_src, str(target / (name+'.exe'))) specified_preamble = command.get('extra_preamble', None) if isinstance(specified_preamble, text_types): # Filename extra_preamble = io.open(specified_preamble, encoding='utf-8') elif specified_preamble is None: extra_preamble = io.StringIO() # Empty else: # Passed a StringIO or similar object extra_preamble = specified_preamble module, func = command['entry_point'].split(':') with (target / (name+'-script.py')).open('w') as f: f.write(SCRIPT_TEMPLATE.format( module=module, func=func, extra_preamble=extra_preamble.read().rstrip(), ))
def prepare_bin_directory(target, commands, bitness=32): exe_src = win_cli_launchers.find_exe('x64' if bitness == 64 else 'x86') for name, command in commands.items(): shutil.copy(exe_src, str(target / (name + '.exe'))) specified_preamble = command.get('extra_preamble', None) if isinstance(specified_preamble, text_types): # Filename extra_preamble = io.open(specified_preamble, encoding='utf-8') elif specified_preamble is None: extra_preamble = io.StringIO() # Empty else: # Passed a StringIO or similar object extra_preamble = specified_preamble module, func = command['entry_point'].split(':') with (target / (name + '-script.py')).open('w') as f: f.write( SCRIPT_TEMPLATE.format( module=module, func=func, extra_preamble=extra_preamble.read().rstrip(), ))