{"id":22837407,"url":"https://github.com/hubtou/libpnu","last_synced_at":"2026-05-02T03:33:32.068Z","repository":{"id":57453834,"uuid":"464426693","full_name":"HubTou/libpnu","owner":"HubTou","description":"Common utility functions for the PNU project","archived":false,"fork":false,"pushed_at":"2024-03-14T00:48:43.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T21:48:46.913Z","etag":null,"topics":["library","pnu-project","portability","python","unix","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HubTou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-28T09:57:41.000Z","updated_at":"2023-10-24T19:10:05.000Z","dependencies_parsed_at":"2023-01-29T17:31:02.392Z","dependency_job_id":null,"html_url":"https://github.com/HubTou/libpnu","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Flibpnu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Flibpnu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Flibpnu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Flibpnu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubTou","download_url":"https://codeload.github.com/HubTou/libpnu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246412746,"owners_count":20773050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","pnu-project","portability","python","unix","windows"],"created_at":"2024-12-12T23:16:44.272Z","updated_at":"2026-05-02T03:33:32.026Z","avatar_url":"https://github.com/HubTou.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Installation\nThis library will be installed as a dependency by other PNU utilities.\n\n# LibPNU(3)\n\n## NAME\nlibpnu — Common utility functions for the PNU project\n\n## SYNOPSIS\nimport **libpnu**\n\n*libpnu*.**initialize_debugging**(String *program_name*)\n\n*libpnu*.**handle_interrupt_signals**(Function *handler_function*)\n\n*libpnu*.**interrupt_handler_function**(Int *signal_number*, FrameObject *current_stack_frame*)\n\nString *libpnu*.**get_home_directory**()\n\nString *libpnu*.**get_caching_directory**(String *name*)\n\nList *libpnu*.**locate_directory**(String *directory*)\n\nList *libpnu*.**load_strings_from_file**(String *filename*)\n\n## DESCRIPTION\nThe **initialize_debugging()** function sets up the Python logging module with a syslog style kind of console log using *program_name* as the program name.\nBy default, the logging level is set at WARNING or more, but can be lowered by calling **logging.disable()**,\nfor example with the *logging.NOTSET* parameter to get DEBUG or more logging level.\n\nThe **handle_interrupt_signals()** function calls the specified *handler_function* to process the SIGINT and SIGPIPE signals,\nusually to avoid an ugly trace dump to the console in case of interrupt (Control-C pressed or broken pipe).\nIf all you want is printing an \"Interrupted\" English message and exit your program,\nthen you can use the **interrupt_handler_function()** as the *handler_function*.\n\nThe **get_home_directory()** function returns the location of the user's home directory in a string\ndepending on the operating system used (Unix, Windows).\n\nThe **get_caching_directory()** function returns the location of a user writable directory for caching files in a string\ndepending on the operating system used (Unix, Windows).\nThe provided *name* will be the last directory part of this location.\n\nThe **locate_directory()** function searches the specified *directory* in a variety of possible other directories,\ndepending on the operating system used (Unix, Windows) and the fact that a package can be user or system installed.\nIt is intended to be used when the directory can't be directly found, and returns a list of paths where the directory searched has been found.\n\nFor example, if the argument is \"/usr/local/etc/man.d\", we'll search for \"usr/local/etc/man.d\", \"local/etc/man.d\", \"etc/man.d\" (more likely) and \"man.d\"\nin a list of user's local Python package directories\n(\"$HOME/.local\" on Unix, \"$APPDATA/python\", \"$HOMEPATH/appdata/roaming/python\", \"$USERPROFILE/appdata/roaming/python\" on Windows)\nand system wide Python package base directories (given by *sys.base_prefix*: \"/usr/local\" on Unix, \"C:/Program Files/Python3x\" on Windows).\n\nThe **load_strings_from_file()** function returns a list of strings from the given *filename*,\nfiltering out comments and empty lines (with '#' being the comment character),\nand joining continued lines (those ending with a '\\\\' character).\n\n## ENVIRONMENT\nThe following environment variables can be used to identify the user identity and home directory,\nor find a caching directory.\n\nOn Unix: *HOME*, *LNAME*, *LOGNAME*, *TMP*, *TMPDIR*, *USER* and *USERNAME*.\n\nOn Windows: *APPDATA*, *HOME*, *HOMEPATH*, *LOCALAPPDATA*, *TMP* and *USERPROFILE*.\n\n## STANDARDS\nThe **libpnu** library is not a standard UNIX one.\n\nIt tries to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for [Python](https://www.python.org/) code.\n\n## PORTABILITY\nTested OK under Windows.\n\nPackaged for FreeBSD as *pyXX-pnu-libpnu*.\n\n## HISTORY\nThis library was made for the [PNU project](https://github.com/HubTou/PNU).\n\n## LICENSE\nIt is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).\n\n## AUTHORS\n[Hubert Tournier](https://github.com/HubTou)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Flibpnu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubtou%2Flibpnu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Flibpnu/lists"}