Ejemplo n.º 1
0
def _notify_linux(title, msg, icon_image):
    icon_path = os.path.join(this_dir, 'resources', 'linux', icon_image)
    notify_send_exec = which('notify-send')
    if notify_send_exec is None:
        return
    subprocess.Popen([notify_send_exec, '-i', icon_path, '-t', '2000', '--hint', 'int:transient:1', title, msg],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
Ejemplo n.º 2
0
def _notify_linux(title, msg):
    icon_path = os.path.join(this_dir, 'resources', 'linux', 'catkin_icon.png')
    notify_send_exec = which('notify-send')
    if notify_send_exec is None:
        return
    subprocess.Popen([notify_send_exec, '-i', icon_path, '-t', '2000', title, msg],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
Ejemplo n.º 3
0
def _notify_osx(title, msg):
    app_path = os.path.join(this_dir, 'resources', 'osx', 'catkin build.app')
    open_exec = which('open')
    if open_exec is None:
        return
    command = [open_exec, app_path, '--args', title, msg]
    terminal = os.environ['TERM_PROGRAM']
    if terminal == "Apple_Terminal":
        command += ["-activate", "com.apple.Terminal"]
    elif terminal == "iTerm.app":
        command += ["-activate", "com.googlecode.iterm2"]
    subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Ejemplo n.º 4
0
def _notify_osx(title, msg):
    app_path = os.path.join(this_dir, 'resources', 'osx', 'catkin build.app')
    open_exec = which('open')
    if open_exec is None:
        return
    command = [open_exec, app_path, '--args', title, msg]
    terminal = os.environ.get('TERM_PROGRAM', None)
    if terminal == "Apple_Terminal":
        command += ["-activate", "com.apple.Terminal"]
    elif terminal == "iTerm.app":
        command += ["-activate", "com.googlecode.iterm2"]
    subprocess.Popen(command,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
Ejemplo n.º 5
0
def _notify_osx(title, msg, icon_image):
    # Note: icon_image is unused on OS X. Maybe it would make more sense
    # to pass a boolean `success' and then let the platform specific
    # notification implementations decide how that translates to icons
    # or what not.
    app_path = os.path.join(this_dir, 'resources', 'osx', 'catkin build.app')
    open_exec = which('open')
    if open_exec is None:
        return
    command = [open_exec, app_path, '--args', title, msg]
    terminal = os.environ.get('TERM_PROGRAM', None)
    if terminal == "Apple_Terminal":
        command += ["-activate", "com.apple.Terminal"]
    elif terminal == "iTerm.app":
        command += ["-activate", "com.googlecode.iterm2"]
    subprocess.Popen(command,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
Ejemplo n.º 6
0
# limitations under the License.

from __future__ import print_function

import os
import re

from catkin_tools.execution.io import IOBufferProtocol
from catkin_tools.execution.events import ExecutionEvent

from catkin_tools.terminal_color import fmt
from catkin_tools.terminal_color import sanitize

from catkin_tools.utils import which

CMAKE_EXEC = which('cmake')
CMAKE_INSTALL_MANIFEST_FILENAME = 'install_manifest.txt'


def split_to_last_line_break(data):
    """This splits a byte buffer into (head, tail) where head contains the
    beginning of the buffer to the last line break (inclusive) and the tail
    contains all bytes after that."""
    last_break_index = 1 + data.rfind(b'\n')
    return data[:last_break_index], data[last_break_index:]


class CMakeIOBufferProtocol(IOBufferProtocol):
    """An asyncio protocol that collects stdout and stderr.

    This class also generates `stdout` and `stderr` events.
Ejemplo n.º 7
0
# Copyright 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from catkin_tools.utils import which

MAKE_EXEC = which('make')
Ejemplo n.º 8
0
# limitations under the License.

from __future__ import print_function

import os
import re

from catkin_tools.execution.io import IOBufferProtocol
from catkin_tools.execution.events import ExecutionEvent

from catkin_tools.terminal_color import fmt
from catkin_tools.terminal_color import sanitize

from catkin_tools.utils import which

CMAKE_EXEC = which('cmake')


def split_to_last_line_break(data):
    """This splits a byte buffer into (head, tail) where head contains the
    beginning of the buffer to the last line break (inclusive) and the tail
    contains all bytes after that."""
    last_break_index = 1 + data.rfind(b'\n')
    return data[:last_break_index], data[last_break_index:]


class CMakeIOBufferProtocol(IOBufferProtocol):

    """An asyncio protocol that collects stdout and stderr.

    This class also generates `stdout` and `stderr` events.
Ejemplo n.º 9
0
from catkin_tools.jobs.cmake import generate_setup_file
from catkin_tools.jobs.cmake import get_python_install_dir

from catkin_tools.jobs.utils import copyfiles
from catkin_tools.jobs.utils import loadenv
from catkin_tools.jobs.utils import makedirs
from catkin_tools.jobs.utils import rmfiles
from catkin_tools.utils import which

from catkin_tools.execution.jobs import Job
from catkin_tools.execution.stages import CommandStage
from catkin_tools.execution.stages import FunctionStage


PYTHON_EXEC = os.environ.get('PYTHON', sys.executable)
RSYNC_EXEC = which('rsync')


def renamepath(logger, event_queue, source_path, dest_path):
    """ FunctionStage functor that renames a file or directory, overwriting the
        destination if present. """
    if os.path.exists(dest_path):
        shutil.rmtree(dest_path)
    os.renames(source_path, dest_path)
    return 0


def fix_shebangs(logger, event_queue, pkg_dir, python_exec):
    """Process all files and change the shebangs if they are set to the global python
       to now use the python exec that we explicitly asked for.  This will ensure that 
       if you are building for python3 and source is using python that it will not use