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 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): 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/dll/source/Tinkerforge') os.chdir('/tmp/generator') # Copy examples common.import_and_make(configs, path, make_files) # 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 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/jar/source/com/tinkerforge') os.chdir('/tmp/generator') # Copy examples common.import_and_make(configs, path, make_files) # 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 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/egg/source/tinkerforge') os.chdir('/tmp/generator') # Copy examples common.import_and_make(configs, path, make_files) # 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'] subprocess.call(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): 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/gem/source/lib/tinkerforge') os.chdir('/tmp/generator') # Copy examples common.import_and_make(configs, path, make_files) # Copy bindings and readme for filename in glob.glob(path + '/bindings/*.rb'): shutil.copy(filename, '/tmp/generator/gem/source/lib/tinkerforge') shutil.copy(path + '/ip_connection.rb', '/tmp/generator/gem/source/lib/tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/gem') shutil.copy(path + '/readme.txt', '/tmp/generator/gem') # Write version.rb version = common.get_changelog_version(path) 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.author = "Matthias Bolte" s.email = "*****@*****.**" s.homepage = "http://www.tinkerforge.com/" end """.format(*version)) # Make gem os.chdir('/tmp/generator/gem/source') args = ['/usr/bin/gem', 'build', 'tinkerforge.gemspec'] subprocess.call(args) # Remove build stuff os.remove('/tmp/generator/gem/source/tinkerforge.gemspec') 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('ruby', '/tmp/generator/gem', path, 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/pear/source/Tinkerforge') os.chdir('/tmp/generator') # Copy examples common.import_and_make(configs, path, make_files) # Copy bindings and readme package_files = ['<file name="Tinkerforge/IPConnection.php" role="php" />'] for filename in glob.glob(path + '/bindings/*.php'): shutil.copy(filename, '/tmp/generator/pear/source/Tinkerforge') package_files.append('<file name="Tinkerforge/{0}" role="php" />'.format(os.path.basename(filename))) shutil.copy(path + '/IPConnection.php', '/tmp/generator/pear/source/Tinkerforge') shutil.copy(path + '/changelog.txt', '/tmp/generator/pear') shutil.copy(path + '/readme.txt', '/tmp/generator/pear') # Write package.xml version = common.get_changelog_version(path) 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 os.chdir('/tmp/generator/pear/source') args = ['/usr/bin/pear', 'package', 'package.xml'] subprocess.call(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('php', '/tmp/generator/pear', path, version)