示例#1
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.rs$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        for filename in self.get_released_files():
            path = os.path.join(self.get_bindings_dir(), filename)
            shutil.copy(path, self.tmp_bindings_dir)

        source_files = [
            'base58.rs',
            'converting_receiver.rs',
            'converting_callback_receiver.rs',
            'converting_high_level_callback_receiver.rs',
            'device.rs',
            'ip_connection.rs',
            'low_level_traits.rs',
        ]
        bindings_files = ['mod.rs']
        bindings_source_files = ['lib.rs', 'byte_converter.rs']
        bindings_top_level_files = ['Cargo.toml']
        top_level_files = [
            '.gitignore', 'rustfmt.toml', 'changelog.txt', 'readme.txt',
            'readme.md', 'LICENSE-APACHE', 'LICENSE-CC0', 'LICENSE-MIT'
        ]

        if self.get_config_name().space == 'Tinkerforge':
            for f in top_level_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_dir)
            for f in source_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_source_dir)
            for f in bindings_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f),
                            self.tmp_bindings_dir)
            for f in bindings_source_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f),
                            self.tmp_source_dir)
            for f in bindings_top_level_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f),
                            self.tmp_dir)
        else:
            shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'),
                        self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'custom.txt'),
                        os.path.join(self.tmp_dir, 'readme.txt'))

        p = subprocess.Popen(["cargo", "fmt"],
                             cwd=self.tmp_dir,
                             stdout=subprocess.PIPE)
        out, err = p.communicate()  #block until cargo fmt has finished
        if out != "" or err is not None:
            print("Got the following output from cargo fmt:")
            print(out)
            print(err)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#2
0
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.pas$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/bindings')

        shutil.copy(os.path.join(root, 'Base58.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'BlockingQueue.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'DeviceBase.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'Device.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'IPConnection.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'LEConverter.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'TimedSemaphore.pas'), '/tmp/generator/bindings')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/')

        # Make zip
        version = common.get_changelog_version(root)
        common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example_.*\.py$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.py'), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)

        # Make __init__.py
        file(os.path.join(self.tmp_source_tinkerforge_dir, '__init__.py'), 'wb').write(' ')

        # Make setup.py
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, 'setup.py.template'),
                                   os.path.join(self.tmp_source_dir, 'setup.py'),
                                   {'<<VERSION>>': '.'.join(version)})

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#4
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example_.*\.c$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename),
                        self.tmp_source_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.c'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'ip_connection.h'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'Makefile'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make zip
        version = common.get_changelog_version(root_dir)

        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
示例#5
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example_.*\.rb$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_lib_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.rb'),             self.tmp_source_lib_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make version.rb
        version = common.get_changelog_version(root_dir)
        file(os.path.join(self.tmp_source_lib_tinkerforge_dir, 'version.rb'), 'wb').write("""
module Tinkerforge
  VERSION = '{0}.{1}.{2}'
end
""".format(*version))

        # Make tinkerforge.rb
        file(os.path.join(self.tmp_source_lib_dir, 'tinkerforge.rb'), 'wb').write("""
require 'tinkerforge/version'

module Tinkerforge
end
""")

        # Make tinkerforge.gemspec
        tmp_gemspec = os.path.join(self.tmp_source_dir, 'tinkerforge.gemspec')

        common.specialize_template(os.path.join(root_dir, 'tinkerforge.gemspec.template'),
                                   tmp_gemspec,
                                   {'<<VERSION>>': '.'.join(version)})

        # Make gem
        with common.ChangedDirectory(self.tmp_source_dir):
            args = ['/usr/bin/gem',
                    'build',
                    'tinkerforge.gemspec']

            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove build stuff
        tmp_gem = os.path.join(self.tmp_source_dir, 'tinkerforge-{0}.{1}.{2}.gem'.format(*version))

        os.remove(tmp_gemspec)
        shutil.copy(tmp_gem, root_dir)
        shutil.move(tmp_gem, os.path.join(self.tmp_dir, 'tinkerforge.gem'))
        shutil.move(os.path.join(self.tmp_source_lib_dir, 'tinkerforge.rb'), self.tmp_source_dir)
        shutil.move(self.tmp_source_lib_tinkerforge_dir, os.path.join(self.tmp_source_dir, 'tinkerforge'))
        shutil.rmtree(self.tmp_source_lib_dir)

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#6
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.c$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme and merge symbols
        with open(os.path.join(root_dir, 'ip_connection.symbols'), 'r') as f:
            symbols = 'EXPORTS\n' + f.read()

        for filename in self.get_released_files():
            path = os.path.join(self.get_bindings_dir(), filename)

            if path.endswith('.symbols'):
                with open(path, 'r') as f:
                    symbols += f.read()
            else:
                shutil.copy(path, self.tmp_source_dir)

        with open(os.path.join(self.tmp_source_dir, 'tinkerforge.def'), 'w') as f:
            f.write(symbols)

        shutil.copy(os.path.join(root_dir, 'ip_connection.c'),              self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'ip_connection.h'),              self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'Makefile'),                     self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make zip
        self.create_zip_file(self.tmp_dir)
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.pas$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir)

        shutil.copy(os.path.join(root_dir, 'Base58.pas'),                   self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'),            self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'),               self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'Device.pas'),                   self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.pas'),             self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'LEConverter.pas'),              self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'),           self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'SHAone.pas'),                   self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'),              self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make Makefile.fpc
        version = common.get_changelog_version(root_dir)
        units = sorted([filename.replace('.pas', '') for filename in os.listdir(self.tmp_source_dir)])

        common.specialize_template(os.path.join(root_dir, 'Makefile.fpc.template'),
                                   os.path.join(self.tmp_source_dir, 'Makefile.fpc'),
                                   {'<<UNITS>>': ' '.join(units),
                                    '<<VERSION>>': '.'.join(version)})

        # Make zip
        self.create_zip_file(self.tmp_dir)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^example_.*\.c$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename),
                        '/tmp/generator/source')

        shutil.copy(os.path.join(root, 'ip_connection.c'),
                    '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'ip_connection.h'),
                    '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'Makefile'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator')

        # Make zip
        version = common.get_changelog_version(root)
        common.make_zip(self.get_bindings_name(), '/tmp/generator', root,
                        version)
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.vb$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                      self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'Visual Basic .NET',
                                    '<<VERSION>>': '.'.join(version)})

        # Make dll
        with common.ChangedDirectory(self.tmp_dir):
            common.execute(['/usr/bin/gmcs',
                            '/optimize',
                            '/target:library',
                            '/out:' + os.path.join(self.tmp_dir, 'Tinkerforge.dll'),
                            '/doc:' + os.path.join(self.tmp_dir, 'Tinkerforge.xml'),
                            os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')])

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#10
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.rs$'):
                shutil.copy(example[1], self.tmp_examples_dir)


        for filename in self.get_released_files():
            path = os.path.join(self.get_bindings_dir(), filename)
            shutil.copy(path, self.tmp_bindings_dir)

        source_files = [
            'base58.rs',
            'converting_receiver.rs',
            'converting_callback_receiver.rs',
            'converting_high_level_callback_receiver.rs',
            'device.rs',
            'ip_connection.rs',
            'low_level_traits.rs',
        ]
        bindings_files = ['mod.rs']
        bindings_source_files = ['lib.rs', 'byte_converter.rs']
        bindings_top_level_files = ['Cargo.toml']
        top_level_files = [
            '.gitignore',
            'rustfmt.toml',
            'changelog.txt',
            'readme.txt',
            'readme.md',
            'LICENSE-APACHE',
            'LICENSE-CC0',
            'LICENSE-MIT'
        ]

        if self.get_config_name().space == 'Tinkerforge':
            for f in top_level_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_dir)
            for f in source_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_source_dir)
            for f in bindings_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_bindings_dir)
            for f in bindings_source_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_source_dir)
            for f in bindings_top_level_files:
                shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_dir)
        else:
            shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'),   self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'custom.txt'),                   os.path.join(self.tmp_dir, 'readme.txt'))

        p = subprocess.Popen(["cargo", "fmt"], cwd=self.tmp_dir, stdout = subprocess.PIPE)
        out, err = p.communicate() #block until cargo fmt has finished
        if out != "" or err is not None:
            print("Got the following output from cargo fmt:")
            print(out)
            print(err)

        # Make zip
        self.create_zip_file(self.tmp_dir)
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.pas$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir)

        shutil.copy(os.path.join(root_dir, 'Base58.pas'),         self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'),  self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'),     self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'Device.pas'),         self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.pas'),   self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'LEConverter.pas'),    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'SHA1.pas'),           self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'),    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),      self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),         self.tmp_dir)

        # Make zip
        version = common.get_changelog_version(root_dir)

        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.py$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files() + ['device_factory.py']:
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.py'),             self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make __init__.py
        with open(os.path.join(self.tmp_source_tinkerforge_dir, '__init__.py'), 'w') as f:
            f.write(' ')

        # Make setup.py
        version = self.get_changelog_version()

        common.specialize_template(os.path.join(root_dir, 'setup.py.template'),
                                   os.path.join(self.tmp_source_dir, 'setup.py'),
                                   {'<<VERSION>>': '.'.join(version)})

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#13
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example_.*\.py$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename),
                        self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.py'),
                    self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make __init__.py
        file(os.path.join(self.tmp_source_tinkerforge_dir, '__init__.py'),
             'wb').write(' ')

        # Make setup.py
        version = common.get_changelog_version(root_dir)

        common.specialize_template(
            os.path.join(root_dir, 'setup.py.template'),
            os.path.join(self.tmp_source_dir, 'setup.py'),
            {'<<VERSION>>': '.'.join(version)})

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
示例#14
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.py$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files() + ['device_factory.py']:
            shutil.copy(os.path.join(self.get_bindings_dir(), filename),
                        self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.py'),
                    self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make __init__.py
        with open(os.path.join(self.tmp_source_tinkerforge_dir, '__init__.py'),
                  'w') as f:
            f.write(' ')

        # Make setup.py
        version = self.get_changelog_version()

        common.specialize_template(
            os.path.join(root_dir, 'setup.py.template'),
            os.path.join(self.tmp_source_dir, 'setup.py'),
            {'<<VERSION>>': '.'.join(version)})

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#15
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.java$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files + ['DeviceFactory.java']:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_com_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'BrickDaemon.java'),               self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'Device.java'),                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceBase.java'),                self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceListener.java'),            self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.java'),              self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnectionBase.java'),          self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeException.java'),      self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TimeoutException.java'),          self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'AlreadyConnectedException.java'), self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'NotConnectedException.java'),     self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'CryptoException.java'),           self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeListener.java'),       self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                  self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                     self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),   self.tmp_dir)

        # Make manifest
        version = common.get_changelog_version(root_dir)

        with open(os.path.join(self.tmp_dir, 'manifest.txt'), 'wb') as f:
            f.write('Bindings-Version: {0}.{1}.{2}\n'.format(*version))

        # Compile source
        with common.ChangedDirectory(self.tmp_dir):
            common.execute('/usr/bin/javac ' +
                           '-Xlint ' +
                           '-source 1.5 ' +
                           '-target 1.5 ' +
                           os.path.join(self.tmp_source_com_tinkerforge_dir, '*.java'),
                           shell=True)

        # Make jar
        with common.ChangedDirectory(self.tmp_source_dir):
            common.execute(['/usr/bin/jar',
                            'cfm',
                            os.path.join(self.tmp_dir, 'Tinkerforge.jar'),
                            os.path.join(self.tmp_dir, 'manifest.txt'),
                           'com'])

        # Remove manifest
        os.remove(os.path.join(self.tmp_dir, 'manifest.txt'))

        # Remove classes
        for f in os.listdir(self.tmp_source_com_tinkerforge_dir):
            if f.endswith('.class'):
                os.remove(os.path.join(self.tmp_source_com_tinkerforge_dir, f))

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#16
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example_.*\.pl$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_lib_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'IPConnection.pm'),              self.tmp_source_lib_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'Device.pm'),                    self.tmp_source_lib_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'Error.pm'),                     self.tmp_source_lib_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make Tinkerforge.pm
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, 'Tinkerforge.pm.template'),
                                   os.path.join(self.tmp_source_lib_dir, 'Tinkerforge.pm'),
                                   {'<<VERSION>>': '.'.join(version)})

        # Copy Makefile.PL
        shutil.copy(os.path.join(root_dir, 'Makefile.PL'), self.tmp_source_dir)

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.pas$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/source')

        shutil.copy(os.path.join(root, 'Base58.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'BlockingQueue.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'DeviceBase.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'Device.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'IPConnection.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'LEConverter.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'TimedSemaphore.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'SHA1.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'BrickDaemon.pas'), '/tmp/generator/source')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/')

        # Make zip
        version = common.get_changelog_version(root)
        common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
