3
3
# ==============================================================================
4
4
#
5
5
# This jaunch.toml file contains useful general-purpose, non-application-specific
6
- # configuration that defines some sensible defaults for typical Java-based launchers.
6
+ # configuration that defines some sensible defaults for typical launchers.
7
7
# You can of course edit it to customize Jaunch's behavior however you like.
8
8
#
9
9
# Each application will typically have its own extensions to the general configuration
12
12
# FizzBuzz application, you would also write a fizzbuzz.toml companion file that
13
13
# overrides or augments this configuration with fizzbuzz-specific settings.
14
14
#
15
- # Minimally, such application-specific configuration will include the `program-name`
16
- # and `main-class` fields, and typically a `classpath`
17
- # for needed JAR files. But it may also add application-specific options via the
18
- # `supported-options` field, as well as constraints such as `version-min` and
19
- # `version-max` to restrict which Javas are compatible with the application.
15
+ # For simple examples of application-specific configuration, see:
16
+ # - app/config/paunch.toml for a Jaunch-based Python launcher
17
+ # - app/config/jy.toml for a Jaunch-based Jython launcher
20
18
#
21
19
# Alternately, if you would like to keep all configuration together in one file
22
20
# for simplicity, you can write a single TOML file with everything, and name it
30
28
jaunch-version = 1
31
29
32
30
# ==============================================================================
33
- # The name of your program! This name will appear in the usage text.
31
+ # The name of your program! This name will appear in usage text and dialog boxes .
34
32
# program-name = 'FizzBuzz'
35
33
36
34
# ==============================================================================
37
35
# The list of command line options supported by Jaunch out of the box.
38
36
#
37
+ # TODO: Update this section to be unspecific to JVM programs.
38
+ #
39
39
# These are arguments that Jaunch will interpret, transforming them in various ways
40
40
# into arguments to the Java Virtual Machine (JVM) and/or main class that is launched.
41
41
#
@@ -91,6 +91,9 @@ supported-options = [
91
91
' --java-home=<path>|specify JAVA_HOME explicitly' ,
92
92
' --print-java-home|print path to the selected Java' ,
93
93
' --print-java-info|print information about the selected Java' ,
94
+ ' --python-home=<path>|specify PYTHON_HOME explicitly' ,
95
+ ' --print-python-home|print path to the selected Python' ,
96
+ ' --print-python-info|print information about the selected Python' ,
94
97
' --print-app-dir|print directory where the application is located' ,
95
98
' --headless|run in text mode' ,
96
99
" --heap,--mem,--memory=<amount>|set Java's heap size to <amount> (e.g. 512M)" ,
@@ -122,6 +125,8 @@ arch-aliases = [
122
125
# ==============================================================================
123
126
# List of additional hints to enable or disable based on other hints.
124
127
#
128
+ # TODO: Rework this section to introduce hints, rather than referring to below.
129
+ #
125
130
# See "jvm.root-paths" below for an overview of hints.
126
131
#
127
132
# With modes, you can set a single hint in response to several different other hints,
@@ -151,6 +156,8 @@ modes = []
151
156
# ==============================================================================
152
157
# Commands that control Jaunch's launching behavior.
153
158
#
159
+ # TODO: Rewrite this section to be nicer and more up to date.
160
+ #
154
161
# Each one runs at a particular (hardcoded) time during configuration.
155
162
# Directives unsupported by the configurator program are ignored.
156
163
#
@@ -171,6 +178,12 @@ modes = []
171
178
# * print-app-dir - Print out the path to the application. Typically, this will be
172
179
# the folder containing the launcher.
173
180
181
+ # * PYTHON - Launches the program using the Python interpreter.
182
+ # * print-python-home - Print out the path to the chosen Python installation.
183
+ # * print-python-info - Print out all the details of the chosen Python installation,
184
+ # including not only its path, but also the distro, version,
185
+ # operating system, CPU architecture, and other metadata fields.
186
+
174
187
# * JVM - Launches the program using the Java Virtual Machine.
175
188
# * print-java-home - Print out the path to the chosen Java installation.
176
189
# * print-java-info - Print out all the details of the chosen Java installation,
@@ -190,11 +203,12 @@ directives = [
190
203
' -h|help,STOP' , # global
191
204
' --print-app-dir|print-app-dir' , # global
192
205
' --print-config-dir|print-config-dir' , # global
193
- ' --dry-run|dry-run,STOP' , # jvm
206
+ ' --dry-run|dry-run,STOP' , # python, jvm
207
+ ' --print-python-home|print-python-home' , # python
208
+ ' --print-python-info|print-python-info' , # python
194
209
' --print-classpath|print-classpath' , # jvm
195
210
' --print-java-home|print-java-home' , # jvm
196
211
' --print-java-info|print-java-info' , # jvm
197
- ' JVM' ,
198
212
]
199
213
200
214
# ==============================================================================
@@ -232,8 +246,161 @@ directives = [
232
246
# supported options. In such cases, this option is here for you.
233
247
allow-unrecognized-args = false
234
248
249
+ # ==============================================================================
250
+ # Here begins the fields for controlling the launch of Python-based programs.
251
+ # For JVM-specific fields, skip to the `jvm` section below.
252
+ # ==============================================================================
253
+
254
+ python.recognized-args = [
255
+ ' -b' , ' -bb' ,
256
+ ' -B' ,
257
+ ' -c cmd' ,
258
+ ' -d' ,
259
+ ' -E' ,
260
+ ' -h' , ' -?' , # --help is reserved for Jaunch
261
+ ' -i' ,
262
+ ' -I' ,
263
+ ' -m mod' ,
264
+ ' -O' ,
265
+ ' -OO' ,
266
+ ' -q' ,
267
+ ' -s' ,
268
+ ' -S' ,
269
+ ' -u' ,
270
+ ' -v' ,
271
+ ' -V' , # --version is reserved for Jaunch
272
+ ' -W arg' ,
273
+ ' -x' ,
274
+ ' -X opt' ,
275
+ ' --check-hash-based-pycs always|default|never' ,
276
+ ]
277
+
278
+ # ==============================================================================
279
+ # Paths to check for Python installations.
280
+ #
281
+ # This is a list of directories where Jaunch might hope to find a Python installation.
282
+ # Directories are checked sequentially until one is found that matches all criteria.
283
+ #
284
+ # This is also the first field where we see Jaunch's hints/rules system in action.
285
+ # Each entry on the root-dirs list may be prefixed with string separated by pipes.
286
+ # Each segment is a *hint* for Jaunch regarding a flag that must be set for that
287
+ # particular line to be considered. Jaunch sets hint flags based on a few sources:
288
+ #
289
+ # * Active operating system: OS:LINUX, OS:MACOSX, OS:WINDOWS,
290
+ # OS:IOS, OS:ANDROID, OS:WASM, OS:TVOS, OS:WATCHOS, or OS:UNKNOWN.
291
+ #
292
+ # * Active CPU architecture: ARCH:ARM32, ARCH:ARM64, ARCH:X86, ARCH:X64,
293
+ # ARCH:MIPS32, ARCH:MIPSEL32, ARCH:WASM32, or ARCH:UNKNOWN.
294
+
295
+ # * Option hints, set from arguments passed to Jaunch, each of which sets a matching
296
+ # hint. For example, passing the --headless option will set a hint '--headless'.
297
+ #
298
+ # * Mode hints, set from evaluation of the modes field (see below).
299
+ #
300
+ # * Python hints, based on the Python installation selected:
301
+ # - PYTHON:3.9 if the selected Python installation is version 3.9.
302
+ # - PYTHON:3.9+ if the selected Python installation is version 3.9 or later.
303
+ # - PYTHON:3.10 if the selected Python installation is version 3.10.
304
+ # - PYTHON:3.10+ if the selected Python installation is version 3.10 or later.
305
+ # - and so on.
306
+ # Of course, Python hints will only be set after a Python installation matches,
307
+ # so they won't work here in python.root-paths, nor in python.lib-suffixes.
308
+ # But they can be useful in the python.runtime-args section to ensure Jaunch
309
+ # passes runtime args only to those versions of Python that support them,
310
+ # such as the -P flag which was introduced in Python 3.11.
311
+ #
312
+ # Finally, a segment prefixed by a bang symbol (!) negates the hint,
313
+ # making that line match only when that particular hint is *not* set.
314
+ #
315
+ # For example, consider the following python.root-paths line:
316
+ #
317
+ # '!--system|OS:LINUX|ARCH:X64|python/linux64',
318
+ #
319
+ # The applicable hints are !--system, OS:LINUX, and ARCH:X64, so the root path
320
+ # of python/linux64 will only be considered on 64-bit Linux systems, and only
321
+ # when the --system option was *not* given as part of the launcher invocation.
322
+ #
323
+ # This is also the first field where we see Jaunch's variables in use:
324
+ #
325
+ # '--python-home|${python-home}'
326
+ #
327
+ # Thanks to the above line, when the user passes '--python-home=/best', the
328
+ # --python-home hint will be set, and the python-home variable will be set to /best.
329
+ # So not only will the line match, but the root path to check will become /best.
330
+ python.root-paths = [
331
+ ' --python-home|${python-home}' ,
332
+ ' ${PYTHON_HOME}' ,
333
+ ' ~/miniforge3/envs/*' ,
334
+ ' ~/mambaforge/envs/*' ,
335
+ ' ${app-dir}/python' ,
336
+ ' ${app-dir}/lib/runtime' ,
337
+ ]
338
+
339
+ # TODO: Verify this list for all platforms.
340
+ python.lib-suffixes = [
341
+ ' OS:LINUX|lib/libpython3.so' ,
342
+ ' OS:MACOSX|lib/libpython3.dylib' ,
343
+ ' OS:WINDOWS|lib\libpython3.dll' ,
344
+ ]
345
+
346
+ # ==============================================================================
347
+ # Acceptable range of Python versions to match.
348
+ #
349
+ # These two fields let you constrain the minimum and maximum Python versions
350
+ # respectively that your application supports. This information will be used when
351
+ # searching the system for appropriate Python installations. If a Python installation
352
+ # is successfully discovered, but then found to be outside these constraints, it is
353
+ # discarded and the search continues.
354
+ #
355
+ # The most common use of these fields is to specify a major.minor version pair
356
+ # (e.g. `python.version-min = '3.9'`), but Jaunch does compare version strings digit by
357
+ # digit, so you could write `python.version-min = '3.8.5' if you need to be specific.
358
+ python.version-min = ' 3.8'
359
+ # python.version-max = '3.12'
360
+
361
+ # ==============================================================================
362
+ # Packages that must be present in the Python installation.
363
+ #
364
+ # TODO
365
+ python.packages = []
366
+
367
+ # ==============================================================================
368
+ # Arguments to pass to Python.
369
+ #
370
+ # This is the magic sauce where Jaunch options and other criteria get translated
371
+ # into Python arguments. See 'python.root-paths' above for a thorough explanation.
372
+ python.runtime-args = []
373
+
374
+ # ==============================================================================
375
+ # A list of paths to candidate main scripts, one of which will get launched.
376
+ #
377
+ # Jaunch evaluates the rules attached to each candidate main script. The first
378
+ # line with matching rules becomes the main script, with subsequent lines ignored.
379
+ #
380
+ # This field is useful if you want to launch a different main script depending on
381
+ # criteria such as OS, CPU architecture, or which options are given on the CLI.
382
+ # python.main-script = [
383
+ # '--fizzbuzz|fizzbuzz.py'
384
+ # '--main-script|${main-script}',
385
+ # 'main.py', # default behavior
386
+ # ]
387
+
388
+ # ==============================================================================
389
+ # Arguments to pass to the main class on the Python side.
390
+ #
391
+ # This is the other half of the magic sauce, along with python.runtime-args above:
392
+ # Options and other criteria get translated into main arguments here.
393
+ # See the 'python.root-paths' section above for a thorough explanation.
394
+ # python.main-args = [
395
+ # '!--fizz|!--buzz|--mode=number',
396
+ # '--fizz|!--buzz|--mode=fizz',
397
+ # '--buzz|!--fizz|--mode=buzz',
398
+ # '--fizz|--buzz|--mode=fizzbuzz',
399
+ # ]
400
+
235
401
# ==============================================================================
236
402
# Now come the fields for controlling the launch of JVM-based programs.
403
+ # For Python-specific fields, jump back up to the `python` section above.
237
404
# ==============================================================================
238
405
239
406
# ==============================================================================
0 commit comments