def generate(root_dir):
    tmp_dir               = os.path.join(root_dir, 'maven_package')
    tmp_src_main_java_dir = os.path.join(tmp_dir, 'src', 'main', 'java')
    tmp_unzipped_dir      = os.path.join(tmp_dir, 'unzipped')

    # Make directories
    common.recreate_dir(tmp_dir)
    os.makedirs(tmp_src_main_java_dir)

    # Unzip
    version = common.get_changelog_version(root_dir)

    common.execute(['/usr/bin/unzip',
                    '-q',
                    os.path.join(root_dir, 'tinkerforge_java_bindings_{0}_{1}_{2}.zip'.format(*version)),
                    '-d',
                    tmp_unzipped_dir])

    # Copy source
    shutil.copytree(os.path.join(tmp_unzipped_dir, 'source', 'com'),
                    os.path.join(tmp_src_main_java_dir, 'com'))

    # Make pom.xml
    common.specialize_template(os.path.join(root_dir, 'pom.xml.template'),
                               os.path.join(tmp_dir, 'pom.xml'),
                               {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute(['/usr/bin/mvn', 'clean', 'verify'])
    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)
Example #3
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)
    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)
    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)
Example #6
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 generate(bindings_root_directory):
    tmp_dir               = os.path.join(bindings_root_directory, 'maven_package')
    tmp_src_main_java_dir = os.path.join(tmp_dir, 'src', 'main', 'java')
    tmp_unzipped_dir      = os.path.join(tmp_dir, 'unzipped')

    # Make directories
    common.recreate_directory(tmp_dir)
    os.makedirs(tmp_src_main_java_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)

    common.execute(['/usr/bin/unzip',
                    '-q',
                    os.path.join(bindings_root_directory, 'tinkerforge_java_bindings_{0}_{1}_{2}.zip'.format(*version)),
                    '-d',
                    tmp_unzipped_dir])

    # Copy source
    shutil.copytree(os.path.join(tmp_unzipped_dir, 'source', 'com'),
                    os.path.join(tmp_src_main_java_dir, 'com'))

    # Make pom.xml
    common.specialize_template(os.path.join(bindings_root_directory, 'pom.xml.template'),
                               os.path.join(tmp_dir, 'pom.xml'),
                               {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute(['/usr/bin/mvn', 'clean', 'verify'])
    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_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)
Example #10
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)
Example #11
0
 def write_cargo_toml(self):
     common.specialize_template(
         os.path.join(self.get_root_dir(), "Cargo.toml.template"),
         os.path.join(self.get_bindings_dir(), "Cargo.toml"), {
             "{version}":
             '"' + ".".join(list(self.get_changelog_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_.*\.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 generate(bindings_root_directory):
    tmp_dir                     = os.path.join(bindings_root_directory, 'cpan_package')
    tmp_unzipped_dir            = os.path.join(tmp_dir, 'unzipped')
    tmp_unzipped_source_dir     = os.path.join(tmp_unzipped_dir, 'source')
    tmp_unzipped_source_lib_dir = os.path.join(tmp_unzipped_source_dir, 'lib')
    tmp_cpan_dir                = os.path.join(tmp_dir, 'cpan')
    tmp_cpan_lib_dir            = os.path.join(tmp_cpan_dir, 'lib')

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)

    common.execute(['/usr/bin/unzip',
                    '-q',
                    os.path.join(bindings_root_directory, 'tinkerforge_perl_bindings_{0}_{1}_{2}.zip'.format(*version)),
                    '-d',
                    tmp_unzipped_dir])

    # Make CPAN package structure
    modules = ['Tinkerforge',
               'Tinkerforge::IPConnection',
               'Tinkerforge::Device',
               'Tinkerforge::Error']

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

    common.execute(['module-starter',
                    '--dir=' + tmp_cpan_dir,
                    '--module=' + ','.join(modules),
                    '--distro=Tinkerforge',
                    '--author="Ishraq Ibne Ashraf"',
                    '[email protected]'])

    # Make README
    common.specialize_template(os.path.join(bindings_root_directory, 'README.template'),
                               os.path.join(tmp_cpan_dir, 'README'),
                               {'<<VERSION>>': '.'.join(version)})

    # Make Changes
    shutil.copy(os.path.join(tmp_unzipped_dir, 'changelog.txt'), os.path.join(tmp_cpan_dir, 'Changes'))

    # Copy Makefile.PL
    shutil.copy(os.path.join(tmp_unzipped_source_dir, 'Makefile.PL'), tmp_cpan_dir)

    # Copy source
    shutil.rmtree(tmp_cpan_lib_dir)
    shutil.copytree(os.path.join(tmp_unzipped_source_lib_dir),
                    os.path.join(tmp_cpan_lib_dir))

    # Make package
    with common.ChangedDirectory(tmp_cpan_dir):
        common.execute(['/usr/bin/perl', 'Makefile.PL'])
        common.execute(['make', 'dist'])

    shutil.copy(os.path.join(tmp_cpan_dir, 'Tinkerforge-{0}.{1}.{2}.tar.gz'.format(*version)), bindings_root_directory)
    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)
Example #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.*\.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)
Example #16
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)
Example #17
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)
Example #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, '^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)
Example #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 .*\.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)
Example #20
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)
    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)
    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(['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)
    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):
            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)
    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)
