diff options
author | Julien Stephan <jstephan@baylibre.com> | 2023-12-04 16:59:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-06 22:55:49 +0000 |
commit | 85a2a6f68af304ace1d767e3e8367627cea898f6 (patch) | |
tree | 8e20b0b68250cf3a8cc0e69d3036d5f87b92fbe9 /scripts/lib/devtool/standard.py | |
parent | 6c06fb0a4395bd98918cbcdb16e93e094e79226e (diff) | |
download | poky-85a2a6f68af304ace1d767e3e8367627cea898f6.tar.gz |
recipetool: create_buildsys_python: add pypi support
Today, we can use devtool/recipetool to create recipes for python projects
using the github url or the direct release tarball of the project, but the
create_buildsys_python plugin doesn't support the pypi class, since we cannot
know from the extracted source if the package is available on pypi or not.
By implementing the new optional process_url callback, we can detect
that the url is a pypi one (i.e 'https://pypi.org/project/<package>')
and retrieve the release tarball location.
Also detect if the url points to a release tarball hosted on
"files.pythonhosted.iorg" (i.e https://files.pythonhosted.org/packages/...)
In both cases, adds the pypi class, remove 'S' and 'SRC_URIxxx'
variables from the created recipe as they will be handled by the pypi class
and add the PYPI_PACKAGE variable
This helps to produce cleaner recipes when package is hosted on pypi.
If the url points to a github url or a release tarball not coming from
"files.pythonhosted.org", the created recipe is the same as before.
One can also use the newly added "--no-pypi" switch to NOT inherit
from pypi class on matching url, to keep legacy behaviour.
To create a recipe for a pypi package, one can now use one of the
new following syntax (using recipetool create / devtool add):
* recipetool create https://pypi.org/project/<package>
* recipetool create https://pypi.org/project/<package>/<version>
* recipetool create https://pypi.org/project/<package> --version <version>
or the old syntax:
* recipetool create https://files.pythonhosted.org/packages/<...>
(From OE-Core rev: 097a43846cd99a7d74d004efc57f583ce78970a4)
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index ad6e346279..16ea328c6a 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -147,6 +147,8 @@ def add(args, config, basepath, workspace): | |||
147 | extracmdopts += ' -a' | 147 | extracmdopts += ' -a' |
148 | if args.npm_dev: | 148 | if args.npm_dev: |
149 | extracmdopts += ' --npm-dev' | 149 | extracmdopts += ' --npm-dev' |
150 | if args.no_pypi: | ||
151 | extracmdopts += ' --no-pypi' | ||
150 | if args.mirrors: | 152 | if args.mirrors: |
151 | extracmdopts += ' --mirrors' | 153 | extracmdopts += ' --mirrors' |
152 | if args.srcrev: | 154 | if args.srcrev: |
@@ -2328,6 +2330,7 @@ def register_commands(subparsers, context): | |||
2328 | group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") | 2330 | group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") |
2329 | parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)', metavar='URI') | 2331 | parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)', metavar='URI') |
2330 | parser_add.add_argument('--npm-dev', help='For npm, also fetch devDependencies', action="store_true") | 2332 | parser_add.add_argument('--npm-dev', help='For npm, also fetch devDependencies', action="store_true") |
2333 | parser_add.add_argument('--no-pypi', help='Do not inherit pypi class', action="store_true") | ||
2331 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') | 2334 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') |
2332 | parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") | 2335 | parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") |
2333 | group = parser_add.add_mutually_exclusive_group() | 2336 | group = parser_add.add_mutually_exclusive_group() |