跳转到主要内容

此软件包提供了跨平台跨Python shutil.which功能。

项目描述

https://badge.fury.io/py/whichcraft.svg https://travis-ci.org/pydanny/whichcraft.svg?branch=master https://codecov.io/gh/pydanny/whichcraft/branch/master/graph/badge.svg https://ci.appveyor.com/api/projects/status/v9coijayykhkeu4d?svg=true Code style: black
That code in my care
That sly command-line stare
That strips my operating system bare
It's whichcraft

此软件包提供了跨平台跨Python shutil.which 功能。

用法

在Linux、Mac、Windows上,Python 2.7或任何维护的3.x版本

>>> from whichcraft import which
>>> which('date')
'/bin/date'
>>> which('calendar')
'/bin/calendar'
>>> which('cookiecutter')
'/Users/pydanny/.envs/fun/bin/cookiecutter'
>>> which('a-made-up-name') is None
True

注意

这是一个shutil.which函数的shim,旨在跨多个Python版本和Windows内部工作。Python 2.x的代码基于我从源代码中提取的Python 3代码。我最初是为Cookiecutter做这个,但为了减少该项目的行数,将其提取出来。

边缘情况:日期函数在mac os和linux系统上运行完美,因此返回字符串。但在Windows中是内置函数,因此在Windows中调用时返回值为none。

历史

0.6.1 (2019-09-06)

  • 修复版本问题

0.6.0 (2019-07-12)

  • 删除遗留的Unicode问题

  • 添加BriteCore作为赞助商

0.5.3 (2018-10-10)

  • 添加BriteCore作为赞助商

0.5.2 (2018-10-09)

  • 删除对3.2和3.3的任何提及

0.5.1 (2018-10-09)

  • 修复setup.py以便与较旧的Python版本兼容

0.5.0 (2018-10-09)

  • 感谢@rooterkyberian添加了对3.7的支持

  • 删除对2.6的任何提及

0.4.2 (2018-04-16)

  • 使用black进行代码格式化

  • 将状态移至生产/稳定

  • 删除对Python 2.6和3.3的支持

0.4.1 (2017-04-25)

  • 添加了对Python 3.6的支持测试

0.3.1 (2016-05-10)

  • 现在正在直接测试 which,因此我们可以支持 3.3 版本之前的 Python 3 版本(@nickcoghlan)

0.3.1 (2016-04-24)

  • 更正 whichcraft.py 中的版本号

0.3.0 (2016-04-24)

  • 将测试包含在发布源代码压缩包中(@Edwardbetts)

0.2.0 (2016-04-23)

  • Python 3.5 兼容性

0.1.1 (2015-09-09)

  • 添加歌词

0.1.0 (2015-09-09)

  • 在 PyPI 上首次发布。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分布

whichcraft-0.6.1.tar.gz (6.9 kB 查看散列)

上传时间

构建分布

whichcraft-0.6.1-py2.py3-none-any.whl (5.2 kB 查看散列)

上传时间 Python 2 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面