Skip to content

Commit

Permalink
Use Agg backend as default in headless environments. (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGrupp committed Dec 1, 2020
1 parent f641e74 commit fbb6541
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.rosnoetic
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN container-local/.ci/debian_install_pip3.sh

# Build and install.
RUN pip3 install /container-local --upgrade --no-binary evo
RUN evo_config set plot_backend Agg
RUN evo_config show --brief --no_color

# Run tests.
RUN pip3 install pytest --upgrade
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- script: |
python -m pip install --upgrade pip
pip install . --no-binary evo
evo_config set plot_backend Agg
evo_config show --brief --no_color
displayName: 'Install and configure package and dependencies'
- script: |
Expand Down
4 changes: 4 additions & 0 deletions evo/tools/settings_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
along with evo. If not, see <http://www.gnu.org/licenses/>.
"""

import os
import pkgutil


def get_default_plot_backend() -> str:
if os.name == "posix" and os.getenv("DISPLAY", default="") == "":
return "Agg"

backends = {"PyQt5": "Qt5Agg"}
for pkg in backends:
if pkgutil.find_loader(pkg) is not None:
Expand Down

0 comments on commit fbb6541

Please sign in to comment.