summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2023-10-27 09:12:12 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-30 08:50:46 +0000
commit9ffac3fc3d8325e00654c349cf25119bb37e373b (patch)
tree8230fe7d32d9ef9cbc3dc145eb9d0fbd39646cb4 /meta/lib
parent9b22a5aa8c81852ba0fca693ef0c9cb12d4ad4b5 (diff)
downloadpoky-9ffac3fc3d8325e00654c349cf25119bb37e373b.tar.gz
recipetool: add python_hatchling support
One of the newer PEP-517 backends to be added was python_hatchling.bbclass but it was not included in the recent improvements. Add selftest for 'jsonschema' pypi package. (From OE-Core rev: d99b4883b4fee82bc588fd235ba90fedf1550cb8) Signed-off-by: Tim Orling <tim.orling@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py35
1 files changed, 35 insertions, 0 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')