Forráskód Böngészése

Fix Docker build

Signed-off-by: Aarni Koskela <akx@iki.fi>
Aarni Koskela 5 éve
szülő
commit
136a6ac0c8
2 módosított fájl, 9 hozzáadás és 2 törlés
  1. 1 1
      Dockerfile
  2. 8 1
      python/labours/cli.py

+ 1 - 1
Dockerfile

@@ -26,7 +26,7 @@ echo\n\' > /browser && \
     chmod +x /browser && \
     curl https://bootstrap.pypa.io/get-pip.py | python3 - pip==18.1 && \
     pip3 install --no-cache-dir --no-build-isolation cython && \
-    sed -i 's/parser.add_argument("--backend",/parser.add_argument("--backend", default="Agg",/' /root/src/labours/labours.py && \
+    sed -i 's/DEFAULT_MATPLOTLIB_BACKEND = None/DEFAULT_MATPLOTLIB_BACKEND = "Agg"/' /root/src/labours/cli.py && \
     pip3 install --no-cache-dir /root/src && \
     pip3 install --no-cache-dir "tensorflow<2.0" && \
     rm -rf /root/src && \

+ 8 - 1
python/labours/cli.py

@@ -22,6 +22,9 @@ from labours.modes.shotness import show_shotness_stats
 from labours.readers import read_input
 from labours.utils import import_pandas
 
+# NB: this value is modified within the Dockerfile.
+DEFAULT_MATPLOTLIB_BACKEND = None
+
 
 def list_matplotlib_styles() -> List[str]:
     script = (
@@ -58,7 +61,11 @@ def parse_args() -> Namespace:
         choices=list_matplotlib_styles(),
         help="Plot style to use.",
     )
-    parser.add_argument("--backend", help="Matplotlib backend to use.")
+    parser.add_argument(
+        "--backend",
+        default=DEFAULT_MATPLOTLIB_BACKEND,
+        help="Matplotlib backend to use.",
+    )
     parser.add_argument(
         "--background",
         choices=["black", "white"],