Skip to content

Commit 1a561a8

Browse files
committed
made it easier to install additional python libraries in bootstrap-generated script; bootstrap generation now aware of whether to install pww3 with graph/plot support
1 parent 396dfd1 commit 1a561a8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

python/weka/core/packages.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import weka.core.jvm as jvm
2525
from weka.core.classes import JavaObject
2626
import weka.core.classes as classes
27-
from weka.core.version import pww_version
27+
from weka.core.version import pww_version, with_graph_support, with_plot_support
2828

2929

3030
LATEST = "Latest"
@@ -905,12 +905,24 @@ def _subcmd_bootstrap(args):
905905
lines.append("")
906906

907907
# pww3
908+
additional = list()
909+
if with_graph_support():
910+
additional.append("graphs")
911+
if with_plot_support():
912+
additional.append("plots")
913+
if len(additional) > 0:
914+
additional_modules = "[%s]" % ",".join(additional)
915+
else:
916+
additional_modules = ""
908917
lines.append("# 2. install python-weka-wrapper3")
909918
lines.append('logger.info("Installing python-weka-wrapper3...")')
910919
lines.append("import subprocess")
911920
lines.append("import sys")
912921
version = pww_version()
913-
lines.append('subprocess.check_call([sys.executable, "-m", "pip", "install", "python-weka-wrapper3==%s"])' % version)
922+
lines.append("pkgs = [")
923+
lines.append(' "python-weka-wrapper3%s==%s"' % (additional_modules, version))
924+
lines.append("]")
925+
lines.append('subprocess.check_call([sys.executable, "-m", "pip", "install", " ".join(pkgs)])')
914926
lines.append("")
915927

916928
# packages

0 commit comments

Comments
 (0)