• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/docs/manual/adding-packages-python.txt
Jan ViktorinJan Viktorin committed c99a0deec7814 Jul 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
// -*- mode:doc; -*-
2
// vim: set syntax=asciidoc:
3
​
4
=== Infrastructure for Python packages
5
​
6
This infrastructure applies to Python packages that use the standard
7
Python setuptools mechanism as their build system, generally
8
recognizable by the usage of a +setup.py+ script.
9
​
10
[[python-package-tutorial]]
11
​
12
==== +python-package+ tutorial
13
​
14
First, let's see how to write a +.mk+ file for a Python package,
15
with an example :
16
​
17
------------------------
18
01: ################################################################################
19
02: #
20
03: # python-foo
21
04: #
22
05: ################################################################################
23
06:
24
07: PYTHON_FOO_VERSION = 1.0
25
08: PYTHON_FOO_SOURCE = python-foo-$(PYTHON_FOO_VERSION).tar.xz
26
09: PYTHON_FOO_SITE = http://www.foosoftware.org/download
27
10: PYTHON_FOO_LICENSE = BSD-3c
28
11: PYTHON_FOO_LICENSE_FILES = LICENSE
29
12: PYTHON_FOO_ENV = SOME_VAR=1
30
13: PYTHON_FOO_DEPENDENCIES = libmad
31
14: PYTHON_FOO_SETUP_TYPE = distutils
32
15:
33
16: $(eval $(python-package))
34
------------------------
35
​
36
On line 7, we declare the version of the package.
37
​
38
On line 8 and 9, we declare the name of the tarball (xz-ed tarball
39
recommended) and the location of the tarball on the Web. Buildroot
40
will automatically download the tarball from this location.
41
​
42
On line 10 and 11, we give licensing details about the package (its
43
license on line 10, and the file containing the license text on line
44
11).
45
​
46
On line 12, we tell Buildroot to pass custom options to the Python
47
+setup.py+ script when it is configuring the package.
48
​
49
On line 13, we declare our dependencies, so that they are built
50
before the build process of our package starts.
51
​
52
On line 14, we declare the specific Python build system being used. In
53
this case the +distutils+ Python build system is used. The two
54
supported ones are +distutils+ and +setuptools+.
55
​
56
Finally, on line 16, we invoke the +python-package+ macro that
57
generates all the Makefile rules that actually allow the package to be
58
built.
59
​
60
[[python-package-reference]]
61
​
62
==== +python-package+ reference
63
​
64
As a policy, packages that merely provide Python modules should all be
65
named +python-<something>+ in Buildroot. Other packages that use the
66
Python build system, but are not Python modules, can freely choose
67
their name (existing examples in Buildroot are +scons+ and
68
+supervisor+).
69
​
70
In their +Config.in+ file, they should depend on +BR2_PACKAGE_PYTHON+
71
so that when Buildroot will enable Python 3 usage for modules, we will
72
be able to enable Python modules progressively on Python 3.
73
​
74
The main macro of the Python package infrastructure is
75
+python-package+. It is similar to the +generic-package+ macro. It is
76
also possible to create Python host packages with the
77
+host-python-package+ macro.
78
​
79
Just like the generic infrastructure, the Python infrastructure works
80
by defining a number of variables before calling the +python-package+
81
or +host-python-package+ macros.
82
​
83
All the package metadata information variables that exist in the
84
xref:generic-package-reference[generic package infrastructure] also
85
exist in the Python infrastructure: +PYTHON_FOO_VERSION+,
86
+PYTHON_FOO_SOURCE+, +PYTHON_FOO_PATCH+, +PYTHON_FOO_SITE+,
87
+PYTHON_FOO_SUBDIR+, +PYTHON_FOO_DEPENDENCIES+, +PYTHON_FOO_LICENSE+,
88
+PYTHON_FOO_LICENSE_FILES+, +PYTHON_FOO_INSTALL_STAGING+, etc.
89
​
90
Note that:
91
​
92
 * It is not necessary to add +python+ or +host-python+ in the
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.