diff --git a/noxfile.py b/noxfile.py index 37b249a..78caa99 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,10 +17,34 @@ def tests(session): # print info session.run( - "python", "-m", "coverage", "run", "-m", "find_libpython", "--candidate-names" + "python", + "-m", + "coverage", + "run", + "-m", + "find_libpython", + "-v", + "--platform-info", ) session.run( - "python", "-m", "coverage", "run", "-m", "find_libpython", "--candidate-paths" + "python", + "-m", + "coverage", + "run", + "-m", + "find_libpython", + "-v", + "--candidate-names", + ) + session.run( + "python", + "-m", + "coverage", + "run", + "-m", + "find_libpython", + "-v", + "--candidate-paths", ) session.run("python", "-m", "coverage", "run", "-m", "find_libpython", "-v") diff --git a/src/find_libpython/__init__.py b/src/find_libpython/__init__.py index 54a1f7c..e868193 100644 --- a/src/find_libpython/__init__.py +++ b/src/find_libpython/__init__.py @@ -342,11 +342,6 @@ def _finding_libpython(): path : str Existing path to a libpython. """ - _logger.debug("_is_windows = %s", _is_windows) - _logger.debug("_is_apple = %s", _is_apple) - _logger.debug("_is_mingw = %s", _is_mingw) - _logger.debug("_is_msys = %s", _is_cygwin) - _logger.debug("_is_posix = %s", _is_posix) for path in candidate_paths(): _logger.debug("Candidate: %s", path) normalized = _normalize_path(path) @@ -391,6 +386,8 @@ def _cli_find_libpython(cli_op, verbose): _print_all(candidate_names()) elif cli_op == "candidate-paths": _print_all(p for p in candidate_paths() if p and os.path.isabs(p)) + elif cli_op == "platform-info": + _log_platform_info() else: path = find_libpython() if path is None: @@ -398,6 +395,14 @@ def _cli_find_libpython(cli_op, verbose): print(path, end="") +def _log_platform_info(): + _logger.debug("_is_windows = %s", _is_windows) + _logger.debug("_is_apple = %s", _is_apple) + _logger.debug("_is_mingw = %s", _is_mingw) + _logger.debug("_is_msys = %s", _is_cygwin) + _logger.debug("_is_posix = %s", _is_posix) + + def main(args=None): import argparse @@ -432,6 +437,13 @@ def main(args=None): const="candidate-paths", help="Print list of candidate paths of libpython.", ) + group.add_argument( + "--platform-info", + action="store_const", + dest="cli_op", + const="platform-info", + help="Print information about the platform and exit.", + ) ns = parser.parse_args(args) parser.exit(_cli_find_libpython(**vars(ns)))