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)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.pas$') for example in examples: shutil.copy(example[1], '/tmp/generator/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/source') shutil.copy(os.path.join(root, 'Base58.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'BlockingQueue.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'DeviceBase.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'Device.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'IPConnection.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'LEConverter.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'TimedSemaphore.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'SHA1.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'BrickDaemon.pas'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/') # Make zip version = common.get_changelog_version(root) common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
def generate(path): global file_path file_path = path path_list = path.split('/') path_list[-1] = 'configs' path_config = '/'.join(path_list) sys.path.append(path_config) configs = os.listdir(path_config) # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/bindings') os.chdir('/tmp/generator/bindings') for config in configs: if config.endswith('_config.py'): module = __import__(config[:-3]) print(" * {0}".format(config[:-10])) make_files(module.com, path) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.[ch]'): shutil.copy(filename, '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.c', '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.h', '/tmp/generator/bindings') shutil.copy(path + '/changelog.txt', '/tmp/generator/') shutil.copy(path + '/readme.txt', '/tmp/generator/') # Make zip version = common.get_changelog_version(path) common.make_zip('c', '/tmp/generator', path, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.pas$') for example in examples: shutil.copy(example[1], '/tmp/generator/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'Base58.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'BlockingQueue.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'DeviceBase.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'Device.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'IPConnection.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'LEConverter.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'TimedSemaphore.pas'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/') # Make zip version = common.get_changelog_version(root) common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example_.*\.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(path): common.path_binding = path path_list = path.split('/') path_list[-1] = 'configs' path_config = '/'.join(path_list) sys.path.append(path_config) configs = os.listdir(path_config) # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/bindings') os.chdir('/tmp/generator/bindings') # Copy examples common.import_and_make(configs, path, make_files) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.[ch]'): shutil.copy(filename, '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.c', '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.h', '/tmp/generator/bindings') shutil.copy(path + '/changelog.txt', '/tmp/generator/') shutil.copy(path + '/readme.txt', '/tmp/generator/') # Make zip version = common.get_changelog_version(path) common.make_zip('c', '/tmp/generator', path, version)
def generate(path): # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/bindings') os.chdir('/tmp/generator/bindings') # Copy examples common.generate(path, 'en', make_files, None, False) shutil.copy(common.path_binding.replace('/generators/delphi', '/doc/en/source/Software/Example.pas'), '/tmp/generator/examples/ExampleEnumerate.pas') # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.pas'): shutil.copy(filename, '/tmp/generator/bindings') shutil.copy(path + '/Base58.pas', '/tmp/generator/bindings') shutil.copy(path + '/BlockingQueue.pas', '/tmp/generator/bindings') shutil.copy(path + '/Device.pas', '/tmp/generator/bindings') shutil.copy(path + '/IPConnection.pas', '/tmp/generator/bindings') shutil.copy(path + '/LEConverter.pas', '/tmp/generator/bindings') shutil.copy(path + '/TimedSemaphore.pas', '/tmp/generator/bindings') shutil.copy(path + '/changelog.txt', '/tmp/generator/') shutil.copy(path + '/readme.txt', '/tmp/generator/') # Make zip version = common.get_changelog_version(path) common.make_zip('delphi', '/tmp/generator', path, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.pas$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Base58.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Device.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'IPConnection.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'LEConverter.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'SHA1.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example_.*\.c$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'ip_connection.c'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'ip_connection.h'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Makefile'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
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)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.c$') for example in examples: shutil.copy(example[1], '/tmp/generator/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/source') shutil.copy(os.path.join(root, 'ip_connection.c'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'ip_connection.h'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'Makefile'), '/tmp/generator/source') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator') # Make zip version = common.get_changelog_version(root) common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
def generate(path): common.path_binding = path path_list = path.split('/') path_list[-1] = 'configs' path_config = '/'.join(path_list) sys.path.append(path_config) configs = os.listdir(path_config) # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/bindings') os.chdir('/tmp/generator/bindings') # Copy examples common.import_and_make(configs, path, make_files) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.pas'): shutil.copy(filename, '/tmp/generator/bindings') shutil.copy(path + '/Base58.pas', '/tmp/generator/bindings') shutil.copy(path + '/BlockingQueue.pas', '/tmp/generator/bindings') shutil.copy(path + '/Device.pas', '/tmp/generator/bindings') shutil.copy(path + '/IPConnection.pas', '/tmp/generator/bindings') shutil.copy(path + '/LEConverter.pas', '/tmp/generator/bindings') shutil.copy(path + '/TimedSemaphore.pas', '/tmp/generator/bindings') shutil.copy(path + '/changelog.txt', '/tmp/generator/') shutil.copy(path + '/readme.txt', '/tmp/generator/') # Make zip version = common.get_changelog_version(path) common.make_zip('delphi', '/tmp/generator', path, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example_.*\.py$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'ip_connection.py'), self.tmp_source_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) 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 generate(path): # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/egg/source/tinkerforge') os.chdir('/tmp/generator') # Copy examples common.generate(path, 'en', make_files, None, False) shutil.copy(common.path_binding.replace('/generators/python', '/doc/en/source/Software/example.py'), '/tmp/generator/egg/examples/example_enumerate.py') # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.py'): shutil.copy(filename, '/tmp/generator/egg/source/tinkerforge') shutil.copy(path + '/ip_connection.py', '/tmp/generator/egg/source/tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/egg') shutil.copy(path + '/readme.txt', '/tmp/generator/egg') # Write setup.py version = common.get_changelog_version(path) file('/tmp/generator/egg/source/setup.py', 'wb').write(""" #!/usr/bin/env python from setuptools import setup setup(name='tinkerforge', version='{0}.{1}.{2}', description='TCP/IP based library for Bricks and Bricklets', author='Tinkerforge GmbH', author_email='*****@*****.**', url='http://www.tinkerforge.com', packages=['tinkerforge']) """.format(*version)) # Make egg os.chdir('/tmp/generator/egg/source') args = ['/usr/bin/python', 'setup.py', 'bdist_egg'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove build stuff shutil.rmtree('/tmp/generator/egg/source/build') shutil.rmtree('/tmp/generator/egg/source/tinkerforge.egg-info') shutil.copy('/tmp/generator/egg/source/dist/' + os.listdir('/tmp/generator/egg/source/dist')[0], '/tmp/generator/egg/tinkerforge.egg') shutil.rmtree('/tmp/generator/egg/source/dist') # Make __init__.py f = open('/tmp/generator/egg/source/tinkerforge/__init__.py', 'w') f.write(' ') f.close() # Make zip common.make_zip('python', '/tmp/generator/egg', path, version)
def generate(path): global file_path file_path = path path_list = path.split('/') path_list[-1] = 'configs' path_config = '/'.join(path_list) sys.path.append(path_config) configs = os.listdir(path_config) # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/dll/source/Tinkerforge') os.chdir('/tmp/generator') # Make bindings for config in configs: if config.endswith('_config.py'): module = __import__(config[:-3]) print(" * {0}".format(config[:-10])) make_files(module.com, path) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.cs'): shutil.copy(filename, '/tmp/generator/dll/source/Tinkerforge') shutil.copy(path + '/IPConnection.cs', '/tmp/generator/dll/source/Tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/dll') shutil.copy(path + '/Readme.txt', '/tmp/generator/dll') # Write AssemblyInfo version = common.get_changelog_version(path) file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs', 'wb').write(""" using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("C# API Bindings")] [assembly: AssemblyDescription("C# API Bindings for Tinkerforge Bricks and Bricklets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tinkerforge GmbH")] [assembly: AssemblyProduct("C# API Bindings")] [assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("{0}.{1}.{2}.0")] """.format(*version)) # Make dll args = ['/usr/bin/gmcs', '/optimize', '/target:library', '/out:/tmp/generator/dll/Tinkerforge.dll', '/doc:/tmp/generator/dll/Tinkerforge.xml', '/tmp/generator/dll/source/Tinkerforge/*.cs'] subprocess.call(args) # Make zip common.make_zip('csharp', '/tmp/generator/dll', path, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example .*\.vi$') dest = os.path.join('/tmp/generator/dll/examples') dest_10 = os.path.join('/tmp/generator/dll/examples', '10.0') if not os.path.exists(dest): os.makedirs(dest) if not os.path.exists(dest_10): os.makedirs(dest_10) for example in examples: shutil.copy(example[1], dest) parts = os.path.split(example[1]) shutil.copy(os.path.join(parts[0], '10.0', parts[1]), dest_10) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/dll/source/Tinkerforge') shutil.copy(os.path.join(root, '..', 'csharp', 'IPConnection.cs'), '/tmp/generator/dll/source/Tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/dll') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/dll') # Write AssemblyInfo version = common.get_changelog_version(root) file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs', 'wb').write(""" using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("LabVIEW API Bindings")] [assembly: AssemblyDescription("LabVIEW API Bindings for Tinkerforge Bricks and Bricklets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tinkerforge GmbH")] [assembly: AssemblyProduct("LabVIEW API Bindings")] [assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("{0}.{1}.{2}.0")] """.format(*version)) # Make dll with common.ChangedDirectory('/tmp/generator'): args = ['/usr/bin/gmcs', '/optimize', '/target:library', '/out:/tmp/generator/dll/Tinkerforge.dll', '/tmp/generator/dll/source/Tinkerforge/*.cs'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/dll', root, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.java$') for example in examples: shutil.copy(example[1], '/tmp/generator/jar/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'BrickDaemon.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'Device.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'DeviceBase.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'DeviceListener.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'IPConnection.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'IPConnectionBase.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TinkerforgeException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TimeoutException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'AlreadyConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'NotConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'CryptoException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TinkerforgeListener.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/jar') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/jar') # Make Manifest version = common.get_changelog_version(root) file('/tmp/generator/manifest.txt', 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version)) # Make jar with common.ChangedDirectory('/tmp/generator'): args = ['/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + '/tmp/generator/jar/source/com/tinkerforge/*.java'] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) with common.ChangedDirectory('/tmp/generator/jar/source'): args = ['/usr/bin/jar ' + 'cfm ' + '/tmp/generator/jar/Tinkerforge.jar ' + '/tmp/generator/manifest.txt ' + 'com'] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove class for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'): if f.endswith('.class'): os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f) # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Prepare toolbox XML file content file_content_xml_toolbox_brick = '' file_content_xml_toolbox_bricklet = '' for device in sorted(self.dict_brick_file_content_xml_toolbox_part): file_content_xml_toolbox_brick = file_content_xml_toolbox_brick + self.dict_brick_file_content_xml_toolbox_part[device] for device in sorted(self.dict_bricklet_file_content_xml_toolbox_part): file_content_xml_toolbox_bricklet = file_content_xml_toolbox_bricklet + self.dict_bricklet_file_content_xml_toolbox_part[device] # Write block definition file with open(os.path.join(self.path_dir_tmp_blocks, 'tinkerforge.js'), 'w') as fh_blocks: fh_blocks.write(self.file_content_append_block + self.file_content_block) # Write JavaScript generator file with open(os.path.join(self.path_dir_tmp_generators_javascript, 'tinkerforge.js'), 'w') as fh_generator_javascript: fh_generator_javascript.write(self.file_content_append_generator_javascript + self.file_content_generator_javascript) # Write Python generator file with open(os.path.join(self.path_dir_tmp_generators_python, 'tinkerforge.js'), 'w') as fh_generator_python: fh_generator_python.write(self.file_content_append_generator_python + self.file_content_generator_python) # Write toolbox XML file with open(os.path.join(root_dir, root_dir, 'tinkerforge', 'xml', self.file_name_xml_toolbox_part_merge_with), 'r') as fh_xml_toolbox_merge_with: file_content_xml_toolbox = '<xml id="toolboxTVPL">' + \ '<category name="Tinkerforge">' + \ '<category name="Bricks">' + \ file_content_xml_toolbox_brick + \ '</category>' + \ '<category name="Bricklets">' + \ file_content_xml_toolbox_bricklet + \ '</category>' + \ '</category>' + \ fh_xml_toolbox_merge_with.read() with open(os.path.join(self.path_dir_tmp_tinkerforge, 'xml', 'toolbox.xml'), 'w') as fh_xml_toolbox: fh_xml_toolbox.write('<!--\n' + common.gen_text_hash.format(self.date, *self.version) + \ '-->\n' + file_content_xml_toolbox.replace('\n', '')) # Compile with closure library previous_working_directory = os.getcwd() os.chdir(self.path_dir_tmp) args = ['python'] args.append(os.path.join(self.path_dir_tmp, 'build.py')) if subprocess.call(args) != 0: raise Exception("Command '{cmdarg}' failed".format(cmdarg = ' '.join(args))) os.chdir(previous_working_directory) # Make zip common.make_zip(self.get_bindings_name(), self.path_dir_tmp, root_dir, common.get_changelog_version(root_dir))
def generate(path): # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/jar/source/com/tinkerforge') os.chdir('/tmp/generator') # Copy examples common.generate(path, 'en', make_files, None, False) lines = [] for line in file(common.path_binding.replace('/generators/java', '/doc/en/source/Software/Example.java'), 'rb'): lines.append(line.replace('public class Example {', 'public class ExampleEnumerate {')) file('/tmp/generator/jar/examples/ExampleEnumerate.java', 'wb').writelines(lines) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.java'): shutil.copy(filename, '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/Device.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/IPConnection.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/TinkerforgeException.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/TimeoutException.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/AlreadyConnectedException.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/NotConnectedException.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/jar') shutil.copy(path + '/Readme.txt', '/tmp/generator/jar') # Make Manifest version = common.get_changelog_version(path) file('/tmp/generator/manifest.txt', 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version)) # Make jar args = ['/usr/bin/javac ' + '-Xlint ' + '/tmp/generator/jar/source/com/tinkerforge/*.java'] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) os.chdir('/tmp/generator/jar/source') args = ['/usr/bin/jar ' + 'cfm ' + '/tmp/generator/jar/Tinkerforge.jar ' + '/tmp/generator/manifest.txt ' + 'com'] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove class for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'): if f.endswith('.class'): os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f) # Make zip common.make_zip('java', '/tmp/generator/jar', path, version)
def generate(path): # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/dll/source/Tinkerforge') os.chdir('/tmp/generator') # Copy examples common.generate(path, 'en', make_files, None, False) shutil.copy(common.path_binding.replace('/generators/vbnet', '/doc/en/source/Software/Example.vb'), '/tmp/generator/dll/examples/ExampleEnumerate.vb') lines = [] for line in file(common.path_binding.replace('/generators/vbnet', '/doc/en/source/Software/Example.vb'), 'rb'): lines.append(line.replace('Module Example', 'Module ExampleEnumerate')) file('/tmp/generator/dll/examples/ExampleEnumerate.vb', 'wb').writelines(lines) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.cs'): shutil.copy(filename, '/tmp/generator/dll/source/Tinkerforge') shutil.copy(path + '/../csharp/IPConnection.cs', '/tmp/generator/dll/source/Tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/dll') shutil.copy(path + '/readme.txt', '/tmp/generator/dll') # Write AssemblyInfo version = common.get_changelog_version(path) file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs', 'wb').write(""" using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Visual Basic .NET API Bindings")] [assembly: AssemblyDescription("Visual Basic .NET API Bindings for Tinkerforge Bricks and Bricklets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tinkerforge GmbH")] [assembly: AssemblyProduct("Visual Basic .NET API Bindings")] [assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("{0}.{1}.{2}.0")] """.format(*version)) # Make dll args = ['/usr/bin/gmcs', '/optimize', '/target:library', '/out:/tmp/generator/dll/Tinkerforge.dll', '/doc:/tmp/generator/dll/Tinkerforge.xml', '/tmp/generator/dll/source/Tinkerforge/*.cs'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Make zip common.make_zip('vbnet', '/tmp/generator/dll', path, version)
def generate(path): global file_path file_path = path path_list = path.split('/') path_list[-1] = 'configs' path_config = '/'.join(path_list) sys.path.append(path_config) configs = os.listdir(path_config) # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/jar/source/com/tinkerforge') os.chdir('/tmp/generator') # Make bindings for config in configs: if config.endswith('_config.py'): module = __import__(config[:-3]) print(" * {0}".format(config[:-10])) make_files(module.com, path) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.java'): shutil.copy(filename, '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/Device.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/IPConnection.java', '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/jar') shutil.copy(path + '/Readme.txt', '/tmp/generator/jar') # Make Manifest version = common.get_changelog_version(path) file('/tmp/generator/manifest.txt', 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version)) # Make jar args = ['/usr/bin/javac /tmp/generator/jar/source/com/tinkerforge/*.java'] subprocess.call(args, shell=True) os.chdir('/tmp/generator/jar/source') args = ['/usr/bin/jar ' + 'cfm ' + '/tmp/generator/jar/Tinkerforge.jar ' + '/tmp/generator/manifest.txt ' + 'com'] subprocess.call(args, shell=True) # Remove class for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'): if f.endswith('.class'): os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f) # Make zip common.make_zip('java', '/tmp/generator/jar', path, 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 = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.py$') for example in examples: shutil.copy(example[1], '/tmp/generator/egg/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/egg/source/tinkerforge') shutil.copy(os.path.join(root, 'ip_connection.py'), '/tmp/generator/egg/source/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/egg') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/egg') # Write setup.py version = common.get_changelog_version(root) file('/tmp/generator/egg/source/setup.py', 'wb').write(""" #!/usr/bin/env python from setuptools import setup setup(name='tinkerforge', version='{0}.{1}.{2}', description='TCP/IP based library for Bricks and Bricklets', author='Tinkerforge GmbH', author_email='*****@*****.**', url='http://www.tinkerforge.com', packages=['tinkerforge']) """.format(*version)) # Make egg with common.ChangedDirectory('/tmp/generator/egg/source'): args = ['/usr/bin/python', 'setup.py', 'bdist_egg'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove build stuff shutil.rmtree('/tmp/generator/egg/source/build') shutil.rmtree('/tmp/generator/egg/source/tinkerforge.egg-info') shutil.copy('/tmp/generator/egg/source/dist/' + os.listdir('/tmp/generator/egg/source/dist')[0], '/tmp/generator/egg/tinkerforge.egg') shutil.rmtree('/tmp/generator/egg/source/dist') # Make __init__.py file('/tmp/generator/egg/source/tinkerforge/__init__.py', 'wb').write(' ') # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/egg', root, version)
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 finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.cs$') for example in examples: shutil.copy(example[1], '/tmp/generator/dll/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/dll/source/Tinkerforge') shutil.copy(os.path.join(root, 'IPConnection.cs'), '/tmp/generator/dll/source/Tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/dll') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/dll') # Write AssemblyInfo version = common.get_changelog_version(root) file('/tmp/generator/dll/source/Tinkerforge/AssemblyInfo.cs', 'wb').write(""" using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("C# API Bindings")] [assembly: AssemblyDescription("C# API Bindings for Tinkerforge Bricks and Bricklets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tinkerforge GmbH")] [assembly: AssemblyProduct("C# API Bindings")] [assembly: AssemblyCopyright("Tinkerforge GmbH 2011-2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("{0}.{1}.{2}.0")] """.format(*version)) # Make dll with common.ChangedDirectory('/tmp/generator'): args = [ '/usr/bin/gmcs', '/optimize', '/target:library', '/out:/tmp/generator/dll/Tinkerforge.dll', '/doc:/tmp/generator/dll/Tinkerforge.xml', '/tmp/generator/dll/source/Tinkerforge/*.cs' ] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/dll', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.pas$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Base58.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Device.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'IPConnection.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'LEConverter.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'SHAone.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make Makefile.fpc version = common.get_changelog_version(root_dir) units = sorted([ filename.replace('.pas', '') for filename in os.listdir(self.tmp_source_dir) ]) common.specialize_template( os.path.join(root_dir, 'Makefile.fpc.template'), os.path.join(self.tmp_source_dir, 'Makefile.fpc'), { '<<UNITS>>': ' '.join(units), '<<VERSION>>': '.'.join(version) }) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root_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_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example-.*\.sh$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme shutil.copy(os.path.join(root_dir, 'tinkerforge'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'tinkerforge-bash-completion.sh'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example-.*\.sh$') for example in examples: shutil.copy(example[1], '/tmp/generator/examples') # Copy bindings and readme shutil.copy(os.path.join(root, 'tinkerforge'), '/tmp/generator') shutil.copy(os.path.join(root, 'tinkerforge-bash-completion.sh'), '/tmp/generator') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator') # Make zip version = common.get_changelog_version(root) common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.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_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example_.*\.go$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'ip_connection.go'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Makefile'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.c$') for example in examples: shutil.copy(example[1], '/tmp/generator/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'ip_connection.c'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'ip_connection.h'), '/tmp/generator/bindings') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator') # Make zip version = common.get_changelog_version(root) common.make_zip(self.get_bindings_name(), '/tmp/generator', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^example-.*\.sh$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme shutil.copy(os.path.join(root_dir, 'tinkerforge'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'tinkerforge-bash-completion.sh'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.py$') for example in examples: shutil.copy(example[1], '/tmp/generator/egg/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/egg/source/tinkerforge') shutil.copy(os.path.join(root, 'ip_connection.py'), '/tmp/generator/egg/source/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/egg') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/egg') # Make __init__.py file('/tmp/generator/egg/source/tinkerforge/__init__.py', 'wb').write(' ') # Write setup.py version = common.get_changelog_version(root) file('/tmp/generator/egg/source/setup.py', 'wb').write("""#!/usr/bin/env python from setuptools import setup setup(name='tinkerforge', version='{0}.{1}.{2}', description='Python API Bindings for Tinkerforge Bricks and Bricklets', license='CC0 1.0 Universal', author='Tinkerforge GmbH', author_email='*****@*****.**', url='http://www.tinkerforge.com', packages=['tinkerforge'], platforms = ('Any')) """.format(*version)) # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/egg', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.vb$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_tinkerforge_dir) shutil.copy(os.path.join(root_dir, '..', 'csharp', 'IPConnection.cs'), self.tmp_source_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) # 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)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.pas$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Base58.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BlockingQueue.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'DeviceBase.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'Device.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'IPConnection.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'LEConverter.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'TimedSemaphore.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'SHA1.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'BrickDaemon.pas'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make Makefile.fpc version = common.get_changelog_version(root_dir) units = sorted([filename.replace('.pas', '') for filename in os.listdir(self.tmp_source_dir)]) common.specialize_template(os.path.join(root_dir, 'Makefile.fpc.template'), os.path.join(self.tmp_source_dir, 'Makefile.fpc'), {'<<UNITS>>': ' '.join(units), '<<VERSION>>': '.'.join(version)}) # Make zip version = common.get_changelog_version(root_dir) common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def final(self): print("\nMaking OTA package...") ota_zip = cn.make_zip(self.ota_path) if self.ota_package_name.startswith("/") or re.match( r"[A-Za-z]:\\*", self.ota_package_name): ota_zip_real = self.ota_package_name else: ota_zip_real = os.path.normpath( os.path.join(os.getcwd(), self.ota_package_name)) cn.file2file(ota_zip, ota_zip_real, move=True) self.clean_temp() print("\nDone!") print("\nOutput OTA package: %s !" % ota_zip_real) sys.exit()
def generate(path): # Make temporary generator directory if os.path.exists('/tmp/generator'): shutil.rmtree('/tmp/generator/') os.makedirs('/tmp/generator/bindings') os.chdir('/tmp/generator/bindings') # Copy examples common.generate(path, 'en', make_files, None, False) shutil.copy(common.path_binding.replace('/generators/c', '/doc/en/source/Software/example.c'), '/tmp/generator/examples/example_enumerate.c') # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.[ch]'): shutil.copy(filename, '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.c', '/tmp/generator/bindings') shutil.copy(path + '/ip_connection.h', '/tmp/generator/bindings') shutil.copy(path + '/changelog.txt', '/tmp/generator/') shutil.copy(path + '/readme.txt', '/tmp/generator/') # Make zip version = common.get_changelog_version(path) common.make_zip('c', '/tmp/generator', path, version)
def finish(self): root_dir = self.get_bindings_root_directory() # Copy IP Connection examples for example in common.find_examples(root_dir, '^Example.*\.java$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root_dir, 'bindings', filename), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'BrickDaemon.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'Device.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'DeviceBase.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'DeviceListener.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'IPConnection.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'IPConnectionBase.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'TinkerforgeException.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'TimeoutException.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'AlreadyConnectedException.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'NotConnectedException.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'CryptoException.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'TinkerforgeListener.java'), self.tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make manifest version = common.get_changelog_version(root_dir) file(os.path.join(self.tmp_dir, 'manifest.txt'), 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version)) # Compile source with common.ChangedDirectory(self.tmp_dir): args = [ '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + os.path.join(self.tmp_source_com_tinkerforge_dir, '*.java') ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Make jar with common.ChangedDirectory(self.tmp_source_dir): args = [ '/usr/bin/jar ' + 'cfm ' + os.path.join(self.tmp_dir, 'Tinkerforge.jar') + ' ' + os.path.join(self.tmp_dir, 'manifest.txt') + ' ' + 'com' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove manifest os.remove(os.path.join(self.tmp_dir, 'manifest.txt')) # Remove classes for f in os.listdir(self.tmp_source_com_tinkerforge_dir): if f.endswith('.class'): os.remove(os.path.join(self.tmp_source_com_tinkerforge_dir, f)) # Make zip common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
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)
else: os.mkdir('bin/release/plugins') plugins = 'bin/release/plugins' app_file = 'bin/release/'+ app_name + '.exe' os.path.abspath('qt/bin') deploy_cmd = 'windeployqt --qmldir . --plugindir {} --no-translations --compiler-runtime {}'.format(plugins, app_file) if os_arch == 'mingw': os.environ['PATH'] = os.path.abspath('qt/bin') + ';' + os.path.abspath('mingwTools/bin') + ';' + os.environ['PATH'] elif os_arch == 'msvc': os.environ['PATH'] = os.path.abspath('qt/bin') + ';' + os.environ['PATH'] else: os.environ['PATH'] = os.path.abspath('qt/bin') + ':' + os.environ['PATH'] c.run('{}'.format(deploy_cmd)) if os_arch == 'mingw' or os_arch == 'msvc': archive_name = os.environ['archive_name'] if archive_name: archive_file = '{}.{}'.format(archive_name, 'zip') c.print('>> archive {} from {}'.format(archive_file, os.path.abspath('bin/release/'))) c.delete_extensions_file('bin/release/',('.qmlc','.ilk','.exp','.lib','.pdb','.qml')) c.make_zip('bin/release/', archive_file, mode='w')
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.php$') for example in examples: shutil.copy(example[1], '/tmp/generator/pear/examples') # Copy bindings and readme package_files = [ '<file name="Tinkerforge/IPConnection.php" role="php" />' ] for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/pear/source/Tinkerforge') package_files.append( '<file name="Tinkerforge/{0}" role="php" />'.format( os.path.basename(filename))) shutil.copy(os.path.join(root, 'IPConnection.php'), '/tmp/generator/pear/source/Tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/pear') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/pear') # Write package.xml version = common.get_changelog_version(root) date = datetime.datetime.now().strftime("%Y-%m-%d") file('/tmp/generator/pear/source/package.xml', 'wb').write("""<?xml version="1.0" encoding="UTF-8"?> <package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"> <name>Tinkerforge</name> <uri>http://download.tinkerforge.com/bindings/php/pear/Tinkerforge-{2}.{3}.{4}</uri> <summary>PHP API Bindings for Tinkerforge Bricks and Bricklets</summary> <description>no description</description> <lead> <name>Matthias Bolte</name> <user>matthias</user> <email>[email protected]</email> <active>yes</active> </lead> <date>{0}</date> <version> <release>{2}.{3}.{4}</release> <api>{2}.{3}.{4}</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>Public Domain</license> <notes>no notes</notes> <contents> <dir name="Tinkerforge"> {1} </dir> </contents> <dependencies> <required> <php> <min>5.3.0</min> </php> <pearinstaller> <min>1.9.0</min> </pearinstaller> </required> </dependencies> <phprelease /> </package> """.format(date, '\n '.join(package_files), *version)) # Make PEAR package with common.ChangedDirectory('/tmp/generator/pear/source'): args = ['/usr/bin/pear', 'package', 'package.xml'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove build stuff shutil.move( '/tmp/generator/pear/source/Tinkerforge-{0}.{1}.{2}.tgz'.format( *version), '/tmp/generator/pear/Tinkerforge.tgz') os.remove('/tmp/generator/pear/source/package.xml') # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/pear', root, version)
def finish(self): root_dir = self.get_bindings_root_directory() for flavor in ['matlab', 'octave']: tmp_dir = self.tmp_flavor_dir[flavor] tmp_source_dir = self.tmp_flavor_source_dir[flavor] tmp_source_com_tinkerforge_dir = self.tmp_flavor_source_com_tinkerforge_dir[ flavor] tmp_examples_dir = self.tmp_flavor_examples_dir[flavor] # Copy IP Connection examples for example in common.find_examples(root_dir, '^example_.*\.m$'): shutil.copy(example[1], tmp_examples_dir) # Copy bindings and readme for filename in released_files: shutil.copy( os.path.join(root_dir, 'bindings_' + flavor, filename), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'BrickDaemon.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceBase.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'Device_{0}.java'.format(flavor)), os.path.join(tmp_source_com_tinkerforge_dir, 'Device.java')) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceListener.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'IPConnection_{0}.java'.format(flavor)), os.path.join(tmp_source_com_tinkerforge_dir, 'IPConnection.java')) shutil.copy( os.path.join(root_dir, '..', 'java', 'IPConnectionBase.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TinkerforgeException.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TimeoutException.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'AlreadyConnectedException.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'NotConnectedException.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'CryptoException.java'), tmp_source_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TinkerforgeListener.java'), tmp_source_com_tinkerforge_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make manifest version = common.get_changelog_version(root_dir) file(os.path.join(tmp_dir, 'manifest.txt'), 'wb').write( 'Bindings-Version: {1}.{2}.{3}\nBindings-Flavor: {0}\n'.format( flavor.upper(), *version)) # Make jar with common.ChangedDirectory(tmp_dir): if flavor == 'octave': classpath = '-classpath {0} '.format( os.path.join(root_dir, 'octave.jar')) else: classpath = '' args = [ '/usr/bin/javac ' + classpath + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + os.path.join(tmp_source_com_tinkerforge_dir, '*.java') ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format( ' '.join(args))) with common.ChangedDirectory(tmp_source_dir): args = [ '/usr/bin/jar ' + 'cfm ' + os.path.join(tmp_dir, 'Tinkerforge.jar') + ' ' + os.path.join(tmp_dir, 'manifest.txt') + ' ' + 'com' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format( ' '.join(args))) # Remove manifest os.remove(os.path.join(tmp_dir, 'manifest.txt')) # Remove classes for f in os.listdir(tmp_source_com_tinkerforge_dir): if f.endswith('.class'): os.remove(os.path.join(tmp_source_com_tinkerforge_dir, f)) # Make zip common.make_zip(self.get_bindings_name(), self.tmp_dir, root_dir, version)
def finish(self): root = self.get_bindings_root_directory() version = common.get_changelog_version(root) dot_version = "{0}.{1}.{2}".format(*version) # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.pl$') for example in examples: shutil.copy(example[1], '/tmp/generator/cpan/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/cpan/source/lib/Tinkerforge') shutil.copy(os.path.join(root, 'IPConnection.pm'), '/tmp/generator/cpan/source/lib/Tinkerforge') shutil.copy(os.path.join(root, 'Device.pm'), '/tmp/generator/cpan/source/lib/Tinkerforge') shutil.copy(os.path.join(root, 'Error.pm'), '/tmp/generator/cpan/source/lib/Tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/cpan') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/cpan') # Generate the CPAN package structure modules = [] for filename in released_files: modules.append('Tinkerforge::' + filename.replace('.pm', '')) modules.append("Tinkerforge::IPConnection") modules.append("Tinkerforge::Device") modules.append("Tinkerforge::Error") modules.append("Tinkerforge") modules = ','.join(modules) if os.path.exists('/tmp/generator/cpan/Tinkerforge'): shutil.rmtree('/tmp/generator/cpan/Tinkerforge') subprocess.call( "module-starter --dir=/tmp/generator/cpan/Tinkerforge --module={0} --distro=Tinkerforge" " --author=\"Ishraq Ibne Ashraf\" [email protected]". format(modules), shell=True) # Version replacing common.replace_in_file( os.path.join(root, 'Tinkerforge.pm.template'), '/tmp/generator/cpan/Tinkerforge/lib/Tinkerforge.pm', '<TF_API_VERSION>', dot_version) shutil.copy('/tmp/generator/cpan/Tinkerforge/lib/Tinkerforge.pm', '/tmp/generator/cpan/source/lib') common.replace_in_file(os.path.join(root, 'README.template'), '/tmp/generator/cpan/Tinkerforge/README', '<TF_API_VERSION>', dot_version) # Copying bindings subprocess.call( "rm -rf /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/*", shell=True) for filename in released_files: subprocess.call( "cp -ar {0}/bindings/{1} /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/" .format(root, filename), shell=True) # Copying IPconnection.pm, Device.pm and Error.pm subprocess.call( "cp -ar {0}/IPConnection.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/" .format(root), shell=True) subprocess.call( "cp -ar {0}/Device.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/" .format(root), shell=True) subprocess.call( "cp -ar {0}/Error.pm /tmp/generator/cpan/Tinkerforge/lib/Tinkerforge/" .format(root), shell=True) # Copying Changes subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/Changes", shell=True) subprocess.call( "cp -ar {0}/changelog.txt /tmp/generator/cpan/Tinkerforge/Changes". format(root), shell=True) # Copying Makefile.PL subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/Makefile.PL", shell=True) subprocess.call( "cp {0}/Makefile.PL /tmp/generator/cpan/Tinkerforge/Makefile.PL". format(root), shell=True) subprocess.call( "cp {0}/Makefile.PL /tmp/generator/cpan/source/Makefile.PL".format( root), shell=True) # Modifying 00-load.t test file old_test_file = open('/tmp/generator/cpan/Tinkerforge/t/00-load.t') lines = old_test_file.readlines() old_test_file.close() subprocess.call("rm -rf /tmp/generator/cpan/Tinkerforge/t/00-load.t", shell=True) new_test_file = open('/tmp/generator/cpan/Tinkerforge/t/00-load.t', 'w') for i, line in enumerate(lines): if i == len(lines) - 1: new_test_file.write( "diag( \"Testing Tinkerforge $Tinkerforge::VERSION, Perl $], $^X\" );" ) else: new_test_file.write(line + "\n") new_test_file.close() # Generating the CPAN package archive and cleaning up subprocess.call( "cd /tmp/generator/cpan/Tinkerforge/ && perl /tmp/generator/cpan/Tinkerforge/Makefile.PL", shell=True) subprocess.call("cd /tmp/generator/cpan/Tinkerforge/ && make dist", shell=True) shutil.copy( "/tmp/generator/cpan/Tinkerforge/Tinkerforge-{0}.{1}.{2}.tar.gz". format(*version), root) shutil.rmtree('/tmp/generator/cpan/Tinkerforge') # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/cpan', root, version)
def finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^Example.*\.java$') for example in examples: shutil.copy(example[1], '/tmp/generator/jar/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'BrickDaemon.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'Device.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'DeviceBase.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'DeviceListener.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'IPConnection.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'IPConnectionBase.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TinkerforgeException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TimeoutException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'AlreadyConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'NotConnectedException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'CryptoException.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'TinkerforgeListener.java'), '/tmp/generator/jar/source/com/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/jar') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/jar') # Make Manifest version = common.get_changelog_version(root) file('/tmp/generator/manifest.txt', 'wb').write('Bindings-Version: {0}.{1}.{2}\n'.format(*version)) # Make jar with common.ChangedDirectory('/tmp/generator'): args = [ '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + '/tmp/generator/jar/source/com/tinkerforge/*.java' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) with common.ChangedDirectory('/tmp/generator/jar/source'): args = [ '/usr/bin/jar ' + 'cfm ' + '/tmp/generator/jar/Tinkerforge.jar ' + '/tmp/generator/manifest.txt ' + 'com' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove class for f in os.listdir('/tmp/generator/jar/source/com/tinkerforge/'): if f.endswith('.class'): os.remove('/tmp/generator/jar/source/com/tinkerforge/' + f) # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root, version)
def finish(self): octave_jar_path = '-classpath {0} '.format( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'octave.jar')) root = self.get_bindings_root_directory() for flavor in ['matlab', 'octave']: jar_root = '/tmp/generator/jar/' + flavor # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.m$') for example in examples: shutil.copy(example[1], jar_root + '/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings_' + flavor, filename), jar_root + '/source/com/tinkerforge') shutil.copy(os.path.join(root, '..', 'java', 'BrickDaemon.java'), jar_root + '/source/com/tinkerforge') shutil.copy(os.path.join(root, '..', 'java', 'DeviceBase.java'), jar_root + '/source/com/tinkerforge') shutil.copy(os.path.join(root, 'Device_{0}.java'.format(flavor)), jar_root + '/source/com/tinkerforge/Device.java') shutil.copy( os.path.join(root, '..', 'java', 'DeviceListener.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, 'IPConnection_{0}.java'.format(flavor)), jar_root + '/source/com/tinkerforge/IPConnection.java') shutil.copy( os.path.join(root, '..', 'java', 'IPConnectionBase.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'TinkerforgeException.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'TimeoutException.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'AlreadyConnectedException.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'NotConnectedException.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'CryptoException.java'), jar_root + '/source/com/tinkerforge') shutil.copy( os.path.join(root, '..', 'java', 'TinkerforgeListener.java'), jar_root + '/source/com/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/jar/') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/jar/') # Make Manifest version = common.get_changelog_version(root) file('/tmp/generator/manifest.txt', 'wb').write( 'Bindings-Version: {1}.{2}.{3}\nBindings-Flavor: {0}\n'.format( flavor.upper(), *version)) # Make jar with common.ChangedDirectory('/tmp/generator'): if flavor == 'octave': args = [ '/usr/bin/javac ' + octave_jar_path + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + jar_root + '/source/com/tinkerforge/*.java' ] else: args = [ '/usr/bin/javac ' + '-Xlint ' + '-source 1.5 ' + '-target 1.5 ' + jar_root + '/source/com/tinkerforge/*.java' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format( ' '.join(args))) with common.ChangedDirectory(jar_root + '/source'): args = [ '/usr/bin/jar ' + 'cfm ' + jar_root + '/Tinkerforge.jar ' + '/tmp/generator/manifest.txt ' + 'com' ] if subprocess.call(args, shell=True) != 0: raise Exception("Command '{0}' failed".format( ' '.join(args))) # Remove class for f in os.listdir(jar_root + '/source/com/tinkerforge/'): if f.endswith('.class'): os.remove(jar_root + '/source/com/tinkerforge/' + f) # FIXME: remove this shutil.copy(jar_root + '/Tinkerforge.jar', root + '/Tinkerforge_' + flavor + '.jar') # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/jar', root, version)
def finish(self): root_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 finish(self): root = self.get_bindings_root_directory() # Copy IPConnection examples examples = common.find_examples(root, '^example_.*\.rb$') for example in examples: shutil.copy(example[1], '/tmp/generator/gem/examples') # Copy bindings and readme for filename in released_files: shutil.copy(os.path.join(root, 'bindings', filename), '/tmp/generator/gem/source/lib/tinkerforge') shutil.copy(os.path.join(root, 'ip_connection.rb'), '/tmp/generator/gem/source/lib/tinkerforge') shutil.copy(os.path.join(root, 'changelog.txt'), '/tmp/generator/gem') shutil.copy(os.path.join(root, 'readme.txt'), '/tmp/generator/gem') # Write version.rb version = common.get_changelog_version(root) file('/tmp/generator/gem/source/lib/tinkerforge/version.rb', 'wb').write(""" module Tinkerforge VERSION = '{0}.{1}.{2}' end """.format(*version)) # Write tinkerforge.rb file('/tmp/generator/gem/source/lib/tinkerforge.rb', 'wb').write(""" require 'tinkerforge/version' module Tinkerforge end """) # Write tinkerforge.gemspec file('/tmp/generator/gem/source/tinkerforge.gemspec', 'wb').write(""" spec = Gem::Specification.new do |s| s.name = 'tinkerforge' s.version = '{0}.{1}.{2}' s.summary = 'Ruby API Bindings for Tinkerforge Bricks and Bricklets' s.files = Dir['lib/*.rb'] + Dir['lib/tinkerforge/*.rb'] s.has_rdoc = true s.rdoc_options << '--title' << 'Tinkerforge' s.required_ruby_version = '>= 1.9.0' s.license = 'CC0-1.0' s.author = 'Matthias Bolte' s.email = '*****@*****.**' s.homepage = 'http://www.tinkerforge.com/' end """.format(*version)) # Make gem with common.ChangedDirectory('/tmp/generator/gem/source'): args = ['/usr/bin/gem', 'build', 'tinkerforge.gemspec'] if subprocess.call(args) != 0: raise Exception("Command '{0}' failed".format(' '.join(args))) # Remove build stuff os.remove('/tmp/generator/gem/source/tinkerforge.gemspec') shutil.copy( '/tmp/generator/gem/source/tinkerforge-{0}.{1}.{2}.gem'.format( *version), root) shutil.move( '/tmp/generator/gem/source/tinkerforge-{0}.{1}.{2}.gem'.format( *version), '/tmp/generator/gem/tinkerforge.gem') shutil.move('/tmp/generator/gem/source/lib/tinkerforge.rb', '/tmp/generator/gem/source/') os.makedirs('/tmp/generator/gem/source/tinkerforge') for filename in glob.glob( '/tmp/generator/gem/source/lib/tinkerforge/*.rb'): shutil.move(filename, '/tmp/generator/gem/source/tinkerforge/') shutil.rmtree('/tmp/generator/gem/source/lib/') # Make zip common.make_zip(self.get_bindings_name(), '/tmp/generator/gem', root, version)