diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 000000000..6263e7a9f --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,114 @@ +on: + push: + branches: + - master + pull_request: + +env: + DISPLAY: ':0.0' + +jobs: + ros: + runs-on: ubuntu-latest +# continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + include: + - ROS_DISTRO: kinetic + CONTAINER: ubuntu:16.04 + ROS_PARALLEL_TEST_JOBS: "-j8" + CATKIN_PARALLEL_JOBS: "-i" + EXTRA_DEB : "python-lxml" + - ROS_DISTRO: melodic + CONTAINER: ubuntu:18.04 + ROS_PARALLEL_TEST_JOBS: "-j8" + CATKIN_PARALLEL_JOBS: "-i" + - ROS_DISTRO: noetic + CONTAINER: ubuntu:20.04 + ROS_PARALLEL_TEST_JOBS: "-j8" + CATKIN_PARALLEL_JOBS: "-i" + - ROS_DISTRO: noetic + CONTAINER: ubuntu:20.04 + ROS_PARALLEL_TEST_JOBS: "-j8" + CATKIN_PARALLEL_JOBS: "-i" + USE_DEB : false + + + container: ${{ matrix.CONTAINER }} + steps: + - name: Install latest git ( use sudo for ros-ubuntu ) + run: | + (apt-get update && apt-get install -y sudo) || echo "OK" + sudo apt-get update && sudo apt-get install -y software-properties-common && sudo apt-get update && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git + + - name: work around permission issue # https://github.com/actions/checkout/issues/760#issuecomment-1097501613 + run: | + set -x + export USER=$(whoami) + if [ "${{ matrix.CONTAINER }}" = "jskrobotics/ros-ubuntu:14.04" ]; then + git config --global --add safe.directory $GITHUB_WORKSPACE || echo "OK" # Show 'could not lock config file /github/home/.gitconfig: Permission denied', but it is ok + sudo mkdir -p /__w/ + sudo chmod 777 -R /__w/ + sudo chown -R $USER $HOME + # sudo mkdir -p /home/runner/work/_temp/_github_workflow/ + # sudo chown -R $USER $HOME /home/runner/work/_temp/_github_workflow/ + # ls -al /home/runner/work/_temp/_github_workflow/ + else + git config --global --add safe.directory $GITHUB_WORKSPACE + fi + + - name: Chcekout + uses: actions/checkout@v2 + + - name: Start X server + run: | + echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections || echo "failing on ros-ubuntu is OK" # set non interactive tzdata https://stackoverflow.com/questions/8671308/non-interactive-method-for-dpkg-reconfigure-tzdata + sudo apt-get -y -qq install mesa-utils x11-xserver-utils xserver-xorg-video-dummy wget + export DISPLAY=:0 + wget https://raw.githubusercontent.com/jsk-ros-pkg/jsk_travis/master/dummy.xorg.conf -O /tmp/dummy.xorg.conf + sudo Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile /tmp/xorg.log -config /tmp/dummy.xorg.conf $DISPLAY & + sleep 3 # wait x server up + export QT_X11_NO_MITSHM=1 # http://wiki.ros.org/docker/Tutorials/GUI + xhost +local:root + + - name: Run jsk_travis + uses: jsk-ros-pkg/jsk_travis@master + with: + ROS_PARALLEL_JOBS : ${{ matrix.ROS_PARALLEL_JOBS }} + CATKIN_PARALLEL_JOBS : ${{ matrix.CATKIN_PARALLEL_JOBS }} + ROS_PARALLEL_TEST_JOBS : ${{ matrix.ROS_PARALLEL_TEST_JOBS }} + CATKIN_PARALLEL_TEST_JOBS : ${{ matrix.CATKIN_PARALLEL_TEST_JOBS }} + ROS_DISTRO : ${{ matrix.ROS_DISTRO }} + USE_DEB : ${{ matrix.USE_DEB }} + NOT_TEST_INSTALL : ${{ matrix.NOT_TEST_INSTALL }} + TEST_PKGS : ${{ matrix.TEST_PKGS }} + BEFORE_SCRIPT : ${{ matrix.BEFORE_SCRIPT }} + EXTRA_DEB : ${{ matrix.EXTRA_DEB }} + + kinetic_i386: + runs-on: ubuntu-latest + name: kinetic_i386 + + container: i386/ubuntu:16.04 + + steps: + - name: Install latest git ( use sudo for ros-ubuntu ) + run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git + - name: Chcekout + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git clone --depth=1 $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE + cd $GITHUB_WORKSPACE + git checkout -qf $GITHUB_SHA || (git fetch -q origin +$GITHUB_REF; git checkout -qf FETCH_HEAD) + git submodule update --init .travis + - name: Run jsk_travis + uses: jsk-ros-pkg/jsk_travis@master + with: + EXTRA_DEB : "python-lxml" + ROS_DISTRO : kinetic + ROS_PARALLEL_TEST_JOBS : "-j8" + CATKIN_PARALLEL_JOBS: "-i" + ROSDEP_ADDITIONAL_OPTIONS : "-n -q -r --ignore-src --skip-keys=python-google-cloud-texttospeech-pip --skip-keys=python-dialogflow-pip" # Skip installation of grpcio by pip because it causes error + # https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/237 : (Note that pip==21.0.1 is incompatible with python 2.x) + BEFORE_SCRIPT : "sudo pip install virtualenv==15.1.0" \ No newline at end of file diff --git a/.github/workflows/kinetic-i386.yml b/.github/workflows/kinetic-i386.yml deleted file mode 100644 index 2b87db8ca..000000000 --- a/.github/workflows/kinetic-i386.yml +++ /dev/null @@ -1,30 +0,0 @@ -# generated by `./generate_action_config.py indigo` -# jsk_travis -on: [push, pull_request] - -jobs: - kinetic_i386: - runs-on: ubuntu-latest - name: kinetic_i386 - - container: i386/ubuntu:16.04 - - steps: - - name: Install latest git ( use sudo for ros-ubuntu ) - run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git - - name: Chcekout - run: | - git clone --depth=1 $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE - cd $GITHUB_WORKSPACE - git checkout -qf $GITHUB_SHA || (git fetch -q origin +$GITHUB_REF; git checkout -qf FETCH_HEAD) - git submodule update --init .travis - - name: Run jsk_travis - uses: jsk-ros-pkg/jsk_travis@master - with: - EXTRA_DEB : "python-lxml" - ROS_DISTRO : kinetic - ROS_PARALLEL_TEST_JOBS : "-j8" - CATKIN_PARALLEL_JOBS: "-i" - ROSDEP_ADDITIONAL_OPTIONS : "-n -q -r --ignore-src --skip-keys=python-google-cloud-texttospeech-pip --skip-keys=python-dialogflow-pip" # Skip installation of grpcio by pip because it causes error - # https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/237 : (Note that pip==21.0.1 is incompatible with python 2.x) - BEFORE_SCRIPT : "sudo pip install virtualenv==15.1.0" \ No newline at end of file diff --git a/.github/workflows/kinetic.yml b/.github/workflows/kinetic.yml deleted file mode 100644 index 30745cdd7..000000000 --- a/.github/workflows/kinetic.yml +++ /dev/null @@ -1,23 +0,0 @@ -# generated by `./generate_action_config.py kinetic` -# jsk_travis -on: [push, pull_request] - -jobs: - kinetic: - runs-on: ubuntu-latest - name: kinetic - - container: ubuntu:16.04 - - steps: - - name: Install latest git ( use sudo for ros-ubuntu ) - run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git - - name: Chcekout - uses: actions/checkout@v2 - - name: Run jsk_travis - uses: jsk-ros-pkg/jsk_travis@master - with: - EXTRA_DEB : "python-lxml" - ROS_DISTRO : kinetic - ROS_PARALLEL_TEST_JOBS: "-j8" - CATKIN_PARALLEL_JOBS: "-i" diff --git a/.github/workflows/melodic.yml b/.github/workflows/melodic.yml deleted file mode 100644 index 55ba0921e..000000000 --- a/.github/workflows/melodic.yml +++ /dev/null @@ -1,22 +0,0 @@ -# generated by `./generate_action_config.py melodic` -# jsk_travis -on: [push, pull_request] - -jobs: - melodic: - runs-on: ubuntu-latest - name: melodic - - container: ubuntu:18.04 - - steps: - - name: Install latest git ( use sudo for ros-ubuntu ) - run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git - - name: Chcekout - uses: actions/checkout@v2 - - name: Run jsk_travis - uses: jsk-ros-pkg/jsk_travis@master - with: - ROS_DISTRO : melodic - ROS_PARALLEL_TEST_JOBS: "-j8" - CATKIN_PARALLEL_JOBS: "-i" diff --git a/.github/workflows/noetic-usr-src.yml b/.github/workflows/noetic-usr-src.yml deleted file mode 100644 index 705695b38..000000000 --- a/.github/workflows/noetic-usr-src.yml +++ /dev/null @@ -1,23 +0,0 @@ -# generated by `./generate_action_config.py noetic` -# jsk_travis -on: [push, pull_request] - -jobs: - noetic: - runs-on: ubuntu-latest - name: noetic - - container: ubuntu:20.04 - - steps: - - name: Install latest git ( use sudo for ros-ubuntu ) - run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git - - name: Chcekout - uses: actions/checkout@v2 - - name: Run jsk_travis - uses: jsk-ros-pkg/jsk_travis@master - with: - ROS_DISTRO : noetic - ROS_PARALLEL_TEST_JOBS: "-j8" - CATKIN_PARALLEL_JOBS: "-i" - USE_DEB : false diff --git a/.github/workflows/noetic.yml b/.github/workflows/noetic.yml deleted file mode 100644 index 5840bfffc..000000000 --- a/.github/workflows/noetic.yml +++ /dev/null @@ -1,24 +0,0 @@ -# generated by `./generate_action_config.py noetic` -# jsk_travis -on: [push, pull_request] - -jobs: - noetic: - runs-on: ubuntu-latest - name: noetic - - container: ubuntu:20.04 - - steps: - - name: Install latest git ( use sudo for ros-ubuntu ) - run: | - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections # set non interactive tzdata https://stackoverflow.com/questions/8671308/non-interactive-method-for-dpkg-reconfigure-tzdata - apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git - - name: Chcekout - uses: actions/checkout@v2 - - name: Run jsk_travis - uses: jsk-ros-pkg/jsk_travis@master - with: - ROS_DISTRO : noetic - ROS_PARALLEL_TEST_JOBS: "-j8" - CATKIN_PARALLEL_JOBS: "-i" diff --git a/.github/workflows/python3.yml b/.github/workflows/python3.yml index 5c2e8632c..2e6dc49d3 100644 --- a/.github/workflows/python3.yml +++ b/.github/workflows/python3.yml @@ -10,9 +10,13 @@ jobs: container: ubuntu:20.04 steps: + - name: Install latest git to download .git directory in actions/checkout@v2 ( use sudo for ros-ubuntu ) + run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git + - name: work around permission issue # https://github.com/actions/checkout/issues/760#issuecomment-1097501613 + run: git config --global --add safe.directory $GITHUB_WORKSPACE - name: Chcekout uses: actions/checkout@v2 - name: Check Python3 run: | - apt update -q && apt install -y -q python3 - python3 -m compileall . + apt update -q && apt install -y -q python3 git 2to3 + bash -c "ret=0; trap 'ret=1' ERR; python3 -m compileall .; 2to3 -w -f except -f execfile -f has_key -f import -f raw_input -f zip .; git diff --exit-code . > /dev/null; echo Exitting with \$ret; exit \$ret" diff --git a/3rdparty/mini_maxwell/scripts/simple_server/simple_echo_client.py b/3rdparty/mini_maxwell/scripts/simple_server/simple_echo_client.py index 696ec44a7..09145f375 100755 --- a/3rdparty/mini_maxwell/scripts/simple_server/simple_echo_client.py +++ b/3rdparty/mini_maxwell/scripts/simple_server/simple_echo_client.py @@ -4,6 +4,11 @@ import sys import argparse import struct + +# use raw_input for python2 c.f. https://stackoverflow.com/questions/5868506/backwards-compatible-input-calls-in-python +if hasattr(__builtins__, 'raw_input'): + input = raw_input + parser = argparse.ArgumentParser(description='Simple socket client') parser.add_argument("--port", default=8080, type=int) parser.add_argument("--udp", action="store_true") @@ -18,7 +23,7 @@ else: server = socket(AF_INET, SOCK_DGRAM) while True: - data = raw_input('> ') + data = input('> ') if not data: break packer = struct.Struct("!%ds" % len(data)) diff --git a/chaplus_ros/scripts/chaplus_ros.py b/chaplus_ros/scripts/chaplus_ros.py index 98f245714..0ad9f2a6f 100755 --- a/chaplus_ros/scripts/chaplus_ros.py +++ b/chaplus_ros/scripts/chaplus_ros.py @@ -112,7 +112,7 @@ def topic_cb(self, msg): response = requests.post( url=self.url, headers=self.headers, data=self.data) response_json = response.json() - if not response_json.has_key('bestResponse'): + if 'bestResponse' not in response_json: best_response = "ごめんなさい、よくわからないです" else: best_response = response_json['bestResponse']['utterance'] @@ -130,7 +130,7 @@ def topic_cb(self, msg): params = {"apikey": self.apikey, "query": msg.data,} response = requests.post(self.endpoint, params) response_json = response.json() - if not response_json.has_key('results'): + if 'results' not in response_json: best_response = "ごめんなさい、よくわからないです" else: best_response = response_json["results"][0]["reply"] diff --git a/ros_speech_recognition/src/ros_speech_recognition/recognize_google_cloud.py b/ros_speech_recognition/src/ros_speech_recognition/recognize_google_cloud.py index e18644087..9b651c325 100644 --- a/ros_speech_recognition/src/ros_speech_recognition/recognize_google_cloud.py +++ b/ros_speech_recognition/src/ros_speech_recognition/recognize_google_cloud.py @@ -87,17 +87,17 @@ def recognize_google_cloud(self, audio_data, credentials_json=None, language="en if "results" not in response or len(response["results"]) == 0: raise UnknownValueError() transcript = "" for result in response["results"]: - if speech_config.has_key('diarizationConfig') and \ + if 'diarizationConfig' in speech_config and \ speech_config['diarizationConfig']['enableSpeakerDiarization'] == True: # when diariazationConfig is true, use words with speakerTag: speakerTag = None for word in result["alternatives"][0]["words"]: - if word.has_key('speakerTag'): + if 'speakerTag' in word: if speakerTag != word['speakerTag']: speakerTag = word['speakerTag'] transcript += "[{}]".format(speakerTag) transcript += ' ' + word['word'] - elif result["alternatives"][0].has_key("transcript"): + elif "transcript" in result["alternatives"][0]: print("trasncript?") transcript += result["alternatives"][0]["transcript"].strip() + " "