def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join(self.tmp_examples_dir, device.get_category(), device.get_camel_case_name()) tmp_examples_device_10_dir = os.path.join(self.tmp_examples_dir, device.get_category(), device.get_camel_case_name(), '10.0') if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) if not os.path.exists(tmp_examples_device_10_dir): os.makedirs(tmp_examples_device_10_dir) for example in common.find_device_examples(device, '^Example .*\.vi$'): shutil.copy(example[1], tmp_examples_device_dir) parts = os.path.split(example[1]) shutil.copy(os.path.join(parts[0], '10.0', parts[1]), tmp_examples_device_10_dir)
def generate(self, device): if not device.is_released(): return # Copy device examples examples_nodejs = common.find_device_examples(device, '^Example.*\.js') examples_browser = common.find_device_examples(device, '^Example.*\.html') dest_nodejs = os.path.join('/tmp/generator/npm/nodejs/examples/', device.get_category(), device.get_camel_case_name()) dest_browser = os.path.join('/tmp/generator/npm/browser/examples/', device.get_category(), device.get_camel_case_name()) if not os.path.exists(dest_nodejs): os.makedirs(dest_nodejs) if not os.path.exists(dest_browser): os.makedirs(dest_browser) for example in examples_nodejs: shutil.copy(example[1], dest_nodejs) for example in examples_browser: shutil.copy(example[1], dest_browser)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join(self.tmp_examples_dir, device.get_name().camel_abbrv + device.get_category().camel_abbrv) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) for example in common.find_device_examples(device, r'^example_.*\.go$'): shutil.copy(example[1], os.path.join(tmp_examples_device_dir, example[0]))
def generate(self, device): if not device.is_released(): return # Copy device examples examples = common.find_device_examples(device, '^Example.*\.pas$') dest = os.path.join('/tmp/generator/examples', device.get_category(), device.get_camel_case_name()) if not os.path.exists(dest): os.makedirs(dest) for example in examples: shutil.copy(example[1], dest)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join(self.tmp_examples_dir, device.get_category().camel, device.get_name().camel) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) for example in common.find_device_examples(device, '^Example.*\.vb$'): shutil.copy(example[1], tmp_examples_device_dir)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device = os.path.join(self.tmp_examples_dir, device.get_category().lower(), device.get_underscore_name()) if not os.path.exists(tmp_examples_device): os.makedirs(tmp_examples_device) for example in common.find_device_examples(device, '^example_.*\.py$'): shutil.copy(example[1], tmp_examples_device)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_nodejs_examples_device = os.path.join(self.tmp_nodejs_examples_dir, device.get_camel_case_category(), device.get_camel_case_name()) tmp_browser_examples_device = os.path.join(self.tmp_browser_examples_dir, device.get_camel_case_category(), device.get_camel_case_name()) if not os.path.exists(tmp_nodejs_examples_device): os.makedirs(tmp_nodejs_examples_device) if not os.path.exists(tmp_browser_examples_device): os.makedirs(tmp_browser_examples_device) for example in common.find_device_examples(device, '^Example.*\.js'): shutil.copy(example[1], tmp_nodejs_examples_device) for example in common.find_device_examples(device, '^Example.*\.html'): shutil.copy(example[1], tmp_browser_examples_device)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join( self.tmp_examples_dir, device.get_camel_case_category(), device.get_camel_case_name()) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) for example in common.find_device_examples(device, '^Example.*\.pas$'): shutil.copy(example[1], tmp_examples_device_dir)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_nodejs_examples_device = os.path.join(self.tmp_nodejs_examples_dir, device.get_category().camel, device.get_name().camel) tmp_browser_examples_device = os.path.join(self.tmp_browser_examples_dir, device.get_category().camel, device.get_name().camel) if not os.path.exists(tmp_nodejs_examples_device): os.makedirs(tmp_nodejs_examples_device) if not os.path.exists(tmp_browser_examples_device): os.makedirs(tmp_browser_examples_device) for example in common.find_device_examples(device, r'^Example.*\.js'): shutil.copy(example[1], tmp_nodejs_examples_device) for example in common.find_device_examples(device, r'^Example.*\.html'): shutil.copy(example[1], tmp_browser_examples_device)
def generate(self, device): if not device.is_released(): return # Copy device examples for flavor in ['matlab', 'octave']: tmp_examples_device_dir = os.path.join(self.tmp_flavor_examples_dir[flavor], device.get_underscore_category(), device.get_underscore_name()) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) for example in common.find_device_examples(device, '^{0}_example_.*\.m$'.format(flavor)): shutil.copy(example[1], tmp_examples_device_dir)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join( self.tmp_examples_dir, device.get_name().camel_abbrv + device.get_category().camel_abbrv) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) for example in common.find_device_examples(device, r'^example_.*\.go$'): shutil.copy(example[1], os.path.join(tmp_examples_device_dir, example[0]))
def generate(self, device): if not device.is_released(): return # Copy device examples for flavor in ['matlab', 'octave']: examples = common.find_device_examples( device, '^{0}_example_.*\.m$'.format(flavor)) dest = os.path.join( '/tmp/generator/jar/{0}/examples'.format(flavor), device.get_category().lower(), device.get_underscore_name()) if not os.path.exists(dest): os.makedirs(dest) for example in examples: shutil.copy(example[1], dest)
def generate(self, device): root_dir = self.get_root_dir() if not device.is_released() or device.get_device_identifier() == 17: return device_name = device.get_category().under + '_' + device.get_name( ).under # Collect device block definitions with open( os.path.join(self.get_bindings_dir(), device_name + '.block'), 'r') as f: self.block_content += f.read() # Collect device block generators with open( os.path.join(self.get_bindings_dir(), device_name + '.generator.javascript'), 'r') as f: self.generator_javascript_content += f.read() with open( os.path.join(self.get_bindings_dir(), device_name + '.generator.python'), 'r') as f: self.generator_python_content += f.read() # Collect device toolbox code with open( os.path.join(self.get_bindings_dir(), device_name + '.toolbox.part'), 'r') as f: if device.is_brick(): self.brick_toolbox_part[device_name] = f.read() else: self.bricklet_toolbox_part[device_name] = f.read() # Copy device examples tmp_examples_device = os.path.join(self.tmp_examples_dir, device.get_category().under, device.get_name().under) if not os.path.exists(tmp_examples_device): os.makedirs(tmp_examples_device) for example in common.find_device_examples(device, r'^example_.*\.tvpl$'): shutil.copy(example[1], tmp_examples_device)
def generate(self, device): if not device.is_released(): return # Copy device examples examples = common.find_device_examples(device, '^Example .*\.vi$') dest = os.path.join('/tmp/generator/dll/examples', device.get_category(), device.get_camel_case_name()) dest_10 = os.path.join('/tmp/generator/dll/examples', device.get_category(), device.get_camel_case_name(), '10.0') if not os.path.exists(dest): os.makedirs(dest) if not os.path.exists(dest_10): os.makedirs(dest_10) for example in examples: shutil.copy(example[1], dest) parts = os.path.split(example[1]) shutil.copy(os.path.join(parts[0], '10.0', parts[1]), dest_10)
def generate(self, device): if not device.is_released(): return # Copy device examples tmp_examples_device_dir = os.path.join( self.tmp_examples_dir, device.get_camel_case_category(), device.get_camel_case_name() ) tmp_examples_device_10_dir = os.path.join( self.tmp_examples_dir, device.get_camel_case_category(), device.get_camel_case_name(), "10.0" ) if not os.path.exists(tmp_examples_device_dir): os.makedirs(tmp_examples_device_dir) if not os.path.exists(tmp_examples_device_10_dir): os.makedirs(tmp_examples_device_10_dir) for example in common.find_device_examples(device, "^Example .*\.vi$"): shutil.copy(example[1], tmp_examples_device_dir) parts = os.path.split(example[1]) shutil.copy(os.path.join(parts[0], "10.0", parts[1]), tmp_examples_device_10_dir)
def generate(self, device): root_dir = self.get_bindings_root_directory() if not device.is_released() or device.get_device_identifier() == 17: return device_name = device.get_underscore_category() + '_' + device.get_underscore_name() # Collect device block definitions with open(os.path.join(root_dir, 'bindings', device_name + '.block'), 'rb') as f: self.block_content += f.read() # Collect device block generators with open(os.path.join(root_dir, 'bindings', device_name + '.generator.javascript'), 'rb') as f: self.generator_javascript_content += f.read() with open(os.path.join(root_dir, 'bindings', device_name + '.generator.python'), 'rb') as f: self.generator_python_content += f.read() # Collect device toolbox code with open(os.path.join(root_dir, 'bindings', device_name + '.toolbox.part'), 'rb') as f: if device.is_brick(): self.brick_toolbox_part[device_name] = f.read() else: self.bricklet_toolbox_part[device_name] = f.read() # Copy device examples tmp_examples_device = os.path.join(self.tmp_examples_dir, device.get_underscore_category(), device.get_underscore_name()) if not os.path.exists(tmp_examples_device): os.makedirs(tmp_examples_device) for example in common.find_device_examples(device, '^example_.*\.tvpl$'): shutil.copy(example[1], tmp_examples_device)