예제 #1
0
def _get_standard_path():
    if OSInfo.is_win():
        return 'C:/Program Files (x86)/Arduino'
    elif OSInfo.is_linux():
        return '/usr/share/arduino'
    elif OSInfo.is_mac():
        return '/Applications/Arduino.app/Contents/Resources/Java'
예제 #2
0
def _get_standard_path():
    if OSInfo.is_win():
        return 'C:/Program Files (x86)/Arduino'
    elif OSInfo.is_linux():
        return '/usr/share/arduino'
    elif OSInfo.is_mac():
        return '/Applications/Arduino.app/Contents/Resources/Java'
예제 #3
0
파일: cmake.py 프로젝트: MordodeMaru/client
def _install_cmake(user_io, bii_paths):
    user_io.out.writeln('Downloading and installing CMake %s' % _CMAKE_VERSION, front=Color.GREEN)
    if OSInfo.is_win():
        return _install_cmake_win(user_io, bii_paths)
    elif OSInfo.is_mac():
        return _install_cmake_mac(user_io)
    elif OSInfo.is_linux():
        return _install_cmake_linux(user_io, bii_paths)
예제 #4
0
def _install_cmake(user_io, bii_paths):
    user_io.out.writeln('Downloading and installing CMake %s' % _CMAKE_VERSION,
                        front=Color.GREEN)
    if OSInfo.is_win():
        return _install_cmake_win(user_io, bii_paths)
    elif OSInfo.is_mac():
        return _install_cmake_mac(user_io)
    elif OSInfo.is_linux():
        return _install_cmake_linux(user_io, bii_paths)
예제 #5
0
def _get_all_arduino_sdk_paths():
    """Get all the paths we need to look at an SDK"""
    paths_to_look = [_get_standard_path()]
    for compatible in ARDUINO_SDK_COMPATIBLE_VERSIONS:
        version_path = os.path.join(get_biicode_env_folder_path(), "arduino-%s" % compatible)
        if OSInfo.is_mac():
            version_path = os.path.join(version_path, "Arduino.app/Contents/Resources/Java")
        paths_to_look.append(version_path.replace('\\', '/'))
    return paths_to_look
예제 #6
0
def get_arduino_download_url(version):
    if OSInfo.is_win():
        url = S3_URL + "arduino-%s-windows.zip" % version
    elif OSInfo.is_mac():
        url = S3_URL + "arduino-%s-macosx.zip" % version
    elif OSInfo.is_linux():
        if OSInfo.architecture() == "64bit":
            url = S3_URL + "arduino-%s-linux64.tgz" % version
        elif OSInfo.architecture() == "32bit":
            url = S3_URL + "arduino-%s-linux32.tgz" % version
    return url
예제 #7
0
def unzip(filename, destination):
    import zipfile
    with zipfile.ZipFile(filename, "r") as z:
        if OSInfo.is_linux() or OSInfo.is_mac():
            for zinfo in z.filelist:
                zinfo.create_system = 3  # UNIX
        if OSInfo.is_mac():
            for thefile in z.filelist:
                name = thefile.filename
                perm = ((thefile.external_attr >> 16L) & 0777)
                if name.endswith('/'):
                    os.mkdir(os.path.join(destination, name), perm)
                else:
                    outfile = os.path.join(destination, name)
                    fh = os.open(outfile, os.O_CREAT | os.O_WRONLY, perm)
                    os.write(fh, z.read(name))
                    os.close(fh)
            z.close()
        else:
            z.extractall(destination)
예제 #8
0
def get_arduino_download_url(version):
    if OSInfo.is_win():
        url = S3_URL + "arduino-%s-windows.zip" % version
    elif OSInfo.is_mac():
        url = S3_URL + "arduino-%s-macosx.zip" % version
    elif OSInfo.is_linux():
        if OSInfo.architecture() == "64bit":
            url = S3_URL + "arduino-%s-linux64.tgz" % version
        elif OSInfo.architecture() == "32bit":
            url = S3_URL + "arduino-%s-linux32.tgz" % version
    return url
예제 #9
0
def _get_all_arduino_sdk_paths():
    """Get all the paths we need to look at an SDK"""
    paths_to_look = [_get_standard_path()]
    for compatible in ARDUINO_SDK_COMPATIBLE_VERSIONS:
        version_path = os.path.join(get_biicode_env_folder_path(),
                                    "arduino-%s" % compatible)
        if OSInfo.is_mac():
            version_path = os.path.join(version_path,
                                        "Arduino.app/Contents/Resources/Java")
        paths_to_look.append(version_path.replace('\\', '/'))
    return paths_to_look
