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_.*\.pl$'): 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, '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 = self.get_changelog_version() 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 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)
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', '/warnaserror', '/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 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 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_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', '/warnaserror', '/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_.*\.c$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and merge symbols symbols = 'EXPORTS\n' if self.get_config_name().space == 'Tinkerforge': with open(os.path.join(root_dir, 'ip_connection.symbols'), 'r') as f: symbols += f.read() for filename in self.get_released_files(): path = os.path.join(self.get_bindings_dir(), filename) if path.endswith('.symbols'): with open(path, 'r') as f: symbols += f.read() else: shutil.copy(path, self.tmp_source_dir) with open( os.path.join(self.tmp_source_dir, self.get_config_name().under + '.def'), 'w') as f: f.write(symbols) if self.get_config_name().space == 'Tinkerforge': 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) else: shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'custom.txt'), os.path.join(self.tmp_dir, 'readme.txt')) # Make zip self.create_zip_file(self.tmp_dir)
def prepare(self): super().prepare() root_dir = self.get_root_dir() # Create directories os.makedirs(self.tmp_examples_dir) os.makedirs(self.tmp_source_dir) os.makedirs(self.tmp_build_dir) # Copy blockly and closure-library to build directory shutil.copytree(os.path.join(root_dir, '..', '..', 'tvpl-blockly'), self.tmp_build_blockly_dir, ignore=shutil.ignore_patterns('*/.git')) shutil.copytree(os.path.join(root_dir, '..', '..', 'tvpl-closure-library'), self.tmp_build_closure_library_dir, ignore=shutil.ignore_patterns('*/.git', '*_test.js')) # Copy css/, js/, index.html and programEditor.html shutil.copytree(os.path.join(root_dir, 'css'), os.path.join(self.tmp_source_dir, 'css')) shutil.copytree(os.path.join(root_dir, 'js'), os.path.join(self.tmp_source_dir, 'js')) shutil.copy(os.path.join(root_dir, 'index.html'), self.tmp_source_dir) shutil.copy(os.path.join(root_dir, 'programEditor.html'), self.tmp_source_dir) # Copy general examples for example in common.find_examples(root_dir, r'^example_.*\.tvpl$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy changelog.txt and readme.txt shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme-alpha.txt'), self.tmp_dir) # Generate JavaScript bindings with common.ChangedDirectory(os.path.join(root_dir, '..', 'javascript')): common.execute(['python2', 'generate_javascript_bindings.py']) common.execute(['python2', 'generate_javascript_zip.py']) shutil.copy( os.path.join(self.tmp_javascript_dir, 'browser', 'source', 'Tinkerforge.js'), os.path.join(self.tmp_source_dir, 'js', 'Tinkerforge.js'))
def finish(self): root_dir = self.get_root_dir() bindings_dir = self.get_bindings_dir() # Copy IP Connection examples if self.get_config_name().space == 'Tinkerforge': for example in common.find_examples(root_dir, r'^example-.*\.sh$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme shutil.copy(os.path.join(bindings_dir, 'tinkerforge'), self.tmp_dir) shutil.copy(os.path.join(bindings_dir, 'tinkerforge-bash-completion.sh'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) # Make zip self.create_zip_file(self.tmp_dir)
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.*\.vb$'): 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>>': 'Visual Basic .NET', '<<VERSION>>': '.'.join(version) }) # Make dll with common.ChangedDirectory(self.tmp_dir): common.execute([ 'mcs', '/optimize+', '/warn:4', '/warnaserror', '/sdk:2', '/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_root_dir() bindings_dir = self.get_bindings_dir() # Copy IP Connection examples if self.get_config_name().space == 'Tinkerforge': for example in common.find_examples(root_dir, r'^example-.*\.txt$'): shutil.copy(example[1], self.tmp_examples_dir) # Copy bindings and readme shutil.copy( os.path.join(bindings_dir, '{}_mqtt'.format(self.get_config_name().under)), self.tmp_dir) common.specialize_template( os.path.join(root_dir, 'tinkerforge_mqtt.zip-service.template'), os.path.join( self.tmp_dir, '{}_mqtt.service'.format(self.get_config_name().under)), { "<<CONFIG_NAME_SPACE>>": self.get_config_name().space, "<<CONFIG_NAME_UNDER>>": self.get_config_name().under }) if self.get_config_name().space == 'Tinkerforge': shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) else: shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'custom.txt'), os.path.join(self.tmp_dir, 'readme.txt')) # 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.*\.pas$'): 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_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 = self.get_changelog_version() 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() if self.get_config_name().space == 'Tinkerforge': shutil.copy(os.path.join(root_dir, 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'readme.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, '..', 'configs', 'license.txt'), self.tmp_dir) else: shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'), self.tmp_dir) for flavor in ['matlab', 'octave']: tmp_dir = self.tmp_flavor_dir[flavor] tmp_source_dir = self.tmp_flavor_source_dir[flavor] tmp_source_src_main_java_com_tinkerforge_dir = self.tmp_flavor_source_src_main_java_com_tinkerforge_dir[ flavor] tmp_source_src_main_resources_metainf_services_dir = self.tmp_flavor_source_src_main_resources_metainf_services_dir[ flavor] tmp_source_src_main_resources_com_tinkerforge_dir = self.tmp_flavor_source_src_main_resources_com_tinkerforge_dir[ flavor] tmp_source_target_dir = self.tmp_flavor_source_target_dir[flavor] tmp_examples_dir = self.tmp_flavor_examples_dir[flavor] # Copy IP Connection examples if self.get_config_name().space == 'Tinkerforge': for example in common.find_examples( root_dir, '^' + flavor + r'_example_.*\.m$'): shutil.copy(example[1], tmp_examples_dir) # Copy bindings and readme for filename in self.get_released_files(): shutil.copy( os.path.join(root_dir, self.get_bindings_dir(), flavor, filename), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(self.get_bindings_dir(), flavor, 'com.tinkerforge.DeviceProvider'), tmp_source_src_main_resources_metainf_services_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'BrickDaemon.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceBase.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'Device_{0}.java'.format(flavor)), os.path.join(tmp_source_src_main_java_com_tinkerforge_dir, 'Device.java')) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceListener.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceProvider.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceFactory.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'IPConnection_{0}.java'.format(flavor)), os.path.join(tmp_source_src_main_java_com_tinkerforge_dir, 'IPConnection.java')) shutil.copy( os.path.join(root_dir, '..', 'java', 'IPConnectionBase.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TinkerforgeException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TimeoutException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'AlreadyConnectedException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'NotConnectedException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'CryptoException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'NetworkException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'StreamOutOfSyncException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'InvalidParameterException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'NotSupportedException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'UnknownErrorCodeException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'WrongDeviceTypeException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'DeviceReplacedException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'WrongResponseLengthException.java'), tmp_source_src_main_java_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, '..', 'java', 'TinkerforgeListener.java'), tmp_source_src_main_java_com_tinkerforge_dir) if flavor == 'octave': shutil.copy(os.path.join(root_dir, 'liboctaveinvokewrapper.c'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-linux-i386.so'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-linux-amd64.so'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-linux-arm.so'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-windows-x86.dll'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-windows-amd64.dll'), tmp_source_src_main_resources_com_tinkerforge_dir) shutil.copy( os.path.join(root_dir, 'liboctaveinvokewrapper-macos-x86_64.dynlib'), tmp_source_src_main_resources_com_tinkerforge_dir) # Make pom.xml version = self.get_changelog_version() if self.get_config_name().space == 'Tinkerforge': common.specialize_template( os.path.join(root_dir, 'pom.xml.{0}-jar-template'.format(flavor)), os.path.join(tmp_source_dir, 'pom.xml'), {'{{VERSION}}': '.'.join(version)}) else: common.specialize_template( os.path.join(root_dir, 'pom.xml.{0}-custom-template'.format(flavor)), os.path.join(tmp_source_dir, 'pom.xml'), { '{{CONFIG_NAME}}': self.get_config_name().dash, '{{VERSION}}': '.'.join(version), '{{TINKERFORGE_VERSION}}': '.'.join(common.get_changelog_version(root_dir)) }) # Compile source with common.ChangedDirectory(tmp_source_dir): # FIXME: maven-toolchains-plugin doesn't stop the default JDK from # leaking into the build process. it is still necessary to set # JAVA_HOME to Java 8 in order to stop the default JDK from # being recorded as the Build-Jdk-Spec in the manifest file. env = dict(os.environ) env['JAVA_HOME'] = java_common.detect_java_home() common.execute(['mvn', 'clean', 'install'], env=env) os.rename( os.path.join( tmp_source_target_dir, '{0}-{1}-{2}.{3}.{4}.jar'.format( self.get_config_name().dash, flavor, *version)), os.path.join(tmp_dir, '{0}.jar'.format(self.get_config_name().camel))) shutil.rmtree(tmp_source_target_dir) # 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.*\.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) # Ensure local browserify is installed browserify_dir = os.path.join(root_dir, 'browserify') browserify_version_path = os.path.join(browserify_dir, 'version') try: with open(browserify_version_path, 'r') as f: browserify_version = int(f.read().strip()) except: browserify_version = None if browserify_version != 1: print('installing/updating local browserify installation') if os.path.exists(browserify_dir): shutil.rmtree(browserify_dir) os.mkdir(browserify_dir) with open(os.path.join(browserify_dir, 'package.json'), 'w') as f: f.write('{"dependencies": {"browserify": "13.1.1"}}\n') with common.ChangedDirectory(browserify_dir): common.execute(['npm', 'install']) self.patch_package_lock( os.path.join(browserify_dir, 'package-lock.json')) shutil.rmtree(os.path.join(browserify_dir, 'node_modules')) with common.ChangedDirectory(browserify_dir): common.execute(['npm', 'install', '--no-save']) with open(os.path.join(browserify_dir, 'version'), 'w') as f: f.write('1\n') # Make Tinkerforge.js for browser with browserify with common.ChangedDirectory(self.tmp_nodejs_source_tinkerforge_dir): args = [ 'node', os.path.join(browserify_dir, 'node_modules', 'browserify', 'bin', 'cmd.js') ] 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)
def finish(self): if self.get_config_name().space != 'Tinkerforge': return root_dir = self.get_root_dir() # Copy IP Connection examples if self.get_config_name().space == 'Tinkerforge': for example in common.find_examples(root_dir, r'^example_.*\.rs$'): shutil.copy(example[1], self.tmp_examples_dir) for filename in self.get_released_files(): path = os.path.join(self.get_bindings_dir(), filename) shutil.copy(path, self.tmp_bindings_dir) source_files = [ 'base58.rs', 'converting_receiver.rs', 'converting_callback_receiver.rs', 'converting_high_level_callback_receiver.rs', 'device.rs', 'ip_connection.rs', 'low_level_traits.rs', ] bindings_files = ['mod.rs'] bindings_source_files = ['lib.rs', 'byte_converter.rs'] bindings_top_level_files = ['Cargo.toml'] top_level_files = [ '.gitignore', 'rustfmt.toml', 'changelog.txt', 'readme.txt', 'readme.md', 'LICENSE-APACHE', 'LICENSE-CC0', 'LICENSE-MIT' ] if self.get_config_name().space == 'Tinkerforge': for f in top_level_files: shutil.copy(os.path.join(root_dir, f), self.tmp_dir) for f in source_files: shutil.copy(os.path.join(root_dir, f), self.tmp_source_dir) for f in bindings_files: shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_bindings_dir) for f in bindings_source_files: shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_source_dir) for f in bindings_top_level_files: shutil.copy(os.path.join(root_dir, 'bindings', f), self.tmp_dir) else: shutil.copy(os.path.join(self.get_config_dir(), 'changelog.txt'), self.tmp_dir) shutil.copy(os.path.join(root_dir, 'custom.txt'), os.path.join(self.tmp_dir, 'readme.txt')) output = subprocess.check_output( ["cargo", "fmt"], cwd=self.tmp_dir, stderr=subprocess.STDOUT).decode('utf-8').strip() if len(output) > 0: print("Got the following output from cargo fmt:") print(output) # 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_.*\.go$'): shutil.copy(example[1], self.tmp_examples_dir) for filename in self.get_released_files(): path = os.path.join(self.get_bindings_dir(), filename) target_folder = os.path.splitext(os.path.basename(filename))[0] target_folder = os.path.join(self.tmp_bindings_dir, target_folder) os.makedirs(target_folder) shutil.copy(path, os.path.join(target_folder, filename)) if self.get_config_name().space == 'Tinkerforge': copy_map = { "internal": [ 'base58.go', 'byteconverter.go', 'device.go', 'bindings/device_display_names.go', 'ipconnection.go' ], "ipconnection": ["ipcon_handle.go"], "": ["doc.go"] } top_level_files = [ (os.path.join(root_dir, 'changelog.txt'), 'changelog.txt'), (os.path.join(root_dir, 'readme.txt'), 'readme.txt'), (os.path.join(root_dir, 'LICENSE'), 'LICENSE') ] else: copy_map = {"": ["doc.go"]} top_level_files = [ (os.path.join(self.get_config_dir(), 'changelog.txt'), 'changelog.txt'), (os.path.join(root_dir, 'custom.txt'), 'readme.txt') ] for s, t in top_level_files: shutil.copy(s, os.path.join(self.tmp_dir, t)) for dir, files in copy_map.items(): path = os.path.join(self.tmp_bindings_dir, dir) if not os.path.exists(path): os.makedirs(path) for f in files: shutil.copy(os.path.join(root_dir, f), path) output = subprocess.check_output( ["go", "fmt"], cwd=self.tmp_bindings_dir, stderr=subprocess.STDOUT).decode('utf-8').strip() if len(output) > 0: print("Got the following output from go fmt:") print(output) # Make zip self.create_zip_file(self.tmp_dir)