Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
        tmp_examples_device_10_dir = os.path.join(self.tmp_examples_dir,
                                                  device.get_category().camel,
                                                  device.get_name().camel,
                                                  '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)
Ejemplo n.º 3
0
    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]))
Ejemplo n.º 4
0
    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().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_.*\.rb$'):
            shutil.copy(example[1], tmp_examples_device)
Ejemplo n.º 5
0
    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_category().under,
                                                   device.get_name().under)

            if not os.path.exists(tmp_examples_device_dir):
                os.makedirs(tmp_examples_device_dir)

            for example in common.find_device_examples(device, r'^{0}_example_.*\.m$'.format(flavor)):
                shutil.copy(example[1], tmp_examples_device_dir)
Ejemplo n.º 6
0
    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()
            elif device.is_bricklet():
                self.bricklet_toolbox_part[device_name] = f.read()
            else:
                assert False

        # 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)
Ejemplo n.º 7
0
    def generate(self, device):
        if self.get_config_name().space != 'Tinkerforge':
            return
        if not device.is_released():
            return

        # Copy device examples
        tmp_examples_device_dir = os.path.join(
            self.tmp_examples_dir,
            device.get_name().under + "_" + device.get_category().under)

        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_.*\.rs$'):
            shutil.copy(example[1],
                        os.path.join(tmp_examples_device_dir, example[0]))