Message ID | 1c44ffa9837ab6c7a8ea24a2f69eafb38838fb45.1701989368.git.tim.orling@konsulko.com |
---|---|
State | Accepted, archived |
Commit | 69b679380616a94a631681caa05d9bf7610f9372 |
Headers | show |
Series | [1/6] python3-setuptools-rust: BBCLASSEXTEND + nativesdk | expand |
> -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Tim Orling > Sent: den 8 december 2023 00:13 > To: openembedded-core@lists.openembedded.org > Subject: [OE-core] [PATCH 4/6] recipetool: add python_maturin support > > Add the new python_maturin PEP-517 backend > > Add selftest for 'pydantic-core' pypi package. > > [YOCTO #15312] > > Signed-off-by: Tim Orling <tim.orling@konsulko.com> > --- > meta/lib/oeqa/selftest/cases/recipetool.py | 34 +++++++++++++++++++ > .../lib/recipetool/create_buildsys_python.py | 1 + > 2 files changed, 35 insertions(+) > > diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py > index 55cbba9ca74..ddcacaa73c7 100644 > --- a/meta/lib/oeqa/selftest/cases/recipetool.py > +++ b/meta/lib/oeqa/selftest/cases/recipetool.py > @@ -611,6 +611,40 @@ class RecipetoolCreateTests(RecipetoolBase): > > self._test_recipe_contents(recipefile, checkvars, inherits) > > + def test_recipetool_create_python3_pep517_maturin(self): > + # This test require python 3.11 or above for the tomllib module > + # or tomli module to be installed > + try: > + import tomllib > + except ImportError: > + try: > + import tomli > + except ImportError: > + self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') > + > + # Test creating python3 package from tarball (using maturin class) > + temprecipe = os.path.join(self.tempdir, 'recipe') > + os.makedirs(temprecipe) > + pn = 'pydantic-core' > + pv = '2.14.5' > + recipefile = os.path.join(temprecipe, 'python3-%s_%s.bb' % (pn, pv)) > + srcuri = 'https://files.pythonhosted.org/packages/64/26/cffb93fe9c6b5a91c497f37fae14a4b073ecbc47fc36a9979c7aa888b245/pydantic_core-%s.tar.gz' % pv > + result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) > + self.assertTrue(os.path.isfile(recipefile)) > + checkvars = {} > + checkvars['HOMEPAGE'] = 'https://github.com/pydantic/pydantic-core' > + checkvars['LICENSE'] = set(['MIT']) > + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=ab599c188b4a314d2856b3a55030c75c' > + checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/64/26/cffb93fe9c6b5a91c497f37fae14a4b073ecbc47fc36a9979c7aa888b245/pydantic_core-${PV}.tar.gz' > + checkvars['SRC_URI[md5sum]'] = '1eb13c211147496c1c9484ff7f8ac438' > + checkvars['SRC_URI[sha1sum]'] = '0803a731aa793f3eaf4d52f656d7300408ca0b36' > + checkvars['SRC_URI[sha256sum]'] = '6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71' > + checkvars['SRC_URI[sha384sum]'] = 'cca6d9f0ba72ff92e16aaf3d6c628b8df33bdf244cc39c9d59cff9d541f35d4e87ec136e6 0e4b040ad73c5c69b27cec6' > + checkvars['SRC_URI[sha512sum]'] = 'e6c3081dfa58d9b59f8c33dfe80712d732ac3048a2f8240f9a0f5448d9bfc83e222c1e08b8bb49779b84f685c3bec3060cc935c113a818b1ab8aa955f3df2238' After my recent changes to recipetool, only the sha256sum shall be present here. > + inherits = ['python_maturin'] > + > + self._test_recipe_contents(recipefile, checkvars, inherits) > + > def test_recipetool_create_github_tarball(self): > # Basic test to ensure github URL mangling doesn't apply to release tarballs > 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 9312e4abf13..9bebb3061b1 100644 > --- a/scripts/lib/recipetool/create_buildsys_python.py > +++ b/scripts/lib/recipetool/create_buildsys_python.py > @@ -668,6 +668,7 @@ class > PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): > "poetry.core.masonry.api": "python_poetry_core", > "flit_core.buildapi": "python_flit_core", > "hatchling.build": "python_hatchling", > + "maturin": "python_maturin", > } > > # setuptools.build_meta and flit declare project metadata into the "project" section of pyproject.toml > -- > 2.34.1 //Peter
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 55cbba9ca74..ddcacaa73c7 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -611,6 +611,40 @@ class RecipetoolCreateTests(RecipetoolBase): self._test_recipe_contents(recipefile, checkvars, inherits) + def test_recipetool_create_python3_pep517_maturin(self): + # This test require python 3.11 or above for the tomllib module + # or tomli module to be installed + try: + import tomllib + except ImportError: + try: + import tomli + except ImportError: + self.skipTest('Test requires python 3.11 or above for tomllib module or tomli module') + + # Test creating python3 package from tarball (using maturin class) + temprecipe = os.path.join(self.tempdir, 'recipe') + os.makedirs(temprecipe) + pn = 'pydantic-core' + pv = '2.14.5' + recipefile = os.path.join(temprecipe, 'python3-%s_%s.bb' % (pn, pv)) + srcuri = 'https://files.pythonhosted.org/packages/64/26/cffb93fe9c6b5a91c497f37fae14a4b073ecbc47fc36a9979c7aa888b245/pydantic_core-%s.tar.gz' % pv + result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) + self.assertTrue(os.path.isfile(recipefile)) + checkvars = {} + checkvars['HOMEPAGE'] = 'https://github.com/pydantic/pydantic-core' + checkvars['LICENSE'] = set(['MIT']) + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=ab599c188b4a314d2856b3a55030c75c' + checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/64/26/cffb93fe9c6b5a91c497f37fae14a4b073ecbc47fc36a9979c7aa888b245/pydantic_core-${PV}.tar.gz' + checkvars['SRC_URI[md5sum]'] = '1eb13c211147496c1c9484ff7f8ac438' + checkvars['SRC_URI[sha1sum]'] = '0803a731aa793f3eaf4d52f656d7300408ca0b36' + checkvars['SRC_URI[sha256sum]'] = '6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71' + checkvars['SRC_URI[sha384sum]'] = 'cca6d9f0ba72ff92e16aaf3d6c628b8df33bdf244cc39c9d59cff9d541f35d4e87ec136e60e4b040ad73c5c69b27cec6' + checkvars['SRC_URI[sha512sum]'] = 'e6c3081dfa58d9b59f8c33dfe80712d732ac3048a2f8240f9a0f5448d9bfc83e222c1e08b8bb49779b84f685c3bec3060cc935c113a818b1ab8aa955f3df2238' + inherits = ['python_maturin'] + + self._test_recipe_contents(recipefile, checkvars, inherits) + def test_recipetool_create_github_tarball(self): # Basic test to ensure github URL mangling doesn't apply to release tarballs 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 9312e4abf13..9bebb3061b1 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -668,6 +668,7 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): "poetry.core.masonry.api": "python_poetry_core", "flit_core.buildapi": "python_flit_core", "hatchling.build": "python_hatchling", + "maturin": "python_maturin", } # setuptools.build_meta and flit declare project metadata into the "project" section of pyproject.toml
Add the new python_maturin PEP-517 backend Add selftest for 'pydantic-core' pypi package. [YOCTO #15312] Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- meta/lib/oeqa/selftest/cases/recipetool.py | 34 +++++++++++++++++++ .../lib/recipetool/create_buildsys_python.py | 1 + 2 files changed, 35 insertions(+)