cs.env-20230407
توضیحات
Some environment related functions.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cs.env-20230407 |
| نام | cs.env |
| نسخه کتابخانه | 20230407 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Cameron Simpson |
| ایمیل نویسنده | Cameron Simpson <cs@cskk.id.au> |
| آدرس صفحه اصلی | https://bitbucket.org/cameron_simpson/css/commits/all |
| آدرس اینترنتی | https://pypi.org/project/cs.env/ |
| مجوز | GNU General Public License v3 or later (GPLv3+) |
Some environment related functions.
*Latest release 20230407*:
getenv: new parse callable parameter to parse the value.
* LOGDIR, VARRUN, FLAGDIR: lambdas defining standard places used in other modules
* envsub: replace substrings of the form '$var' with the value of 'var' from `environ`.
* getenv: fetch environment value, optionally performing substitution
## Function `envsub(s, environ=None, default=None)`
Replace substrings of the form '$var' with the value of 'var' from environ.
Parameters:
* `environ`: environment mapping, default `os.environ`.
* `default`: value to substitute for unknown vars;
if `default` is `None` a `ValueError` is raised.
## Function `getenv(var, default=None, environ=None, dosub=False, parse=None)`
Fetch environment value.
Parameters:
* `var`: name of variable to fetch.
* `default`: default value if not present. If not specified or None,
raise KeyError.
* `environ`: environment mapping, default `os.environ`.
* `dosub`: if true, use envsub() to perform environment variable
substitution on `default` if it used. Default value is `False`.
* `parse`: optional callable to parse the environment variable;
*NOTE*: if this raises `ValueError` and there is a default, issue
a warning and return `default`
## Function `LOGDIR(environ=None)`
various standard locations used in the cs.* modules
# Release Log
*Release 20230407*:
getenv: new parse callable parameter to parse the value.
*Release 20190103*:
* Drop getLogin and getHomeDir, unused.
* Make get_standard_var private as _get_standard_var.
*Release 20170905.1*:
Tweak doco and DISTINFO.
*Release 20170905*:
Add LOGDIR, VARRUN, FLAGDIR wrappers for new get_standard_var function to provide standard policy variables.
*Release 20160828*:
Update metadata with "install_requires" instead of "requires".
*Release 20150118*:
Initial PyPI release.
نیازمندی
| مقدار | نام |
|---|---|
| >=20230331 | cs.gimmicks |
| >=20230401 | cs.lex |
نحوه نصب
نصب پکیج whl cs.env-20230407:
pip install cs.env-20230407.whl
نصب پکیج tar.gz cs.env-20230407:
pip install cs.env-20230407.tar.gz