添加一个 pypi python 包到 buildroot
Add a pypi python package to buildroot
我正在尝试将 python3-functionfs 模块集成到 buildroot 中。
我可以 select 它与 make menuconfig
但是当我 运行 make
甚至没有下载包。
包在这里可用:functionfs-0.3 pypi page
并在此处下载 url :functionfs-0.3 download link
这里还有 github 回购协议:functionfs git repository
我使用的是 Buildroot 2017.02 版本。
这是我的 Config.in 文件:
config BR2_PACKAGE_PYTHON3_FUNCTIONFS
bool "python3-functionfs"
depends on BR2_PACKAGE_PYTHON3
help
Pythonic API for linux’s functionfs.
functionfs is part of the usb gadget subsystem. Together with usb_gadget’s configfs integration, allows userland to declare and implement an USB device.
https://pypi.python.org/pypi/functionfs
这是我的 .mk 文件:
################################################################################
#
# python3-functionfs
#
################################################################################
PYTHON_FUNCTIONFS_VERSION = 0.3
PYTHON_FUNCTIONFS_SOURCE = functionfs-$(PYTHON_FUNCTIONFS_VERSION).tar.gz
PYTHON_FUNCTIONFS_SITE = https://pypi.python.org/packages/e3/2d/56e0d9ffe0da7c116a6724ee538375689dd59e34dbe1676edf6b66b52be4
PYTHON_FUNCTIONFS_LICENSE = GPLv3+
PYTHON_FUNCTIONFS_LICENSE_FILE = COPYING
PYTHON_FUNCTIONFS_SETUP_TYPE = setuptools
$(eval $(python-package))
文档还在 17.8.3 中提到。从 PyPI 存储库生成 python 包
If the Python package for which you would like to create a Buildroot
package is available on PyPI, you may want to use the scanpypi tool
located in utils/ to automate the process.
You can find the list of existing PyPI packages here.
scanpypi requires Python’s setuptools package to be installed on your
host.
When at the root of your buildroot directory just do :
utils/scanpypi foo bar -o package
This will generate packages python-foo and python-bar in the package
folder if they exist on https://pypi.python.org.
Find the external python modules menu and insert your package inside.
Keep in mind that the items inside a menu should be in alphabetical
order.
Please keep in mind that you’ll most likely have to manually check the
package for any mistakes as there are things that cannot be guessed by
the generator (e.g. dependencies on any of the python core modules
such as BR2_PACKAGE_PYTHON_ZLIB). Also, please take note that the
license and license files are guessed and must be checked. You also
need to manually add the package to the package/Config.in file.
If your Buildroot package is not in the official Buildroot tree but in
a br2-external tree, use the -o flag as follows:
utils/scanpypi foo bar -o other_package_dir
This will generate packages python-foo and python-bar in the
other_package_directory instead of package.
Option -h will list the available options:
utils/scanpypi -h
但是我在 buildroot 主目录中没有 util/
文件夹。
该脚本位于 support/scripts/scanpypi
但当我在 运行 时出现以下错误:
$ support/scripts/scanpypi functionfs -o package
Traceback (most recent call last):
File "support/scripts/scanpypi", line 47, in <module>
import setuptools
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 40, in <module>
from pkgutil import get_importer
ImportError: cannot import name get_importer
这可以通过重命名 support/scripts/pkgutil.py
和 support/scripts/pkgutil.pyc
来解决。
但是我想了解当我尝试自己创建包时发生了什么,但它没有下载。
有人知道为什么 运行 make 时 functionfs-0.3.tar.gz 没有下载吗?
您的包未下载,因为您的包名称与 .mk 文件中的变量名称不匹配。基本上,您必须匹配三样东西:
- Config.in中的
BR2_PACKAGE_<FOO>
选项
- 文件和目录的名称必须是
package/<foo>/<foo>.mk
- .mk 文件中的变量必须命名为
<FOO>_SOMETHING
你没有说 .mk 文件的名称是什么,但至少你的选项被命名为 BR2_PACKAGE_PYTHON3_FUNCTIONFS
而 make 变量被命名为 PYTHON_FUNCTIONFS_SOMETHING
.
这就是为什么没有下载它的原因。
那么,关于scanpypi
脚本,在最近版本的Buildroot中肯定是在utils/
目录下。它曾经在 support/scripts
几个版本前。所以基本上你正在查看在线的 Buildroot 文档(并且与最新版本相匹配),但你使用的是较旧的 Buildroot 版本。您可以通过 运行 make manual-html
.
构建与您的 Buildroot 版本匹配的 Buildroot 文档
我正在尝试将 python3-functionfs 模块集成到 buildroot 中。
我可以 select 它与 make menuconfig
但是当我 运行 make
甚至没有下载包。
包在这里可用:functionfs-0.3 pypi page
并在此处下载 url :functionfs-0.3 download link
这里还有 github 回购协议:functionfs git repository
我使用的是 Buildroot 2017.02 版本。
这是我的 Config.in 文件:
config BR2_PACKAGE_PYTHON3_FUNCTIONFS
bool "python3-functionfs"
depends on BR2_PACKAGE_PYTHON3
help
Pythonic API for linux’s functionfs.
functionfs is part of the usb gadget subsystem. Together with usb_gadget’s configfs integration, allows userland to declare and implement an USB device.
https://pypi.python.org/pypi/functionfs
这是我的 .mk 文件:
################################################################################
#
# python3-functionfs
#
################################################################################
PYTHON_FUNCTIONFS_VERSION = 0.3
PYTHON_FUNCTIONFS_SOURCE = functionfs-$(PYTHON_FUNCTIONFS_VERSION).tar.gz
PYTHON_FUNCTIONFS_SITE = https://pypi.python.org/packages/e3/2d/56e0d9ffe0da7c116a6724ee538375689dd59e34dbe1676edf6b66b52be4
PYTHON_FUNCTIONFS_LICENSE = GPLv3+
PYTHON_FUNCTIONFS_LICENSE_FILE = COPYING
PYTHON_FUNCTIONFS_SETUP_TYPE = setuptools
$(eval $(python-package))
文档还在 17.8.3 中提到。从 PyPI 存储库生成 python 包
If the Python package for which you would like to create a Buildroot package is available on PyPI, you may want to use the scanpypi tool located in utils/ to automate the process.
You can find the list of existing PyPI packages here.
scanpypi requires Python’s setuptools package to be installed on your host.
When at the root of your buildroot directory just do :
utils/scanpypi foo bar -o package
This will generate packages python-foo and python-bar in the package folder if they exist on https://pypi.python.org.
Find the external python modules menu and insert your package inside. Keep in mind that the items inside a menu should be in alphabetical order.
Please keep in mind that you’ll most likely have to manually check the package for any mistakes as there are things that cannot be guessed by the generator (e.g. dependencies on any of the python core modules such as BR2_PACKAGE_PYTHON_ZLIB). Also, please take note that the license and license files are guessed and must be checked. You also need to manually add the package to the package/Config.in file.
If your Buildroot package is not in the official Buildroot tree but in a br2-external tree, use the -o flag as follows:
utils/scanpypi foo bar -o other_package_dir
This will generate packages python-foo and python-bar in the other_package_directory instead of package.
Option -h will list the available options:
utils/scanpypi -h
但是我在 buildroot 主目录中没有 util/
文件夹。
该脚本位于 support/scripts/scanpypi
但当我在 运行 时出现以下错误:
$ support/scripts/scanpypi functionfs -o package
Traceback (most recent call last):
File "support/scripts/scanpypi", line 47, in <module>
import setuptools
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 40, in <module>
from pkgutil import get_importer
ImportError: cannot import name get_importer
这可以通过重命名 support/scripts/pkgutil.py
和 support/scripts/pkgutil.pyc
来解决。
但是我想了解当我尝试自己创建包时发生了什么,但它没有下载。
有人知道为什么 运行 make 时 functionfs-0.3.tar.gz 没有下载吗?
您的包未下载,因为您的包名称与 .mk 文件中的变量名称不匹配。基本上,您必须匹配三样东西:
- Config.in中的
BR2_PACKAGE_<FOO>
选项 - 文件和目录的名称必须是
package/<foo>/<foo>.mk
- .mk 文件中的变量必须命名为
<FOO>_SOMETHING
你没有说 .mk 文件的名称是什么,但至少你的选项被命名为 BR2_PACKAGE_PYTHON3_FUNCTIONFS
而 make 变量被命名为 PYTHON_FUNCTIONFS_SOMETHING
.
这就是为什么没有下载它的原因。
那么,关于scanpypi
脚本,在最近版本的Buildroot中肯定是在utils/
目录下。它曾经在 support/scripts
几个版本前。所以基本上你正在查看在线的 Buildroot 文档(并且与最新版本相匹配),但你使用的是较旧的 Buildroot 版本。您可以通过 运行 make manual-html
.