예제 #10
0
def unzip(filename, destination):
    import zipfile
    with zipfile.ZipFile(filename, "r") as z:
        if OSInfo.is_linux() or OSInfo.is_mac():
            for zinfo in z.filelist:
                zinfo.create_system = 3  # UNIX
        if OSInfo.is_mac():
            for thefile in z.filelist:
                name = thefile.filename
                perm = ((thefile.external_attr >> 16L) & 0777)
                if name.endswith('/'):
                    os.mkdir(os.path.join(destination, name), perm)
                else:
                    outfile = os.path.join(destination, name)
                    fh = os.open(outfile, os.O_CREAT | os.O_WRONLY, perm)
                    os.write(fh, z.read(name))
                    os.close(fh)
            z.close()
        else:
            z.extractall(destination)
예제 #11
0
def _get_cmake_download_url():
    if OSInfo.is_win():
        url = S3_URL + "cmake-%s-win32-x86.zip" % _CMAKE_VERSION
    elif OSInfo.is_mac():
        url = S3_URL + 'cmake-%s-Darwin64-universal.dmg' % _CMAKE_VERSION
    elif OSInfo.is_linux():
        import platform
        if OSInfo.architecture() == "64bit":
            url = S3_URL + "cmake-%s-Linux-64.tar.gz" % _CMAKE_VERSION
        elif OSInfo.architecture() == "32bit":
            url = S3_URL + "cmake-%s-Linux-i386.tar.gz" % _CMAKE_VERSION
        if platform.machine() == "armv6l" or platform.machine() == "armv7l":
            url = S3_URL + "cmake-%s-Linux-armv6.tar.gz" % _CMAKE_VERSION
    return url
예제 #12
0
파일: cmake.py 프로젝트: MordodeMaru/client
def _get_cmake_download_url():
    if OSInfo.is_win():
        url = S3_URL + "cmake-%s-win32-x86.zip" % _CMAKE_VERSION
    elif OSInfo.is_mac():
        url = S3_URL + 'cmake-%s-Darwin64-universal.dmg' % _CMAKE_VERSION
    elif OSInfo.is_linux():
        import platform
        if OSInfo.architecture() == "64bit":
            url = S3_URL + "cmake-%s-Linux-64.tar.gz" % _CMAKE_VERSION
        elif OSInfo.architecture() == "32bit":
            url = S3_URL + "cmake-%s-Linux-i386.tar.gz" % _CMAKE_VERSION
        if platform.machine() == "armv6l" or platform.machine() == "armv7l":
            url = S3_URL + "cmake-%s-Linux-armv6.tar.gz" % _CMAKE_VERSION
    return url
예제 #13
0
def install_gnu(user_io, optional):
    if _valid_gnu_version(user_io):
        return

    if OSInfo.is_mac():
        user_io.out.warn('A new window will open, please click on "Obtain Xcode" and install'
                         'Xcode from AppStore')
        os.system('xcode-select --install')
        user_io.request_string('Please press ENTER when finished installing cmake')
    elif OSInfo.is_linux():
        user_io.out.warn('Installing as "sudo", enter "sudo" password if requested')
        if OSInfo.is_debian_based_linux():
            os.system('sudo apt-get install build-essential')
        elif OSInfo.is_redhat_based_linux():
            os.system('sudo yum -y install wget make automake gcc gcc-c++ kernel-devel')
    else:
        return install_mingw(user_io, optional)
예제 #14
0
def install_gnu(user_io, optional):
    if _valid_gnu_version(user_io):
        return

    if OSInfo.is_mac():
        user_io.out.warn(
            'A new window will open, please click on "Obtain Xcode" and install'
            'Xcode from AppStore')
        os.system('xcode-select --install')
        user_io.request_string(
            'Please press ENTER when finished installing cmake')
    elif OSInfo.is_linux():
        user_io.out.warn(
            'Installing as "sudo", enter "sudo" password if requested')
        if OSInfo.is_debian_based_linux():
            os.system('sudo apt-get install build-essential')
        elif OSInfo.is_redhat_based_linux():
            os.system(
                'sudo yum -y install wget make automake gcc gcc-c++ kernel-devel'
            )
    else:
        return install_mingw(user_io, optional)
예제 #15
0
def _get_install_arduino_sdk_path(version):
    if OSInfo.is_mac():
        decompress_to_folder = os.path.join(get_biicode_env_folder_path(), "arduino-%s" % version)
    else:
        decompress_to_folder = get_biicode_env_folder_path()
    return decompress_to_folder