Пример #1
0
def install_arduino(version):
    '''1.5 is not working
    '''
    require_deb_packages('''
                arduino

                    '''
                         )
    require.python.packages(
        split_packages('''
                    confduino
                    ino
                    nanpy
                    '''),
        use_sudo=True,
    )

    arch64 = get_arch() == 'x86_64'

    if version.startswith('00'):
        version_group = '00'
    elif version_as_list(version) >= version_as_list('1.5'):
        version_group = '1.5'
    else:
        version_group = '1.0'

    if version_group == '00':
        arch_tag = '-64' if arch64 else ''
        tarball = 'arduino-%(version)s%(arch_tag)s.tgz' % locals()
    else:
        use32 = version_as_list(version) >= version_as_list('1.0.3')
        arch_tag = '64' if arch64 else ('32' if use32 else '')
        tarball = 'arduino-%(version)s-linux%(arch_tag)s.tgz' % locals()

    if version_group == '1.5':
        download_url = DOWNLOAD_URL2
    else:
        download_url = DOWNLOAD_URL1

    bin_template = """
    ROOT=%(install_path)s
    #env ARDUINO_HOME=$ROOT python -m confduino.exampallcreate

    export LD_LIBRARY_PATH=/usr/lib/jni
    $ROOT/arduino
    """

    url = '%(download_url)s%(tarball)s' % locals()
    name = 'arduino'
    root_directory = '%(name)s-%(version)s' % locals()
    install_tarball(url=url,
                    tarball=tarball,
                    name=name,
                    version=version,
                    bin_template=bin_template,
                    root_directory=root_directory
                    )