diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 35 | ||||
| -rw-r--r-- | scripts/lib/recipetool/create_buildsys_python.py | 6 |
2 files changed, 40 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 8e0fc995f7..b64f724b8f 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
| @@ -576,6 +576,41 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
| 576 | 576 | ||
| 577 | self._test_recipe_contents(recipefile, checkvars, inherits) | 577 | self._test_recipe_contents(recipefile, checkvars, inherits) |
| 578 | 578 | ||
| 579 | def test_recipetool_create_python3_pep517_hatchling(self): | ||
| 580 | # This test require python 3.11 or above for the tomllib module | ||
| 581 | # or tomli module to be installed | ||
| 582 | try: | ||
| 583 | import tomllib | ||
| 584 | except ImportError: | ||
| 585 | try: | ||
| 586 | import tomli | ||
| 587 | except ImportError: | ||
| 588 | self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') | ||
| 589 | |||
| 590 | # Test creating python3 package from tarball (using hatchling class) | ||
| 591 | temprecipe = os.path.join(self.tempdir, 'recipe') | ||
| 592 | os.makedirs(temprecipe) | ||
| 593 | pn = 'jsonschema' | ||
| 594 | pv = '4.19.1' | ||
| 595 | recipefile = os.path.join(temprecipe, 'python3-%s_%s.bb' % (pn, pv)) | ||
| 596 | srcuri = 'https://files.pythonhosted.org/packages/e4/43/087b24516db11722c8687e0caf0f66c7785c0b1c51b0ab951dfde924e3f5/jsonschema-%s.tar.gz' % pv | ||
| 597 | result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) | ||
| 598 | self.assertTrue(os.path.isfile(recipefile)) | ||
| 599 | checkvars = {} | ||
| 600 | checkvars['SUMMARY'] = 'An implementation of JSON Schema validation for Python' | ||
| 601 | checkvars['HOMEPAGE'] = 'https://github.com/python-jsonschema/jsonschema' | ||
| 602 | checkvars['LICENSE'] = set(['MIT']) | ||
| 603 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 file://json/LICENSE;md5=9d4de43111d33570c8fe49b4cb0e01af' | ||
| 604 | checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/e4/43/087b24516db11722c8687e0caf0f66c7785c0b1c51b0ab951dfde924e3f5/jsonschema-${PV}.tar.gz' | ||
| 605 | checkvars['SRC_URI[md5sum]'] = '4d6667ce76f820c35082c2d60a4896ab' | ||
| 606 | checkvars['SRC_URI[sha1sum]'] = '9173714cb88964d07f3a3f4fcaaef638b8ceac0c' | ||
| 607 | checkvars['SRC_URI[sha256sum]'] = 'ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf' | ||
| 608 | checkvars['SRC_URI[sha384sum]'] = '7a53181f0e679aa3dc3eb4d05a420877b7b9bff2d02e81f5c289a37ed1127d6c0cca1f5a5f9e4e166f089ab36bcc2be9' | ||
| 609 | checkvars['SRC_URI[sha512sum]'] = '60fa769faf6e3fc2c14eb9acd189c86e9d366b157230a5681d36552af0c159cb1ad33fd920668a36afdab98bc97253f91501704c5c07b5009fdaf9d29b52060d' | ||
| 610 | inherits = ['python_hatchling'] | ||
| 611 | |||
| 612 | self._test_recipe_contents(recipefile, checkvars, inherits) | ||
| 613 | |||
| 579 | def test_recipetool_create_github_tarball(self): | 614 | def test_recipetool_create_github_tarball(self): |
| 580 | # Basic test to ensure github URL mangling doesn't apply to release tarballs | 615 | # Basic test to ensure github URL mangling doesn't apply to release tarballs |
| 581 | temprecipe = os.path.join(self.tempdir, 'recipe') | 616 | temprecipe = os.path.join(self.tempdir, 'recipe') |
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index 9e7f22c0db..9312e4abf1 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py | |||
| @@ -662,11 +662,12 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): | |||
| 662 | PEP517 https://peps.python.org/pep-0517/#source-trees | 662 | PEP517 https://peps.python.org/pep-0517/#source-trees |
| 663 | PEP518 https://peps.python.org/pep-0518/#build-system-table | 663 | PEP518 https://peps.python.org/pep-0518/#build-system-table |
| 664 | """ | 664 | """ |
| 665 | # bitbake currently support the 3 following backends | 665 | # bitbake currently supports the 4 following backends |
| 666 | build_backend_map = { | 666 | build_backend_map = { |
| 667 | "setuptools.build_meta": "python_setuptools_build_meta", | 667 | "setuptools.build_meta": "python_setuptools_build_meta", |
| 668 | "poetry.core.masonry.api": "python_poetry_core", | 668 | "poetry.core.masonry.api": "python_poetry_core", |
| 669 | "flit_core.buildapi": "python_flit_core", | 669 | "flit_core.buildapi": "python_flit_core", |
| 670 | "hatchling.build": "python_hatchling", | ||
| 670 | } | 671 | } |
| 671 | 672 | ||
| 672 | # setuptools.build_meta and flit declare project metadata into the "project" section of pyproject.toml | 673 | # setuptools.build_meta and flit declare project metadata into the "project" section of pyproject.toml |
| @@ -716,6 +717,8 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): | |||
| 716 | "poetry-core": "python3-poetry-core", | 717 | "poetry-core": "python3-poetry-core", |
| 717 | "flit_core": "python3-flit-core", | 718 | "flit_core": "python3-flit-core", |
| 718 | "setuptools-scm": "python3-setuptools-scm", | 719 | "setuptools-scm": "python3-setuptools-scm", |
| 720 | "hatchling": "python3-hatchling", | ||
| 721 | "hatch-vcs": "python3-hatch-vcs", | ||
| 719 | } | 722 | } |
| 720 | 723 | ||
| 721 | def __init__(self): | 724 | def __init__(self): |
| @@ -776,6 +779,7 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): | |||
| 776 | if field == "license": | 779 | if field == "license": |
| 777 | # For setuptools.build_meta and flit, licence is a table | 780 | # For setuptools.build_meta and flit, licence is a table |
| 778 | # but for poetry licence is a string | 781 | # but for poetry licence is a string |
| 782 | # for hatchling, both table (jsonschema) and string (iniconfig) have been used | ||
| 779 | if build_backend == "poetry.core.masonry.api": | 783 | if build_backend == "poetry.core.masonry.api": |
| 780 | value = values | 784 | value = values |
| 781 | else: | 785 | else: |