示例#18
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.go$'):
                shutil.copy(example[1], self.tmp_examples_dir)
        

        for filename in self.get_released_files():
            path = os.path.join(self.get_bindings_dir(), filename)
            target_folder = os.path.splitext(os.path.basename(filename))[0]
            target_folder = os.path.join(self.tmp_bindings_dir, target_folder)
            os.makedirs(target_folder)
            shutil.copy(path, os.path.join(target_folder, filename))

        copy_map = {
            "internal": [
                'base58.go',
                'byteconverter.go',
                'device.go',
                'ipconnection.go'
            ],
            "ipconnection": [
                "ipcon_handle.go"
            ],
            "": [
                "doc.go"
            ]
        }
        
        top_level_files = [          
            'changelog.txt',
            'readme.txt',
            'LICENSE',
        ]

        if self.get_config_name().space == 'Tinkerforge':
            for f in top_level_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_dir)
            for dir, files in copy_map.items():
                path = os.path.join(self.tmp_bindings_dir, dir)
                if not os.path.exists(path):
                    os.makedirs(path)
                for f in files:
                    shutil.copy(os.path.join(root_dir, f), path)
        else:
            shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'),   self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'custom.txt'),                   os.path.join(self.tmp_dir, 'readme.txt'))

        p = subprocess.Popen(["go", "fmt"], cwd=self.tmp_bindings_dir, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
        out, err = p.communicate() #block until cargo fmt has finished
        if out != "" or err is not None:
            print("Got the following output from go fmt:")
            print(out)
            print(err)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#19
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.cs$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'IPConnection.cs'),              self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'project.json'),                 self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'project.lock.json'),            self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeUWP.rd.xml'),        self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'C#',
                                    '<<VERSION>>': '.'.join(version)})

        # Make Tinkerforge(UWP).csproj
        project_items = []

        for filename in ['AssemblyInfo.cs', 'IPConnection.cs'] + released_files:
            project_items.append('<Compile Include="{0}" />'.format(filename))

        common.specialize_template(os.path.join(root_dir, 'Tinkerforge.csproj.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'Tinkerforge.csproj'),
                                   {'{{TOOLS_VERSION}}': '2.0',
                                    '{{ITEMS}}': '\n    '.join(project_items)})

        common.specialize_template(os.path.join(root_dir, 'TinkerforgeUWP.csproj.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'TinkerforgeUWP.csproj'),
                                   {'{{ITEMS}}': '\n    '.join(project_items)})

        # Make dll
        with common.ChangedDirectory(self.tmp_source_tinkerforge_dir):
            common.execute(['xbuild',
                            '/p:Configuration=Release',
                            os.path.join(self.tmp_source_tinkerforge_dir, 'Tinkerforge.csproj')])

        release_dir = os.path.join(self.tmp_source_tinkerforge_dir, 'bin', 'Release')

        shutil.copy(os.path.join(release_dir, 'Tinkerforge.dll'),     self.tmp_dir)
        shutil.copy(os.path.join(release_dir, 'Tinkerforge.dll.mdb'), self.tmp_dir)
        shutil.copy(os.path.join(release_dir, 'Tinkerforge.xml'),     self.tmp_dir)

        shutil.rmtree(os.path.join(self.tmp_source_tinkerforge_dir, 'bin'))
        shutil.rmtree(os.path.join(self.tmp_source_tinkerforge_dir, 'obj'))

        # Make zip
        self.create_zip_file(self.tmp_dir)
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^Example.*\.cs$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_tinkerforge_dir)
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_tinkerforge_uwp_dir)

        shutil.copy(os.path.join(root_dir, 'IPConnection.cs'),              self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.cs'),              self.tmp_source_tinkerforge_uwp_dir)
        shutil.copy(os.path.join(root_dir, 'project.json'),                 self.tmp_source_tinkerforge_uwp_dir)
        shutil.copy(os.path.join(root_dir, 'project.lock.json'),            self.tmp_source_tinkerforge_uwp_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeUWP.rd.xml'),        self.tmp_source_tinkerforge_uwp_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make AssemblyInfo.cs
        version = self.get_changelog_version()

        for target_dir in [self.tmp_source_tinkerforge_dir, self.tmp_source_tinkerforge_uwp_dir]:
            common.specialize_template(os.path.join(root_dir, 'AssemblyInfo.cs.template'),
                                       os.path.join(target_dir, 'AssemblyInfo.cs'),
                                       {'<<BINDINGS>>': 'C#',
                                        '<<VERSION>>': '.'.join(version)})

        # Make Tinkerforge(UWP).csproj
        project_items = []

        for filename in ['AssemblyInfo.cs', 'IPConnection.cs'] + self.get_released_files():
            project_items.append('<Compile Include="{0}" />'.format(filename))

        common.specialize_template(os.path.join(root_dir, 'Tinkerforge.csproj.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'Tinkerforge.csproj'),
                                   {'{{ITEMS}}': '\n    '.join(project_items)})

        common.specialize_template(os.path.join(root_dir, 'TinkerforgeUWP.csproj.template'),
                                   os.path.join(self.tmp_source_tinkerforge_uwp_dir, 'TinkerforgeUWP.csproj'),
                                   {'{{ITEMS}}': '\n    '.join(project_items)})

        # Make dll
        with common.ChangedDirectory(self.tmp_dir):
            common.execute(['mcs',
                            '/debug:full',
                            '/optimize+',
                            '/warn:4',
                            '/sdk:2',
                            '/target:library',
                            '/doc:' + os.path.join(self.tmp_dir, 'Tinkerforge.xml'),
                            '/out:' + os.path.join(self.tmp_dir, 'Tinkerforge.dll'),
                            os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')])

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#21
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.rb$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_lib_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'ip_connection.rb'),             self.tmp_source_lib_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make version.rb
        version = self.get_changelog_version()

        with open(os.path.join(self.tmp_source_lib_tinkerforge_dir, 'version.rb'), 'w') as f:
            f.write("""
module Tinkerforge
  VERSION = '{0}.{1}.{2}'
end
""".format(*version))

        # Make tinkerforge.rb
        with open(os.path.join(self.tmp_source_lib_dir, 'tinkerforge.rb'), 'w') as f:
            f.write("""
require 'tinkerforge/version'

module Tinkerforge
end
""")

        # Make tinkerforge.gemspec
        tmp_gemspec = os.path.join(self.tmp_source_dir, 'tinkerforge.gemspec')

        common.specialize_template(os.path.join(root_dir, 'tinkerforge.gemspec.template'),
                                   tmp_gemspec,
                                   {'<<VERSION>>': '.'.join(version)})

        # Make gem
        with common.ChangedDirectory(self.tmp_source_dir):
            common.execute(['gem', 'build', 'tinkerforge.gemspec'])

        # Remove build stuff
        tmp_gem = os.path.join(self.tmp_source_dir, 'tinkerforge-{0}.{1}.{2}.gem'.format(*version))

        os.remove(tmp_gemspec)
        shutil.copy(tmp_gem, root_dir)
        shutil.move(tmp_gem, os.path.join(self.tmp_dir, 'tinkerforge.gem'))
        shutil.move(os.path.join(self.tmp_source_lib_dir, 'tinkerforge.rb'), self.tmp_source_dir)
        shutil.move(self.tmp_source_lib_tinkerforge_dir, os.path.join(self.tmp_source_dir, 'tinkerforge'))
        shutil.rmtree(self.tmp_source_lib_dir)

        # Make zip
        self.create_zip_file(self.tmp_dir)
def copy_examples_for_zip():
    examples = common.find_examples(device, common.path_binding, "php", "Example", ".php")
    dest = os.path.join("/tmp/generator/pear/examples/", 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 finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.java$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/jar/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/jar/source/com/tinkerforge')

        shutil.copy(os.path.join(root, 'BrickDaemon.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'Device.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'DeviceBase.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'DeviceListener.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'IPConnection.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'IPConnectionBase.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TinkerforgeException.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TimeoutException.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'AlreadyConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'NotConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'CryptoException.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TinkerforgeListener.java'), '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/jar')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/jar')

        # Make Manifest
        version = common.get_changelog_version(root)
        file('/tmp/generator/manifest.txt', 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version))

        # Make jar
        with common.ChangedDirectory('/tmp/generator'):
            args = ['/usr/bin/javac ' +
                    '-Xlint ' +
                    '-source 1.5 ' +
                    '-target 1.5 ' +
                    '/tmp/generator/jar/source/com/tinkerforge/*.java']
            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        with common.ChangedDirectory('/tmp/generator/jar/source'):
            args = ['/usr/bin/jar ' +
                    'cfm ' +
                    '/tmp/generator/jar/Tinkerforge.jar ' +
                    '/tmp/generator/manifest.txt ' +
                    'com']
            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove class
        for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'):
            if f.endswith('.class'):
                os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f)

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root, version)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example .*\.vi$')
        dest = os.path.join('/tmp/generator/dll/examples')
        dest_10 = os.path.join('/tmp/generator/dll/examples', '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)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/dll/source/Tinkerforge')

        shutil.copy(os.path.join(root, '..', 'csharp', 'IPConnection.cs'), '/tmp/generator/dll/source/Tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/dll')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/dll')

        # Write AssemblyInfo
        version = common.get_changelog_version(root)
        file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs', 'wb').write("""
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("LabVIEW API Bindings")]
[assembly: AssemblyDescription("LabVIEW API Bindings for Tinkerforge Bricks and Bricklets")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tinkerforge GmbH")]
[assembly: AssemblyProduct("LabVIEW API Bindings")]
[assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("{0}.{1}.{2}.0")]
""".format(*version))

        # Make dll
        with common.ChangedDirectory('/tmp/generator'):
            args = ['/usr/bin/gmcs',
                    '/optimize',
                    '/target:library',
                    '/out:/tmp/generator/dll/Tinkerforge.dll',
                    '/tmp/generator/dll/source/Tinkerforge/*.cs']
            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/dll', root, version)
示例#25
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^example_.*\.go$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        for filename in self.get_released_files():
            path = os.path.join(self.get_bindings_dir(), filename)
            target_folder = os.path.splitext(os.path.basename(filename))[0]
            target_folder = os.path.join(self.tmp_bindings_dir, target_folder)
            os.makedirs(target_folder)
            shutil.copy(path, os.path.join(target_folder, filename))

        copy_map = {
            "internal":
            ['base58.go', 'byteconverter.go', 'device.go', 'ipconnection.go'],
            "ipconnection": ["ipcon_handle.go"],
            "": ["doc.go"]
        }

        top_level_files = [
            'changelog.txt',
            'readme.txt',
            'LICENSE',
        ]

        if self.get_config_name().space == 'Tinkerforge':
            for f in top_level_files:
                shutil.copy(os.path.join(root_dir, f), self.tmp_dir)
            for dir, files in copy_map.items():
                path = os.path.join(self.tmp_bindings_dir, dir)
                if not os.path.exists(path):
                    os.makedirs(path)
                for f in files:
                    shutil.copy(os.path.join(root_dir, f), path)
        else:
            shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'),
                        self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'custom.txt'),
                        os.path.join(self.tmp_dir, 'readme.txt'))

        p = subprocess.Popen(["go", "fmt"],
                             cwd=self.tmp_bindings_dir,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out, err = p.communicate()  #block until cargo fmt has finished
        if out != "" or err is not None:
            print("Got the following output from go fmt:")
            print(out)
            print(err)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#26
0
def copy_examples_for_zip():
    examples = common.find_examples(device, file_path, 'php', 'Example', '.php')
    dest = os.path.join('/tmp/generator/pear/examples/',
                        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)
示例#27
0
def copy_examples_for_zip():
    examples = common.find_examples(device, file_path, 'csharp', 'Example', '.cs')
    dest = os.path.join('/tmp/generator/dll/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)
示例#28
0
def copy_examples_for_zip():
    examples = common.find_examples(device, common.path_binding, 'python', 'example_', '.py')
    dest = os.path.join('/tmp/generator/egg/examples/', 
                        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)
示例#29
0
def copy_examples_for_zip():
    examples = common.find_examples(device, common.path_binding, 'delphi', '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)
示例#30
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example .*\.vi$'):
            shutil.copy(example[1], self.tmp_examples_dir)

            parts = os.path.split(example[1])
            shutil.copy(os.path.join(parts[0], '10.0', parts[1]),
                        self.tmp_examples_10_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename),
                        self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'),
                    self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(
            os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
            os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'), {
                '<<BINDINGS>>': 'LabVIEW',
                '<<VERSION>>': '.'.join(version)
            })

        # Make dll
        for sdk in [2, 4]:
            os.makedirs(os.path.join(self.tmp_dir, 'net{0}0'.format(sdk)))

            with common.ChangedDirectory(self.tmp_dir):
                args = [
                    '/usr/bin/gmcs', '/optimize', '/target:library',
                    '/sdk:{0}'.format(sdk),
                    '/out:' + os.path.join(self.tmp_dir, 'net{0}0'.format(sdk),
                                           'Tinkerforge.dll'),
                    os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')
                ]

                if subprocess.call(args) != 0:
                    raise Exception("Command '{0}' failed".format(
                        ' '.join(args)))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
示例#31
0
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^example_.*\.py$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/egg/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/egg/source/tinkerforge')

        shutil.copy(os.path.join(root, 'ip_connection.py'), '/tmp/generator/egg/source/tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/egg')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/egg')

        # Write setup.py
        version = common.get_changelog_version(root)
        file('/tmp/generator/egg/source/setup.py', 'wb').write("""
#!/usr/bin/env python

from setuptools import setup

setup(name='tinkerforge',
      version='{0}.{1}.{2}',
      description='TCP/IP based library for Bricks and Bricklets',
      author='Tinkerforge GmbH',
      author_email='*****@*****.**',
      url='http://www.tinkerforge.com',
      packages=['tinkerforge'])
""".format(*version))

        # Make egg
        with common.ChangedDirectory('/tmp/generator/egg/source'):
            args = ['/usr/bin/python',
                    'setup.py',
                    'bdist_egg']
            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove build stuff
        shutil.rmtree('/tmp/generator/egg/source/build')
        shutil.rmtree('/tmp/generator/egg/source/tinkerforge.egg-info')
        shutil.copy('/tmp/generator/egg/source/dist/' +
                    os.listdir('/tmp/generator/egg/source/dist')[0],
                    '/tmp/generator/egg/tinkerforge.egg')
        shutil.rmtree('/tmp/generator/egg/source/dist')

        # Make __init__.py
        file('/tmp/generator/egg/source/tinkerforge/__init__.py', 'wb').write(' ')

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/egg', root, version)
示例#32
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.cs$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'IPConnection.cs'),              self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'C#',
                                    '<<VERSION>>': '.'.join(version)})

        # Make Tinkerforge.csproj
        project_items = []

        for filename in ['AssemblyInfo.cs', 'IPConnection.cs'] + released_files:
            project_items.append('<Compile Include="{0}" />'.format(filename))

        common.specialize_template(os.path.join(root_dir, 'Tinkerforge.csproj.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'Tinkerforge.csproj'),
                                   {'{{TOOLS_VERSION}}': '2.0',
                                    '{{ITEMS}}': '\n    '.join(project_items)})

        # Make dll
        with common.ChangedDirectory(self.tmp_source_tinkerforge_dir):
            args = ['xbuild',
                    '/p:Configuration=Release',
                    os.path.join(self.tmp_source_tinkerforge_dir, 'Tinkerforge.csproj')]

            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        shutil.copy(os.path.join(self.tmp_source_tinkerforge_dir, 'bin', 'Release', 'Tinkerforge.dll'),     self.tmp_dir)
        shutil.copy(os.path.join(self.tmp_source_tinkerforge_dir, 'bin', 'Release', 'Tinkerforge.dll.mdb'), self.tmp_dir)
        shutil.copy(os.path.join(self.tmp_source_tinkerforge_dir, 'bin', 'Release', 'Tinkerforge.xml'),     self.tmp_dir)

        shutil.rmtree(os.path.join(self.tmp_source_tinkerforge_dir, 'bin'))
        shutil.rmtree(os.path.join(self.tmp_source_tinkerforge_dir, 'obj'))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#33
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^Example.*\.php$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        package_files = [
            '<file name="Tinkerforge/IPConnection.php" role="php" />'
        ]

        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename),
                        self.tmp_source_tinkerforge_dir)
            package_files.append(
                '<file name="Tinkerforge/{0}" role="php" />'.format(
                    os.path.basename(filename)))

        shutil.copy(os.path.join(root_dir, 'IPConnection.php'),
                    self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make package.xml
        version = self.get_changelog_version()
        date = datetime.datetime.now().strftime("%Y-%m-%d")

        common.specialize_template(
            os.path.join(root_dir, 'package.xml.template'),
            os.path.join(self.tmp_source_dir, 'package.xml'), {
                '{{VERSION}}': '.'.join(version),
                '{{DATE}}': date,
                '{{FILES}}': '\n    '.join(package_files)
            })

        # Make PEAR package
        with common.ChangedDirectory(self.tmp_source_dir):
            common.execute(['/usr/bin/pear', 'package', 'package.xml'])

        # Remove build stuff
        shutil.move(
            os.path.join(self.tmp_source_dir,
                         'Tinkerforge-{0}.{1}.{2}.tgz'.format(*version)),
            os.path.join(self.tmp_dir, 'Tinkerforge.tgz'))
        os.remove(os.path.join(self.tmp_source_dir, 'package.xml'))

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#34
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.pas$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename),
                        self.tmp_source_dir)

        shutil.copy(os.path.join(root_dir, 'Base58.pas'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'Device.pas'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'LEConverter.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'SHAone.pas'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'),
                    self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make Makefile.fpc
        version = common.get_changelog_version(root_dir)
        units = sorted([
            filename.replace('.pas', '')
            for filename in os.listdir(self.tmp_source_dir)
        ])

        common.specialize_template(
            os.path.join(root_dir, 'Makefile.fpc.template'),
            os.path.join(self.tmp_source_dir, 'Makefile.fpc'), {
                '<<UNITS>>': ' '.join(units),
                '<<VERSION>>': '.'.join(version)
            })

        # Make zip
        version = common.get_changelog_version(root_dir)

        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.cs$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/dll/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename),
                        '/tmp/generator/dll/source/Tinkerforge')

        shutil.copy(os.path.join(root, 'IPConnection.cs'),
                    '/tmp/generator/dll/source/Tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/dll')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/dll')

        # Write AssemblyInfo
        version = common.get_changelog_version(root)
        file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs',
             'wb').write("""
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("C# API Bindings")]
[assembly: AssemblyDescription("C# API Bindings for Tinkerforge Bricks and Bricklets")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tinkerforge GmbH")]
[assembly: AssemblyProduct("C# API Bindings")]
[assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("{0}.{1}.{2}.0")]
""".format(*version))

        # Make dll
        with common.ChangedDirectory('/tmp/generator'):
            args = [
                '/usr/bin/gmcs', '/optimize', '/target:library',
                '/out:/tmp/generator/dll/Tinkerforge.dll',
                '/doc:/tmp/generator/dll/Tinkerforge.xml',
                '/tmp/generator/dll/source/Tinkerforge/*.cs'
            ]

            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/dll', root,
                        version)
示例#36
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, '^Example .*\.vi$'):
                shutil.copy(example[1], self.tmp_examples_dir)

                parts = os.path.split(example[1])
                shutil.copy(os.path.join(parts[0], '10.0', parts[1]),
                            self.tmp_examples_10_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename),
                        self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'),
                    self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = self.get_changelog_version()

        common.specialize_template(
            os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
            os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'), {
                '<<BINDINGS>>': 'LabVIEW',
                '<<VERSION>>': '.'.join(version)
            })

        # Make dll
        for sdk in [2, 4]:
            os.makedirs(os.path.join(self.tmp_dir, 'net{0}0'.format(sdk)))

            with common.ChangedDirectory(self.tmp_dir):
                common.execute([
                    '/usr/bin/mcs', '/optimize+', '/warn:4',
                    '/sdk:{0}'.format(sdk), '/target:library',
                    '/out:' + os.path.join(self.tmp_dir, 'net{0}0'.format(sdk),
                                           'Tinkerforge.dll'),
                    os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')
                ])

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#37
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example-.*\.sh$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        shutil.copy(os.path.join(root_dir, 'tinkerforge'),                    self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'tinkerforge-bash-completion.sh'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                  self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                     self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),   self.tmp_dir)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#38
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, "^Example .*\.vi$"):
            shutil.copy(example[1], self.tmp_examples_dir)

            parts = os.path.split(example[1])
            shutil.copy(os.path.join(parts[0], "10.0", parts[1]), self.tmp_examples_10_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, "bindings", filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, "..", "csharp", "IPConnection.cs"), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, "changelog.txt"), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, "readme.txt"), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, "..", "configs", "license.txt"), self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(
            os.path.join(root_dir, "..", "csharp", "AssemblyInfo.cs.template"),
            os.path.join(self.tmp_source_tinkerforge_dir, "AssemblyInfo.cs"),
            {"<<BINDINGS>>": "LabVIEW", "<<VERSION>>": ".".join(version)},
        )

        # Make dll
        for sdk in [2, 4]:
            os.makedirs(os.path.join(self.tmp_dir, "net{0}0".format(sdk)))

            with common.ChangedDirectory(self.tmp_dir):
                args = [
                    "/usr/bin/gmcs",
                    "/optimize",
                    "/target:library",
                    "/sdk:{0}".format(sdk),
                    "/out:" + os.path.join(self.tmp_dir, "net{0}0".format(sdk), "Tinkerforge.dll"),
                    os.path.join(self.tmp_source_tinkerforge_dir, "*.cs"),
                ]

                if subprocess.call(args) != 0:
                    raise Exception("Command '{0}' failed".format(" ".join(args)))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#39
0
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^example-.*\.sh$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/examples')

        # Copy bindings and readme
        shutil.copy(os.path.join(root, 'tinkerforge'), '/tmp/generator')
        shutil.copy(os.path.join(root, 'tinkerforge-bash-completion.sh'), '/tmp/generator')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator')

        # Make zip
        version = common.get_changelog_version(root)
        common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example-.*\.sh$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        shutil.copy(os.path.join(root_dir, 'tinkerforge'),                    self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'tinkerforge-bash-completion.sh'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                  self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                     self.tmp_dir)

        # Make zip
        version = common.get_changelog_version(root_dir)

        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#41
0
    def prepare(self):
        root_dir = self.get_root_dir()

        # Create directories
        common.recreate_dir(self.tmp_dir)
        os.makedirs(self.tmp_examples_dir)
        os.makedirs(self.tmp_source_dir)
        os.makedirs(self.tmp_build_dir)

        # Copy blockly and closure-library to build directory
        shutil.copytree(os.path.join(root_dir, '..', '..', 'tvpl-blockly'),
                        self.tmp_build_blockly_dir,
                        ignore=shutil.ignore_patterns('*/.git'))
        shutil.copytree(os.path.join(root_dir, '..', '..',
                                     'tvpl-closure-library'),
                        self.tmp_build_closure_library_dir,
                        ignore=shutil.ignore_patterns('*/.git', '*_test.js'))

        # Copy css/, js/, index.html and programEditor.html
        shutil.copytree(os.path.join(root_dir, 'css'),
                        os.path.join(self.tmp_source_dir, 'css'))
        shutil.copytree(os.path.join(root_dir, 'js'),
                        os.path.join(self.tmp_source_dir, 'js'))
        shutil.copy(os.path.join(root_dir, 'index.html'), self.tmp_source_dir)
        shutil.copy(os.path.join(root_dir, 'programEditor.html'),
                    self.tmp_source_dir)

        # Copy general examples
        for example in common.find_examples(root_dir, r'^example_.*\.tvpl$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy changelog.txt and readme.txt
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme-alpha.txt'), self.tmp_dir)

        # Generate JavaScript bindings
        with common.ChangedDirectory(os.path.join(root_dir, '..',
                                                  'javascript')):
            common.execute(['python', 'generate_javascript_bindings.py'])
            common.execute(['python', 'generate_javascript_zip.py'])

        shutil.copy(
            os.path.join(self.tmp_javascript_dir, 'browser', 'source',
                         'Tinkerforge.js'),
            os.path.join(self.tmp_source_dir, 'js', 'Tinkerforge.js'))
示例#42
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^example-.*\.sh$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        shutil.copy(os.path.join(root_dir, 'tinkerforge'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'tinkerforge-bash-completion.sh'),
                    self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#43
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.php$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        package_files = ['<file name="Tinkerforge/IPConnection.php" role="php" />']
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)
            package_files.append('<file name="Tinkerforge/{0}" role="php" />'.format(os.path.basename(filename)))

        shutil.copy(os.path.join(root_dir, 'IPConnection.php'),             self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir)

        # Make package.xml
        version = common.get_changelog_version(root_dir)
        date = datetime.datetime.now().strftime("%Y-%m-%d")

        common.specialize_template(os.path.join(root_dir, 'package.xml.template'),
                                   os.path.join(self.tmp_source_dir, 'package.xml'),
                                   {'{{VERSION}}': '.'.join(version),
                                    '{{DATE}}': date,
                                    '{{FILES}}': '\n    '.join(package_files)})

        # Make PEAR package
        with common.ChangedDirectory(self.tmp_source_dir):
            args = ['/usr/bin/pear',
                    'package',
                    'package.xml']

            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove build stuff
        shutil.move(os.path.join(self.tmp_source_dir, 'Tinkerforge-{0}.{1}.{2}.tgz'.format(*version)),
                    os.path.join(self.tmp_dir, 'Tinkerforge.tgz'))
        os.remove(os.path.join(self.tmp_source_dir, 'package.xml'))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
示例#44
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example .*\.vi$'):
            shutil.copy(example[1], self.tmp_examples_dir)

            parts = os.path.split(example[1])
            shutil.copy(os.path.join(parts[0], '10.0', parts[1]), self.tmp_examples_10_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                      self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = common.get_changelog_version(root_dir)

        common.specialize_template(os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'LabVIEW',
                                    '<<VERSION>>': '.'.join(version)})

        # Make dll
        for sdk in [2, 4]:
            os.makedirs(os.path.join(self.tmp_dir, 'net{0}0'.format(sdk)))

            with common.ChangedDirectory(self.tmp_dir):
                args = ['/usr/bin/gmcs',
                        '/optimize',
                        '/target:library',
                        '/sdk:{0}'.format(sdk),
                        '/out:' + os.path.join(self.tmp_dir, 'net{0}0'.format(sdk), 'Tinkerforge.dll'),
                        os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')]

                if subprocess.call(args) != 0:
                    raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, '^Example .*\.vi$'):
                shutil.copy(example[1], self.tmp_examples_dir)

                parts = os.path.split(example[1])
                shutil.copy(os.path.join(parts[0], '10.0', parts[1]), self.tmp_examples_10_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                      self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = self.get_changelog_version()

        common.specialize_template(os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'LabVIEW',
                                    '<<VERSION>>': '.'.join(version)})

        # Make dll
        for sdk in [2, 4]:
            os.makedirs(os.path.join(self.tmp_dir, 'net{0}0'.format(sdk)))

            with common.ChangedDirectory(self.tmp_dir):
                common.execute(['mcs',
                                '/optimize+',
                                '/warn:4',
                                '/sdk:{0}'.format(sdk),
                                '/target:library',
                                '/out:' + os.path.join(self.tmp_dir, 'net{0}0'.format(sdk), 'Tinkerforge.dll'),
                                os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')])

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#46
0
    def finish(self):
        root_dir = self.get_root_dir()
        bindings_dir = self.get_bindings_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir,
                                                r'^example-.*\.txt$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        shutil.copy(os.path.join(bindings_dir, 'tinkerforge_mqtt'),
                    self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#47
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir, r'^Example.*\.nb$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename), self.tmp_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'), self.tmp_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'),                   self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'),                      self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),    self.tmp_dir)

        # Make AssemblyInfo.cs
        version = self.get_changelog_version()

        common.specialize_template(os.path.join(root_dir, '..', 'csharp', 'AssemblyInfo.cs.template'),
                                   os.path.join(self.tmp_source_tinkerforge_dir, 'AssemblyInfo.cs'),
                                   {'<<BINDINGS>>': 'Mathematica',
                                    '<<VERSION>>': '.'.join(version)})

        # Make dll
        with common.ChangedDirectory(self.tmp_dir):
            common.execute(['mcs',
                            '/optimize+',
                            '/warn:4',
                            '/sdk:2',
                            '/target:library',
                            '/out:' + os.path.join(self.tmp_dir, 'Tinkerforge.dll'),
                            os.path.join(self.tmp_source_tinkerforge_dir, '*.cs')])

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#48
0
    def finish(self):
        root_dir = self.get_root_dir()

        for flavor in ['matlab', 'octave']:
            tmp_dir = self.tmp_flavor_dir[flavor]
            tmp_source_dir = self.tmp_flavor_source_dir[flavor]
            tmp_source_meta_inf_services_dir = self.tmp_flavor_source_meta_inf_services_dir[
                flavor]
            tmp_source_com_tinkerforge_dir = self.tmp_flavor_source_com_tinkerforge_dir[
                flavor]
            tmp_examples_dir = self.tmp_flavor_examples_dir[flavor]

            # Copy IP Connection examples
            if self.get_config_name().space == 'Tinkerforge':
                for example in common.find_examples(
                        root_dir, '^' + flavor + r'_example_.*\.m$'):
                    shutil.copy(example[1], tmp_examples_dir)

            # Copy bindings and readme
            for filename in self.get_released_files():
                shutil.copy(
                    os.path.join(root_dir, self.get_bindings_dir(), flavor,
                                 filename), tmp_source_com_tinkerforge_dir)

            shutil.copy(
                os.path.join(self.get_bindings_dir(), flavor,
                             'com.tinkerforge.DeviceProvider'),
                tmp_source_meta_inf_services_dir)

            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'BrickDaemon.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceBase.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'Device_{0}.java'.format(flavor)),
                os.path.join(tmp_source_com_tinkerforge_dir, 'Device.java'))
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceListener.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceProvider.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceFactory.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'IPConnection_{0}.java'.format(flavor)),
                os.path.join(tmp_source_com_tinkerforge_dir,
                             'IPConnection.java'))
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'IPConnectionBase.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'TinkerforgeException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'TimeoutException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'AlreadyConnectedException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'NotConnectedException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'CryptoException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'NetworkException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'StreamOutOfSyncException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'TinkerforgeListener.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'liboctaveinvokewrapper-linux-i386.so'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir,
                             'liboctaveinvokewrapper-linux-amd64.so'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'liboctaveinvokewrapper-linux-arm.so'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir,
                             'liboctaveinvokewrapper-windows-x86.dll'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir,
                             'liboctaveinvokewrapper-windows-amd64.dll'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir,
                             'liboctaveinvokewrapper-macos-x86_64.dynlib'),
                tmp_source_com_tinkerforge_dir)

            if self.get_config_name().space == 'Tinkerforge':
                shutil.copy(os.path.join(root_dir, 'changelog.txt'),
                            self.tmp_dir)
                shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
                shutil.copy(
                    os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)
            else:
                shutil.copy(
                    os.path.join(self.get_config_dir(), 'changelog.txt'),
                    self.tmp_dir)

            # Make manifest
            version = self.get_changelog_version()

            with open(os.path.join(tmp_dir, 'manifest.txt'), 'w') as f:
                f.write(
                    'Bindings-Version: {1}.{2}.{3}\nBindings-Flavor: {0}\n'.
                    format(flavor.upper(), *version))

            # Make jar
            with common.ChangedDirectory(tmp_dir):
                if flavor == 'octave':
                    classpath = '-classpath {0} '.format(
                        os.path.join(root_dir, 'octave.jar'))
                else:
                    classpath = ''

                common.execute(
                    '/usr/bin/javac ' + classpath + '-Xlint ' +
                    '-source 1.6 ' + '-target 1.6 ' +
                    os.path.join(tmp_source_com_tinkerforge_dir, '*.java'),
                    shell=True)

            with common.ChangedDirectory(tmp_source_dir):
                common.execute([
                    '/usr/bin/jar', 'cfm',
                    os.path.join(tmp_dir,
                                 self.get_config_name().camel + '.jar'),
                    os.path.join(tmp_dir, 'manifest.txt'), 'com', 'META-INF'
                ])

            # Remove manifest
            os.remove(os.path.join(tmp_dir, 'manifest.txt'))

            # Remove classes
            for f in os.listdir(tmp_source_com_tinkerforge_dir):
                if f.endswith('.class'):
                    os.remove(os.path.join(tmp_source_com_tinkerforge_dir, f))

        # Make zip
        self.create_zip_file(self.tmp_dir)
示例#49
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.java$'):
            shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root_dir, 'bindings', filename),
                        self.tmp_source_com_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'BrickDaemon.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'Device.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceBase.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'DeviceListener.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnection.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'IPConnectionBase.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeException.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TimeoutException.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'AlreadyConnectedException.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'NotConnectedException.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'CryptoException.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'TinkerforgeListener.java'),
                    self.tmp_source_com_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Make manifest
        version = common.get_changelog_version(root_dir)

        file(os.path.join(self.tmp_dir, 'manifest.txt'),
             'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version))

        # Compile source
        with common.ChangedDirectory(self.tmp_dir):
            args = [
                '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' +
                '-target 1.5 ' +
                os.path.join(self.tmp_source_com_tinkerforge_dir, '*.java')
            ]

            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Make jar
        with common.ChangedDirectory(self.tmp_source_dir):
            args = [
                '/usr/bin/jar ' + 'cfm ' +
                os.path.join(self.tmp_dir, 'Tinkerforge.jar') + ' ' +
                os.path.join(self.tmp_dir, 'manifest.txt') + ' ' + 'com'
            ]

            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove manifest
        os.remove(os.path.join(self.tmp_dir, 'manifest.txt'))

        # Remove classes
        for f in os.listdir(self.tmp_source_com_tinkerforge_dir):
            if f.endswith('.class'):
                os.remove(os.path.join(self.tmp_source_com_tinkerforge_dir, f))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
示例#50
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        # Copy IP Connection examples
        for example in common.find_examples(root_dir, '^Example.*\.js'):
            shutil.copy(example[1], self.tmp_nodejs_examples_dir)

        for example in common.find_examples(root_dir, '^Example.*\.html'):
            shutil.copy(example[1], self.tmp_browser_examples_dir)

        # Copy bindings and readme
        for filename in released_files:
            if filename == 'TinkerforgeNPM.js':
                shutil.copy(
                    os.path.join(root_dir, 'bindings', filename),
                    os.path.join(self.tmp_nodejs_package_dir,
                                 'Tinkerforge.js'))
            elif filename == 'BrowserAPI.js':
                shutil.copy(os.path.join(root_dir, 'bindings', filename),
                            self.tmp_nodejs_source_tinkerforge_dir)
            elif filename == 'TinkerforgeSource.js':
                shutil.copy(
                    os.path.join(root_dir, 'bindings', filename),
                    os.path.join(self.tmp_nodejs_source_dir, 'Tinkerforge.js'))
            else:
                shutil.copy(os.path.join(root_dir, 'bindings', filename),
                            self.tmp_nodejs_source_tinkerforge_dir)
                shutil.copy(os.path.join(root_dir, 'bindings', filename),
                            self.tmp_nodejs_package_lib_dir)

        # Make package.json
        version = common.get_changelog_version(root_dir)

        common.specialize_template(
            os.path.join(root_dir, 'package.json.template'),
            os.path.join(self.tmp_nodejs_package_dir, 'package.json'),
            {'<<VERSION>>': '.'.join(version)})

        shutil.copy(os.path.join(root_dir, 'IPConnection.js'),
                    self.tmp_nodejs_package_lib_dir)
        shutil.copy(os.path.join(root_dir, 'Device.js'),
                    self.tmp_nodejs_package_lib_dir)
        shutil.copy(os.path.join(root_dir, 'LICENSE'),
                    self.tmp_nodejs_package_dir)
        shutil.copy(os.path.join(root_dir, 'README.md'),
                    self.tmp_nodejs_package_dir)

        shutil.copy(os.path.join(root_dir, 'IPConnection.js'),
                    self.tmp_nodejs_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'Device.js'),
                    self.tmp_nodejs_source_tinkerforge_dir)

        shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
        shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                    self.tmp_dir)

        # Copy browser specific files
        shutil.copy(os.path.join(root_dir, 'es5-shim.js'),
                    self.tmp_nodejs_source_tinkerforge_dir)
        shutil.copy(os.path.join(root_dir, 'es5-sham.js'),
                    self.tmp_nodejs_source_tinkerforge_dir)

        # Make Tinkerforge.js for browser with browserify
        with common.ChangedDirectory(self.tmp_nodejs_source_tinkerforge_dir):
            args = ['browserify']
            args.extend(
                sorted(os.listdir(self.tmp_nodejs_source_tinkerforge_dir)))
            args.append('-o')
            args.append(
                os.path.join(self.tmp_browser_source_dir, 'Tinkerforge.js'))

            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove browser specific files
        os.remove(
            os.path.join(self.tmp_nodejs_source_tinkerforge_dir,
                         'BrowserAPI.js'))
        os.remove(
            os.path.join(self.tmp_nodejs_source_tinkerforge_dir,
                         'es5-shim.js'))
        os.remove(
            os.path.join(self.tmp_nodejs_source_tinkerforge_dir,
                         'es5-sham.js'))

        # Generate the NPM package and put it on the root of ZIP archive
        with common.ChangedDirectory(self.tmp_nodejs_package_dir):
            if subprocess.call('npm pack', shell=True) != 0:
                raise Exception("Command 'npm pack' failed")

        package_name = 'tinkerforge-{0}.{1}.{2}.tgz'.format(*version)

        shutil.copy(os.path.join(self.tmp_nodejs_package_dir, package_name),
                    os.path.join(self.tmp_nodejs_dir, 'tinkerforge.tgz'))
        shutil.copy(os.path.join(self.tmp_nodejs_package_dir, package_name),
                    os.path.join(root_dir, package_name))

        # Remove package directory
        shutil.rmtree(self.tmp_nodejs_package_dir)

        # Make zip
        version = common.get_changelog_version(root_dir)

        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)

        # copy Tinkerforge.js to bindings root dir so copy_all.py can pick it up
        shutil.copy(
            os.path.join(self.tmp_browser_source_dir, 'Tinkerforge.js'),
            root_dir)
示例#51
0
    def finish(self):
        root = self.get_bindings_root_directory()
        version = common.get_changelog_version(root)
        dot_version = "{0}.{1}.{2}".format(*version)

        # Copy IPConnection examples
        examples = common.find_examples(root, '^example_.*\.pl$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/cpan/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename),
                        '/tmp/generator/cpan/source/lib/Tinkerforge')

        shutil.copy(os.path.join(root, 'IPConnection.pm'),
                    '/tmp/generator/cpan/source/lib/Tinkerforge')
        shutil.copy(os.path.join(root, 'Device.pm'),
                    '/tmp/generator/cpan/source/lib/Tinkerforge')
        shutil.copy(os.path.join(root, 'Error.pm'),
                    '/tmp/generator/cpan/source/lib/Tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/cpan')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/cpan')

        # Generate the CPAN package structure
        modules = []

        for filename in released_files:
            modules.append('Tinkerforge::' + filename.replace('.pm', ''))

        modules.append("Tinkerforge::IPConnection")
        modules.append("Tinkerforge::Device")
        modules.append("Tinkerforge::Error")
        modules.append("Tinkerforge")

        modules = ','.join(modules)

        if os.path.exists('/tmp/generator/cpan/Tinkerforge'):
            shutil.rmtree('/tmp/generator/cpan/Tinkerforge')

        subprocess.call(
            "module-starter --dir=/tmp/generator/cpan/Tinkerforge --module={0} --distro=Tinkerforge"
            " --author=\"Ishraq Ibne Ashraf\" [email protected]".
            format(modules),
            shell=True)

        # Version replacing
        common.replace_in_file(
            os.path.join(root, 'Tinkerforge.pm.template'),
            '/tmp/generator/cpan/Tinkerforge/lib/Tinkerforge.pm',
            '<TF_API_VERSION>', dot_version)
        shutil.copy('/tmp/generator/cpan/Tinkerforge/lib/Tinkerforge.pm',
                    '/tmp/generator/cpan/source/lib')
        common.replace_in_file(os.path.join(root, 'README.template'),
                               '/tmp/generator/cpan/Tinkerforge/README',
                               '<TF_API_VERSION>', dot_version)

        # Copying bindings
        subprocess.call(
            "rm -rf /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/*",
            shell=True)

        for filename in released_files:
            subprocess.call(
                "cp -ar {0}/bindings/{1} /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/"
                .format(root, filename),
                shell=True)

        # Copying IPconnection.pm, Device.pm and Error.pm
        subprocess.call(
            "cp -ar {0}/IPConnection.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/"
            .format(root),
            shell=True)
        subprocess.call(
            "cp -ar {0}/Device.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/"
            .format(root),
            shell=True)
        subprocess.call(
            "cp -ar {0}/Error.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/"
            .format(root),
            shell=True)

        # Copying Changes
        subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/Changes",
                        shell=True)
        subprocess.call(
            "cp -ar {0}/changelog.txt /tmp/generator/cpan/Tinkerforge/Changes".
            format(root),
            shell=True)

        # Copying Makefile.PL
        subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/Makefile.PL",
                        shell=True)
        subprocess.call(
            "cp {0}/Makefile.PL /tmp/generator/cpan/Tinkerforge/Makefile.PL".
            format(root),
            shell=True)
        subprocess.call(
            "cp {0}/Makefile.PL /tmp/generator/cpan/source/Makefile.PL".format(
                root),
            shell=True)

        # Modifying 00-load.t test file
        old_test_file = open('/tmp/generator/cpan/Tinkerforge/t/00-load.t')
        lines = old_test_file.readlines()
        old_test_file.close()

        subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/t/00-load.t",
                        shell=True)

        new_test_file = open('/tmp/generator/cpan/Tinkerforge/t/00-load.t',
                             'w')

        for i, line in enumerate(lines):
            if i == len(lines) - 1:
                new_test_file.write(
                    "diag( \"Testing Tinkerforge $Tinkerforge::VERSION, Perl $], $^X\" );"
                )
            else:
                new_test_file.write(line + "\n")

        new_test_file.close()

        # Generating the CPAN package archive and cleaning up
        subprocess.call(
            "cd /tmp/generator/cpan/Tinkerforge/ && perl /tmp/generator/cpan/Tinkerforge/Makefile.PL",
            shell=True)
        subprocess.call("cd /tmp/generator/cpan/Tinkerforge/ && make dist",
                        shell=True)
        shutil.copy(
            "/tmp/generator/cpan/Tinkerforge/Tinkerforge-{0}.{1}.{2}.tar.gz".
            format(*version), root)
        shutil.rmtree('/tmp/generator/cpan/Tinkerforge')

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/cpan', root,
                        version)
示例#52
0
    def finish(self):
        root_dir = self.get_bindings_root_directory()

        for flavor in ['matlab', 'octave']:
            tmp_dir = self.tmp_flavor_dir[flavor]
            tmp_source_dir = self.tmp_flavor_source_dir[flavor]
            tmp_source_com_tinkerforge_dir = self.tmp_flavor_source_com_tinkerforge_dir[
                flavor]
            tmp_examples_dir = self.tmp_flavor_examples_dir[flavor]

            # Copy IP Connection examples
            for example in common.find_examples(root_dir, '^example_.*\.m$'):
                shutil.copy(example[1], tmp_examples_dir)

            # Copy bindings and readme
            for filename in released_files:
                shutil.copy(
                    os.path.join(root_dir, 'bindings_' + flavor, filename),
                    tmp_source_com_tinkerforge_dir)

            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'BrickDaemon.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceBase.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'Device_{0}.java'.format(flavor)),
                os.path.join(tmp_source_com_tinkerforge_dir, 'Device.java'))
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'DeviceListener.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'IPConnection_{0}.java'.format(flavor)),
                os.path.join(tmp_source_com_tinkerforge_dir,
                             'IPConnection.java'))
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'IPConnectionBase.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'TinkerforgeException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'TimeoutException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'AlreadyConnectedException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'NotConnectedException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java', 'CryptoException.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, '..', 'java',
                             'TinkerforgeListener.java'),
                tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
            shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                        self.tmp_dir)

            # Make manifest
            version = common.get_changelog_version(root_dir)

            file(os.path.join(tmp_dir, 'manifest.txt'), 'wb').write(
                'Bindings-Version: {1}.{2}.{3}\nBindings-Flavor: {0}\n'.format(
                    flavor.upper(), *version))

            # Make jar
            with common.ChangedDirectory(tmp_dir):
                if flavor == 'octave':
                    classpath = '-classpath {0} '.format(
                        os.path.join(root_dir, 'octave.jar'))
                else:
                    classpath = ''

                args = [
                    '/usr/bin/javac ' + classpath + '-Xlint ' +
                    '-source 1.5 ' + '-target 1.5 ' +
                    os.path.join(tmp_source_com_tinkerforge_dir, '*.java')
                ]

                if subprocess.call(args, shell=True) != 0:
                    raise Exception("Command '{0}' failed".format(
                        ' '.join(args)))

            with common.ChangedDirectory(tmp_source_dir):
                args = [
                    '/usr/bin/jar ' + 'cfm ' +
                    os.path.join(tmp_dir, 'Tinkerforge.jar') + ' ' +
                    os.path.join(tmp_dir, 'manifest.txt') + ' ' + 'com'
                ]

                if subprocess.call(args, shell=True) != 0:
                    raise Exception("Command '{0}' failed".format(
                        ' '.join(args)))

            # Remove manifest
            os.remove(os.path.join(tmp_dir, 'manifest.txt'))

            # Remove classes
            for f in os.listdir(tmp_source_com_tinkerforge_dir):
                if f.endswith('.class'):
                    os.remove(os.path.join(tmp_source_com_tinkerforge_dir, f))

        # Make zip
        common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir,
                        version)
    def finish(self):
        octave_jar_path = '-classpath {0} '.format(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'octave.jar'))
        root = self.get_bindings_root_directory()

        for flavor in ['matlab', 'octave']:
            jar_root = '/tmp/generator/jar/' + flavor

            # Copy IPConnection examples
            examples = common.find_examples(root, '^example_.*\.m$')
            for example in examples:
                shutil.copy(example[1], jar_root + '/examples')

            # Copy bindings and readme
            for filename in released_files:
                shutil.copy(os.path.join(root, 'bindings_' + flavor, filename),
                            jar_root + '/source/com/tinkerforge')

            shutil.copy(os.path.join(root, '..', 'java', 'BrickDaemon.java'),
                        jar_root + '/source/com/tinkerforge')
            shutil.copy(os.path.join(root, '..', 'java', 'DeviceBase.java'),
                        jar_root + '/source/com/tinkerforge')
            shutil.copy(os.path.join(root, 'Device_{0}.java'.format(flavor)),
                        jar_root + '/source/com/tinkerforge/Device.java')
            shutil.copy(
                os.path.join(root, '..', 'java', 'DeviceListener.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, 'IPConnection_{0}.java'.format(flavor)),
                jar_root + '/source/com/tinkerforge/IPConnection.java')
            shutil.copy(
                os.path.join(root, '..', 'java', 'IPConnectionBase.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java', 'TinkerforgeException.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java', 'TimeoutException.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java',
                             'AlreadyConnectedException.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java', 'NotConnectedException.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java', 'CryptoException.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(
                os.path.join(root, '..', 'java', 'TinkerforgeListener.java'),
                jar_root + '/source/com/tinkerforge')
            shutil.copy(os.path.join(root, 'changelog.txt'),
                        '/tmp/generator/jar/')
            shutil.copy(os.path.join(root, 'readme.txt'),
                        '/tmp/generator/jar/')

            # Make Manifest
            version = common.get_changelog_version(root)
            file('/tmp/generator/manifest.txt', 'wb').write(
                'Bindings-Version: {1}.{2}.{3}\nBindings-Flavor: {0}\n'.format(
                    flavor.upper(), *version))

            # Make jar
            with common.ChangedDirectory('/tmp/generator'):
                if flavor == 'octave':
                    args = [
                        '/usr/bin/javac ' + octave_jar_path + '-Xlint ' +
                        '-source 1.5 ' + '-target 1.5 ' + jar_root +
                        '/source/com/tinkerforge/*.java'
                    ]
                else:
                    args = [
                        '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' +
                        '-target 1.5 ' + jar_root +
                        '/source/com/tinkerforge/*.java'
                    ]
                if subprocess.call(args, shell=True) != 0:
                    raise Exception("Command '{0}' failed".format(
                        ' '.join(args)))

            with common.ChangedDirectory(jar_root + '/source'):
                args = [
                    '/usr/bin/jar ' + 'cfm ' + jar_root + '/Tinkerforge.jar ' +
                    '/tmp/generator/manifest.txt ' + 'com'
                ]
                if subprocess.call(args, shell=True) != 0:
                    raise Exception("Command '{0}' failed".format(
                        ' '.join(args)))

            # Remove class
            for f in os.listdir(jar_root + '/source/com/tinkerforge/'):
                if f.endswith('.class'):
                    os.remove(jar_root + '/source/com/tinkerforge/' + f)

            # FIXME: remove this
            shutil.copy(jar_root + '/Tinkerforge.jar',
                        root + '/Tinkerforge_' + flavor + '.jar')

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root,
                        version)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.php$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/pear/examples')

        # Copy bindings and readme
        package_files = [
            '<file name="Tinkerforge/IPConnection.php" role="php" />'
        ]
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename),
                        '/tmp/generator/pear/source/Tinkerforge')
            package_files.append(
                '<file name="Tinkerforge/{0}" role="php" />'.format(
                    os.path.basename(filename)))

        shutil.copy(os.path.join(root, 'IPConnection.php'),
                    '/tmp/generator/pear/source/Tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/pear')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/pear')

        # Write package.xml
        version = common.get_changelog_version(root)
        date = datetime.datetime.now().strftime("%Y-%m-%d")
        file('/tmp/generator/pear/source/package.xml',
             'wb').write("""<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0">
 <name>Tinkerforge</name>
 <uri>http://download.tinkerforge.com/bindings/php/pear/Tinkerforge-{2}.{3}.{4}</uri>
 <summary>PHP API Bindings for Tinkerforge Bricks and Bricklets</summary>
 <description>no description</description>
 <lead>
  <name>Matthias Bolte</name>
  <user>matthias</user>
  <email>[email protected]</email>
  <active>yes</active>
 </lead>
 <date>{0}</date>
 <version>
  <release>{2}.{3}.{4}</release>
  <api>{2}.{3}.{4}</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
 <license>Public Domain</license>
 <notes>no notes</notes>
 <contents>
  <dir name="Tinkerforge">
   {1}
  </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>5.3.0</min>
   </php>
   <pearinstaller>
    <min>1.9.0</min>
   </pearinstaller>
  </required>
 </dependencies>
 <phprelease />
</package>
""".format(date, '\n    '.join(package_files), *version))

        # Make PEAR package
        with common.ChangedDirectory('/tmp/generator/pear/source'):
            args = ['/usr/bin/pear', 'package', 'package.xml']
            if subprocess.call(args) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove build stuff
        shutil.move(
            '/tmp/generator/pear/source/Tinkerforge-{0}.{1}.{2}.tgz'.format(
                *version), '/tmp/generator/pear/Tinkerforge.tgz')
        os.remove('/tmp/generator/pear/source/package.xml')

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/pear', root,
                        version)
    def finish(self):
        root = self.get_bindings_root_directory()

        # Copy IPConnection examples
        examples = common.find_examples(root, '^Example.*\.java$')
        for example in examples:
            shutil.copy(example[1], '/tmp/generator/jar/examples')

        # Copy bindings and readme
        for filename in released_files:
            shutil.copy(os.path.join(root, 'bindings', filename),
                        '/tmp/generator/jar/source/com/tinkerforge')

        shutil.copy(os.path.join(root, 'BrickDaemon.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'Device.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'DeviceBase.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'DeviceListener.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'IPConnection.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'IPConnectionBase.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TinkerforgeException.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TimeoutException.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'AlreadyConnectedException.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'NotConnectedException.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'CryptoException.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'TinkerforgeListener.java'),
                    '/tmp/generator/jar/source/com/tinkerforge')
        shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/jar')
        shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/jar')

        # Make Manifest
        version = common.get_changelog_version(root)
        file('/tmp/generator/manifest.txt',
             'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version))

        # Make jar
        with common.ChangedDirectory('/tmp/generator'):
            args = [
                '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' +
                '-target 1.5 ' +
                '/tmp/generator/jar/source/com/tinkerforge/*.java'
            ]
            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        with common.ChangedDirectory('/tmp/generator/jar/source'):
            args = [
                '/usr/bin/jar ' + 'cfm ' +
                '/tmp/generator/jar/Tinkerforge.jar ' +
                '/tmp/generator/manifest.txt ' + 'com'
            ]
            if subprocess.call(args, shell=True) != 0:
                raise Exception("Command '{0}' failed".format(' '.join(args)))

        # Remove class
        for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'):
            if f.endswith('.class'):
                os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f)

        # Make zip
        common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root,
                        version)
示例#56
0
    def finish(self):
        root_dir = self.get_root_dir()

        # Copy IP Connection examples
        if self.get_config_name().space == 'Tinkerforge':
            for example in common.find_examples(root_dir,
                                                r'^Example.*\.java$'):
                shutil.copy(example[1], self.tmp_examples_dir)

        # Copy bindings and readme
        for filename in self.get_released_files():
            shutil.copy(os.path.join(self.get_bindings_dir(), filename),
                        self.tmp_source_com_tinkerforge_dir)

        shutil.copy(
            os.path.join(self.get_bindings_dir(),
                         'com.tinkerforge.DeviceProvider'),
            self.tmp_source_meta_inf_services_dir)

        if self.get_config_name().space == 'Tinkerforge':
            shutil.copy(os.path.join(root_dir, 'BrickDaemon.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'Device.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'DeviceBase.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'DeviceListener.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'DeviceProvider.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'DeviceFactory.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'IPConnection.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'IPConnectionBase.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'TinkerforgeException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'TimeoutException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'AlreadyConnectedException.java'),
                self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'NotConnectedException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'CryptoException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'NetworkException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'StreamOutOfSyncException.java'),
                self.tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'InvalidParameterException.java'),
                self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'NotSupportedException.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(
                os.path.join(root_dir, 'UnknownErrorCodeException.java'),
                self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'TinkerforgeListener.java'),
                        self.tmp_source_com_tinkerforge_dir)
            shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir)
            shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'),
                        self.tmp_dir)
        else:
            shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'),
                        self.tmp_dir)
            shutil.copy(os.path.join(root_dir, 'custom.txt'),
                        os.path.join(self.tmp_dir, 'readme.txt'))

        # Make manifest
        version = self.get_changelog_version()

        with open(os.path.join(self.tmp_dir, 'manifest.txt'), 'w') as f:
            f.write('Bindings-Version: {0}.{1}.{2}\n'.format(*version))

        # Compile source
        if self.get_config_name().space == 'Tinkerforge':
            class_path = ''
        else:
            class_path = '-cp /tmp/generators/java/Tinkerforge.jar '

        with common.ChangedDirectory(self.tmp_dir):
            common.execute(
                'javac ' + '-Xlint ' + '-source 8 ' + '-target 8 ' +
                class_path +
                os.path.join(self.tmp_source_com_tinkerforge_dir, '*.java'),
                shell=True)

        # Make jar
        with common.ChangedDirectory(self.tmp_source_dir):
            common.execute([
                'jar', 'cfm',
                os.path.join(self.tmp_dir,
                             self.get_config_name().camel + '.jar'),
                os.path.join(self.tmp_dir, 'manifest.txt'), 'com', 'META-INF'
            ])

        # Remove manifest
        os.remove(os.path.join(self.tmp_dir, 'manifest.txt'))

        # Remove classes
        for name in os.listdir(self.tmp_source_com_tinkerforge_dir):
            if name.endswith('.class'):
                os.remove(
                    os.path.join(self.tmp_source_com_tinkerforge_dir, name))

        # Make zip
        self.create_zip_file(self.tmp_dir)