Richard W.M. Jones
2017-Mar-22 15:56 UTC
Re: [Libguestfs] [PATCH 4/5] dib: require a Python interpreter
On Wed, Mar 22, 2017 at 11:19:49AM +0100, Pino Toscano wrote:> if elements = [] && machine_readable then ( > @@ -246,6 +252,19 @@ read the man page virt-dib(1). > if elements = [] then > error (f_"at least one distribution root element must be specified"); > > + let python > + match python with > + | Some exe -> > + let p > + if Filename.is_relative exe thenIIUC what you mean here is "the 'exe' filename doesn't contain any slashes"? That isn't what is written above.> + get_required_tool exe > + else ( > + Unix.access exe [Unix.X_OK]; > + exe > + ) in > + Some p > + | None -> None inRich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Pino Toscano
2017-Mar-22 17:03 UTC
Re: [Libguestfs] [PATCH 4/5] dib: require a Python interpreter
On Wednesday, 22 March 2017 16:56:57 CET Richard W.M. Jones wrote:> On Wed, Mar 22, 2017 at 11:19:49AM +0100, Pino Toscano wrote: > > if elements = [] && machine_readable then ( > > @@ -246,6 +252,19 @@ read the man page virt-dib(1). > > if elements = [] then > > error (f_"at least one distribution root element must be specified"); > > > > + let python > > + match python with > > + | Some exe -> > > + let p > > + if Filename.is_relative exe then > > IIUC what you mean here is "the 'exe' filename doesn't contain > any slashes"? That isn't what is written above.Yes, sort of. What about something like: let p try ignore (String.find exe Filename.dir_sep); Unix.access exe [Unix.X_OK]; exe with | Not_found -> get_required_tool exe in Thanks, -- Pino Toscano
Richard W.M. Jones
2017-Mar-22 21:37 UTC
Re: [Libguestfs] [PATCH 4/5] dib: require a Python interpreter
On Wed, Mar 22, 2017 at 06:03:07PM +0100, Pino Toscano wrote:> On Wednesday, 22 March 2017 16:56:57 CET Richard W.M. Jones wrote: > > On Wed, Mar 22, 2017 at 11:19:49AM +0100, Pino Toscano wrote: > > > if elements = [] && machine_readable then ( > > > @@ -246,6 +252,19 @@ read the man page virt-dib(1). > > > if elements = [] then > > > error (f_"at least one distribution root element must be specified"); > > > > > > + let python > > > + match python with > > > + | Some exe -> > > > + let p > > > + if Filename.is_relative exe then > > > > IIUC what you mean here is "the 'exe' filename doesn't contain > > any slashes"? That isn't what is written above. > > Yes, sort of. What about something like: > > let p > try > ignore (String.find exe Filename.dir_sep); > Unix.access exe [Unix.X_OK]; > exe > with > | Not_found -> > get_required_tool exe inThe String.find function in mllib/ returns -1 for not found. I think it never throws an exception. But in general yes that's a better approach. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Possibly Parallel Threads
- Re: [PATCH 4/5] dib: require a Python interpreter
- [PATCH 4/5] dib: require a Python interpreter
- [PATCH 3/3] OCaml: use the new behaviour of Std_utils.which
- [PATCH 0/5] dib: initial work to support d-i-b 2.0
- [PATCH] mllib: move which and its exception from dib