search for: find_spec

Displaying 6 results from an estimated 6 matches for "find_spec".

2019 Mar 28
0
[PATCH v2 4/4] OCaml tools: output messages into JSON for machine readable
...eritable(fd): + os.set_inheritable(fd, True) +else: + def set_fd_inheritable(fd): + pass + + +if sys.version_info >= (3, 0): + def fdopen(fd, mode): + return open(fd, mode) + + def isModuleInstalled(mod): + import importlib + return bool(importlib.util.find_spec(mod)) +else: + def fdopen(fd, mode): + return os.fdopen(fd, mode) + + def isModuleInstalled(mod): + import imp + try: + imp.find_module(mod) + return True + except ImportError: + return False + + +def skipUnlessHasModule(mod): +...
2016 Jul 18
4
[PATCH 1/3] mllib: Getopt: point to man page as additional help
On error, point also to the man page of the current tool in addition to '$TOOL --help'. --- mllib/getopt-c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c index bf40f91..3efd5d3 100644 --- a/mllib/getopt-c.c +++ b/mllib/getopt-c.c @@ -69,8 +69,8 @@ cleanup_option_list (void *ptr) static void __attribute__((noreturn))
2019 Mar 28
8
[PATCH v2 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Changes from v1: - use Obj.magic to convert int -> Unix.file_descr - add tests Pino Toscano (4):
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...TDOUT_FILENO, buf, buf_len); + + exit (EXIT_SUCCESS); + + CAMLreturn0; +} + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i = 0; i < specs_len; ++i) { + int len, j; + + keysv = Field (Field (specsv, i), 0); + len = Wosize_val (keysv); + + for (j = 0; j < len; ++j) { + const char *ke...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...+ } + free (opts); +} + +#else +#define CLEANUP_FREE_OPTION_LIST +#endif + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i = 0; i < specs_len; ++i) { + int len, j; + + keysv = Field (Field (specsv, i), 0); + len = Wosize_val (keysv); + + for (j = 0; j < len; ++j) { + const char *ke...
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...TDOUT_FILENO, buf, buf_len); + + exit (EXIT_SUCCESS); + + CAMLreturn0; +} + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i = 0; i < specs_len; ++i) { + int len, j; + + keysv = Field (Field (specsv, i), 0); + len = Wosize_val (keysv); + + for (j = 0; j < len; ++j) { + const char *ke...