Example #26
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_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)

        # 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):
            args = ['/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')]

            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)
Example #28
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)
Example #29
0
def generate(bindings_root_directory):
    tmp_dir               = os.path.join(bindings_root_directory, 'maven_package')
    tmp_src_main_java_dir = os.path.join(tmp_dir, 'src', 'main', 'java')
    tmp_unzipped_dir      = os.path.join(tmp_dir, 'unzipped')

    # Make directories
    common.recreate_directory(tmp_dir)
    os.makedirs(tmp_src_main_java_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)
    args = ['/usr/bin/unzip',
            '-q',
            os.path.join(bindings_root_directory, 'tinkerforge_java_bindings_{0}_{1}_{2}.zip'.format(*version)),
            '-d',
            tmp_unzipped_dir]

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

    # Copy source
    shutil.copytree(os.path.join(tmp_unzipped_dir, 'source', 'com'),
                    os.path.join(tmp_src_main_java_dir, 'com'))

    # Make pom.xml
    common.specialize_template(os.path.join(bindings_root_directory, 'pom.xml.template'),
                               os.path.join(tmp_dir, 'pom.xml'),
                               {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        args = ['/usr/bin/mvn',
                'clean',
                'verify']

        if subprocess.call(args) != 0:
            raise Exception("Command '{0}' failed".format(' '.join(args)))
    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'))

            common.execute(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):
            common.execute(['npm', 'pack'])

        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
        self.create_zip_file(self.tmp_dir)

        # 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)
Example #31
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)
Example #32
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 generate(root_dir):
    tmp_dir = os.path.join(root_dir, 'nuget_package')
    tmp_unzipped_net20_dir = os.path.join(tmp_dir, 'unzipped_net20')
    tmp_unzipped_net40_dir = os.path.join(tmp_dir, 'unzipped_net40')
    tmp_unzipped_net40_source_tinkerforge_dir = os.path.join(
        tmp_unzipped_net40_dir, 'source', 'Tinkerforge')
    tmp_unzipped_netcoreapp20_dir = os.path.join(tmp_dir,
                                                 'unzipped_netcoreapp20')
    tmp_unzipped_netcoreapp20_source_tinkerforge_dir = os.path.join(
        tmp_unzipped_netcoreapp20_dir, 'source', 'Tinkerforge')

    # Make directories
    common.recreate_dir(tmp_dir)

    # Unzip
    version = common.get_changelog_version(root_dir)

    common.execute([
        '/usr/bin/unzip', '-q',
        os.path.join(
            root_dir,
            'tinkerforge_csharp_bindings_{0}_{1}_{2}.zip'.format(*version)),
        '-d', tmp_unzipped_net20_dir
    ])

    shutil.copytree(tmp_unzipped_net20_dir, tmp_unzipped_net40_dir)
    shutil.copytree(tmp_unzipped_net20_dir, tmp_unzipped_netcoreapp20_dir)

    # Make DLL for NET 4.0
    with common.ChangedDirectory(tmp_unzipped_net40_dir):
        common.execute([
            '/usr/bin/mcs', '/debug:full', '/optimize+', '/warn:4', '/sdk:4',
            '/target:library',
            '/doc:' + os.path.join(tmp_unzipped_net40_dir, 'Tinkerforge.xml'),
            '/out:' + os.path.join(tmp_unzipped_net40_dir, 'Tinkerforge.dll'),
            os.path.join(tmp_unzipped_net40_source_tinkerforge_dir, '*.cs')
        ])

    # Make DLL for NET Core 2.0
    with open(
            os.path.join(tmp_unzipped_netcoreapp20_source_tinkerforge_dir,
                         'Tinkerforge.csproj'), 'w') as f:
        f.write(NETCORE_CSPROJ)

    with common.ChangedDirectory(
            tmp_unzipped_netcoreapp20_source_tinkerforge_dir):
        common.execute(['/usr/bin/dotnet', 'build', '-c', 'Release'])

    # Download nuget.exe
    with common.ChangedDirectory(tmp_dir):
        common.execute(['wget', 'http://www.nuget.org/nuget.exe'])

    # Make Tinkerforge.nuspec
    common.specialize_template(
        os.path.join(root_dir, 'Tinkerforge.nuspec.template'),
        os.path.join(tmp_dir, 'Tinkerforge.nuspec'),
        {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute([
            'mono',
            os.path.join(tmp_dir, 'nuget.exe'), 'pack',
            os.path.join(tmp_dir, 'Tinkerforge.nuspec')
        ])

    shutil.move(
        os.path.join(tmp_dir,
                     'Tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)),
        os.path.join(root_dir,
                     'tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)))
def generate(bindings_root_directory):
    tmp_dir = os.path.join(bindings_root_directory, "nuget_package")
    tmp_unzipped_20_dir = os.path.join(tmp_dir, "unzipped_20")
    tmp_unzipped_40_dir = os.path.join(tmp_dir, "unzipped_40")
    tmp_unzipped_40_source_tinkerforge_dir = os.path.join(tmp_unzipped_40_dir, "source", "Tinkerforge")

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)

    common.execute(
        [
            "/usr/bin/unzip",
            "-q",
            os.path.join(bindings_root_directory, "tinkerforge_csharp_bindings_{0}_{1}_{2}.zip".format(*version)),
            "-d",
            tmp_unzipped_20_dir,
        ]
    )

    shutil.copytree(tmp_unzipped_20_dir, tmp_unzipped_40_dir)

    # Make Tinkerforge.csproj for NET 4.0
    common.specialize_template(
        os.path.join(tmp_unzipped_40_source_tinkerforge_dir, "Tinkerforge.csproj"),
        os.path.join(tmp_unzipped_40_source_tinkerforge_dir, "Tinkerforge.csproj"),
        {'ToolsVersion="2.0"': 'ToolsVersion="4.0"'},
    )

    # Make dll for NET 4.0
    with common.ChangedDirectory(tmp_unzipped_40_source_tinkerforge_dir):
        common.execute(
            [
                "xbuild",
                "/p:Configuration=Release",
                os.path.join(tmp_unzipped_40_source_tinkerforge_dir, "Tinkerforge.csproj"),
            ]
        )

    # Download nuget.exe
    with common.ChangedDirectory(tmp_dir):
        common.execute(["wget", "http://www.nuget.org/nuget.exe"])

    # Make Tinkerforge.nuspec
    common.specialize_template(
        os.path.join(bindings_root_directory, "Tinkerforge.nuspec.template"),
        os.path.join(tmp_dir, "Tinkerforge.nuspec"),
        {"{{VERSION}}": ".".join(version)},
    )

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute(
            ["mono", os.path.join(tmp_dir, "nuget.exe"), "pack", os.path.join(tmp_dir, "Tinkerforge.nuspec")]
        )

    shutil.move(
        os.path.join(tmp_dir, "Tinkerforge.{0}.{1}.{2}.nupkg".format(*version)),
        os.path.join(bindings_root_directory, "tinkerforge.{0}.{1}.{2}.nupkg".format(*version)),
    )
def generate(bindings_root_directory):
    tmp_dir                     = os.path.join(bindings_root_directory, 'cpan_package')
    tmp_unzipped_dir            = os.path.join(tmp_dir, 'unzipped')
    tmp_unzipped_source_dir     = os.path.join(tmp_unzipped_dir, 'source')
    tmp_unzipped_source_lib_dir = os.path.join(tmp_unzipped_source_dir, 'lib')
    tmp_cpan_dir                = os.path.join(tmp_dir, 'cpan')
    tmp_cpan_lib_dir            = os.path.join(tmp_cpan_dir, 'lib')

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)
    args = ['/usr/bin/unzip',
            '-q',
            os.path.join(bindings_root_directory, 'tinkerforge_perl_bindings_{0}_{1}_{2}.zip'.format(*version)),
            '-d',
            tmp_unzipped_dir]

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

    # Make CPAN package structure
    modules = ['Tinkerforge',
               'Tinkerforge::IPConnection',
               'Tinkerforge::Device',
               'Tinkerforge::Error']

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

    subprocess.call(("module-starter --dir={0} --module={1} --distro=Tinkerforge " +
                     "--author=\"Ishraq Ibne Ashraf\" [email protected]").format(tmp_cpan_dir, ','.join(modules)), shell=True)

    # Make README
    common.specialize_template(os.path.join(bindings_root_directory, 'README.template'),
                               os.path.join(tmp_cpan_dir, 'README'),
                               {'<<VERSION>>': '.'.join(version)})

    # Make Changes
    shutil.copy(os.path.join(tmp_unzipped_dir, 'changelog.txt'), os.path.join(tmp_cpan_dir, 'Changes'))

    # Copy Makefile.PL
    shutil.copy(os.path.join(tmp_unzipped_source_dir, 'Makefile.PL'), tmp_cpan_dir)

    # Copy source
    shutil.rmtree(tmp_cpan_lib_dir)
    shutil.copytree(os.path.join(tmp_unzipped_source_lib_dir),
                    os.path.join(tmp_cpan_lib_dir))

    # Make package
    with common.ChangedDirectory(tmp_cpan_dir):
        args = ['/usr/bin/perl',
                'Makefile.PL']

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

        args = ['make',
                'dist']

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

    shutil.copy(os.path.join(tmp_cpan_dir, 'Tinkerforge-{0}.{1}.{2}.tar.gz'.format(*version)), bindings_root_directory)
def generate(bindings_root_directory):
    tmp_dir = os.path.join(bindings_root_directory, 'cpan_package')
    tmp_unzipped_dir = os.path.join(tmp_dir, 'unzipped')
    tmp_unzipped_source_dir = os.path.join(tmp_unzipped_dir, 'source')
    tmp_unzipped_source_lib_dir = os.path.join(tmp_unzipped_source_dir, 'lib')
    tmp_cpan_dir = os.path.join(tmp_dir, 'cpan')
    tmp_cpan_lib_dir = os.path.join(tmp_cpan_dir, 'lib')

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)
    args = [
        '/usr/bin/unzip', '-q',
        os.path.join(
            bindings_root_directory,
            'tinkerforge_perl_bindings_{0}_{1}_{2}.zip'.format(*version)),
        '-d', tmp_unzipped_dir
    ]

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

    # Make CPAN package structure
    modules = [
        'Tinkerforge', 'Tinkerforge::IPConnection', 'Tinkerforge::Device',
        'Tinkerforge::Error'
    ]

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

    subprocess.call(
        ("module-starter --dir={0} --module={1} --distro=Tinkerforge " +
         "--author=\"Ishraq Ibne Ashraf\" [email protected]"
         ).format(tmp_cpan_dir, ','.join(modules)),
        shell=True)

    # Make README
    common.specialize_template(
        os.path.join(bindings_root_directory, 'README.template'),
        os.path.join(tmp_cpan_dir, 'README'),
        {'<<VERSION>>': '.'.join(version)})

    # Make Changes
    shutil.copy(os.path.join(tmp_unzipped_dir, 'changelog.txt'),
                os.path.join(tmp_cpan_dir, 'Changes'))

    # Copy Makefile.PL
    shutil.copy(os.path.join(tmp_unzipped_source_dir, 'Makefile.PL'),
                tmp_cpan_dir)

    # Copy source
    shutil.rmtree(tmp_cpan_lib_dir)
    shutil.copytree(os.path.join(tmp_unzipped_source_lib_dir),
                    os.path.join(tmp_cpan_lib_dir))

    # Make package
    with common.ChangedDirectory(tmp_cpan_dir):
        args = ['/usr/bin/perl', 'Makefile.PL']

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

        args = ['make', 'dist']

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

    shutil.copy(
        os.path.join(tmp_cpan_dir,
                     'Tinkerforge-{0}.{1}.{2}.tar.gz'.format(*version)),
        bindings_root_directory)
    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.*\.js'):
                shutil.copy(example[1], self.tmp_nodejs_examples_dir)

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

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

        # Make package.json
        version = self.get_changelog_version()

        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
        retcode, output = common.check_output_and_error(['browserify', '--version'])

        if retcode != 0:
            raise common.GeneratorError('Could not get browserify version')

        if tuple([int(n) for n in output.strip('\r\n').split('.')]) < (13, 1, 1):
            raise common.GeneratorError('Need browserify version >= 13.1.1')

        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'))

            common.execute(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):
            common.execute(['npm', 'pack'])

        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
        self.create_zip_file(self.tmp_dir)

        # 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)
Example #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.*\.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)
def generate(bindings_root_directory):
    tmp_dir                                = os.path.join(bindings_root_directory, 'nuget_package')
    tmp_unzipped_20_dir                    = os.path.join(tmp_dir, 'unzipped_20')
    tmp_unzipped_40_dir                    = os.path.join(tmp_dir, 'unzipped_40')
    tmp_unzipped_40_source_tinkerforge_dir = os.path.join(tmp_unzipped_40_dir, 'source', 'Tinkerforge')

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)
    args = ['/usr/bin/unzip',
            '-q',
            os.path.join(bindings_root_directory, 'tinkerforge_csharp_bindings_{0}_{1}_{2}.zip'.format(*version)),
            '-d',
            tmp_unzipped_20_dir]

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

    shutil.copytree(tmp_unzipped_20_dir, tmp_unzipped_40_dir)

    # Make Tinkerforge.csproj for NET 4.0
    common.specialize_template(os.path.join(tmp_unzipped_40_source_tinkerforge_dir, 'Tinkerforge.csproj'),
                               os.path.join(tmp_unzipped_40_source_tinkerforge_dir, 'Tinkerforge.csproj'),
                               {'ToolsVersion="2.0"': 'ToolsVersion="4.0"'})

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

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

    # Download nuget.exe
    with common.ChangedDirectory(tmp_dir):
        args = ['wget',
                'http://www.nuget.org/nuget.exe']

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

    # Make Tinkerforge.nuspec
    common.specialize_template(os.path.join(bindings_root_directory, 'Tinkerforge.nuspec.template'),
                               os.path.join(tmp_dir, 'Tinkerforge.nuspec'),
                               {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        args = ['mono',
                os.path.join(tmp_dir, 'nuget.exe'),
                'pack',
                os.path.join(tmp_dir, 'Tinkerforge.nuspec')]

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

    shutil.move(os.path.join(tmp_dir, 'Tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)),
                os.path.join(bindings_root_directory, 'tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)))
 def write_cargo_toml(self):
     common.specialize_template(os.path.join(self.get_root_dir(), "Cargo.toml.template"), os.path.join(self.get_bindings_dir(), "Cargo.toml"), {"{version}": '"'+".".join(list(self.get_changelog_version())) + '"'})
def generate(root_dir):
    tmp_dir                                          = os.path.join(root_dir, 'nuget_package')
    tmp_unzipped_net20_dir                           = os.path.join(tmp_dir, 'unzipped_net20')
    tmp_unzipped_net40_dir                           = os.path.join(tmp_dir, 'unzipped_net40')
    tmp_unzipped_net40_source_tinkerforge_dir        = os.path.join(tmp_unzipped_net40_dir, 'source', 'Tinkerforge')
    tmp_unzipped_netcoreapp20_dir                    = os.path.join(tmp_dir, 'unzipped_netcoreapp20')
    tmp_unzipped_netcoreapp20_source_tinkerforge_dir = os.path.join(tmp_unzipped_netcoreapp20_dir, 'source', 'Tinkerforge')

    # Make directories
    common.recreate_dir(tmp_dir)

    # Unzip
    version = common.get_changelog_version(root_dir)

    common.execute(['unzip',
                    '-q',
                    os.path.join(root_dir, 'tinkerforge_csharp_bindings_{0}_{1}_{2}.zip'.format(*version)),
                    '-d',
                    tmp_unzipped_net20_dir])

    shutil.copytree(tmp_unzipped_net20_dir, tmp_unzipped_net40_dir)
    shutil.copytree(tmp_unzipped_net20_dir, tmp_unzipped_netcoreapp20_dir)

    # Make DLL for NET 4.0
    with common.ChangedDirectory(tmp_unzipped_net40_dir):
        common.execute(['mcs',
                        '/debug:full',
                        '/optimize+',
                        '/warn:4',
                        '/sdk:4',
                        '/target:library',
                        '/doc:' + os.path.join(tmp_unzipped_net40_dir, 'Tinkerforge.xml'),
                        '/out:' + os.path.join(tmp_unzipped_net40_dir, 'Tinkerforge.dll'),
                        os.path.join(tmp_unzipped_net40_source_tinkerforge_dir, '*.cs')])

    # Make DLL for NET Core 2.0
    with open(os.path.join(tmp_unzipped_netcoreapp20_source_tinkerforge_dir, 'Tinkerforge.csproj'), 'w') as f:
        f.write(NETCORE_CSPROJ)

    with common.ChangedDirectory(tmp_unzipped_netcoreapp20_source_tinkerforge_dir):
        common.execute(['dotnet',
                        'build',
                        '-c',
                        'Release'])

    # Download nuget.exe
    with common.ChangedDirectory(tmp_dir):
        common.execute(['wget', 'http://www.nuget.org/nuget.exe'])

    # Make Tinkerforge.nuspec
    common.specialize_template(os.path.join(root_dir, 'Tinkerforge.nuspec.template'),
                               os.path.join(tmp_dir, 'Tinkerforge.nuspec'),
                               {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute(['mono',
                        os.path.join(tmp_dir, 'nuget.exe'),
                        'pack',
                        os.path.join(tmp_dir, 'Tinkerforge.nuspec')])

    shutil.move(os.path.join(tmp_dir, 'Tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)),
                os.path.join(root_dir, 'tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)))
Example #42
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.*\.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)
def generate(bindings_root_directory):
    tmp_dir = os.path.join(bindings_root_directory, 'nuget_package')
    tmp_unzipped_20_dir = os.path.join(tmp_dir, 'unzipped_20')
    tmp_unzipped_40_dir = os.path.join(tmp_dir, 'unzipped_40')
    tmp_unzipped_40_source_tinkerforge_dir = os.path.join(
        tmp_unzipped_40_dir, 'source', 'Tinkerforge')

    # Make directories
    common.recreate_directory(tmp_dir)

    # Unzip
    version = common.get_changelog_version(bindings_root_directory)

    common.execute([
        '/usr/bin/unzip', '-q',
        os.path.join(
            bindings_root_directory,
            'tinkerforge_csharp_bindings_{0}_{1}_{2}.zip'.format(*version)),
        '-d', tmp_unzipped_20_dir
    ])

    shutil.copytree(tmp_unzipped_20_dir, tmp_unzipped_40_dir)

    # Make Tinkerforge.csproj for NET 4.0
    common.specialize_template(
        os.path.join(tmp_unzipped_40_source_tinkerforge_dir,
                     'Tinkerforge.csproj'),
        os.path.join(tmp_unzipped_40_source_tinkerforge_dir,
                     'Tinkerforge.csproj'),
        {'ToolsVersion="2.0"': 'ToolsVersion="4.0"'})

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

    # Download nuget.exe
    with common.ChangedDirectory(tmp_dir):
        common.execute(['wget', 'http://www.nuget.org/nuget.exe'])

    # Make Tinkerforge.nuspec
    common.specialize_template(
        os.path.join(bindings_root_directory, 'Tinkerforge.nuspec.template'),
        os.path.join(tmp_dir, 'Tinkerforge.nuspec'),
        {'{{VERSION}}': '.'.join(version)})

    # Make package
    with common.ChangedDirectory(tmp_dir):
        common.execute([
            'mono',
            os.path.join(tmp_dir, 'nuget.exe'), 'pack',
            os.path.join(tmp_dir, 'Tinkerforge.nuspec')
        ])

    shutil.move(
        os.path.join(tmp_dir,
                     'Tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)),
        os.path.join(bindings_root_directory,
                     'tinkerforge.{0}.{1}.{2}.nupkg'.format(*version)))