Adding python packages to Buildroot - cu-ecen-aeld/buildroot-assignments-base GitHub Wiki
Overview
This wiki page walks through the detailed steps of a adding python packages on buildroot
Steps
Step 1: Locate the python package that you wish to add from this website python package
For example, let us add a package called pyfingerprint
We are going to choose the latest version here.
Step 2:
- Once you make sure that the python package you are looking for is available, create a folder in base_external/package
- The folder name should be "python_packagename" - for example "python_pyfingerprint" --> in lower case
- Add 3 files within this newly created folder.
- Config.in
- python_packagename.hash
- python_packagename.mk
eg:
- Config.in
- python_pyfingerprint.mk
- pyhton_pyfingerprint.hash
Step 3: Fill the config file with below details related to your package
config BR2_PACKAGE_PYTHON_PYFINGERPRINT
bool "python-pyfingerprint"
help
This package includes pyfingerprint python package.
Helps to understand buildroot external trees and package builds.
Step 4: Fill hash files with these details
#md5, sha256 from https://pypi.org/pypi/pyfingerprint/json
md5 d10cd6f44c4208e655fc3a1bf87f873e pyfingerprint-1.5.tar.gz
sha256 62d84c1f3adb77b39d0568ff971861423a27925d29ce60d7997285ba63e78a4f pyfingerprint-1.5.tar.gz
you can find the md5 and sha256 in download file page https://pypi.org/project/pyfingerprint/#files -> view hashes
Add package name and version in tar.gz format at the end.
Step 5: Fill in makefile with these details
################################################################################
#
#python-pyfingerprint
#
################################################################################
PYTHON_PYFINGERPRINT_VERSION = 1.5
PYTHON_PYFINGERPRINT_SOURCE = pyfingerprint-$(PYTHON_PYFINGERPRINT_VERSION).tar.gz
PYTHON_PYFINGERPRINT_SITE = https://files.pythonhosted.org/packages/3f/73/236c50506208cec1987925f68d979bb7e4839f84f13c01622db7d021f338
PYTHON_PYFINGERPRINT_SETUP_TYPE = setuptools
PYTHON_PYFINGERPRINT_LICENSE = D-FSL
PYTHON_PYFINGERPRINT_LICENSE_FILES = LICENSE
$(eval $(python-package))
- You can find the version in the website
- add the download link in the place of site. looks like this -> https://files.pythonhosted.org/packages/3f/73/236c50506208cec1987925f68d979bb7e4839f84f13c01622db7d021f338/pyfingerprint-1.5.tar.gz
remove the tar.gz at the end - https://files.pythonhosted.org/packages/3f/73/236c50506208cec1987925f68d979bb7e4839f84f13c01622db7d021f338
- If setup types is not explicitly mentioned in the website, then it will usually be setuptools
- License type will be mentioned in the website
Step 6: After making the necessary changes,
- Add this python package in makemenu->external options
- Also add the python package in base_external/Config.in For eg:
source "$BR2_EXTERNAL_project_base_PATH/package/python-pyfingerprint/Config.in"
Step 7:
- do
./save-config.sh
followed by
./build.sh
- verify that the python package is added in config/defconfig file. You are good to go!