diff mbox series

[v2,4/6] recipetool: add python_maturin support

Message ID 20231209020223.1221046-1-tim.orling@konsulko.com
State Accepted, archived
Commit 69b679380616a94a631681caa05d9bf7610f9372
Headers show
Series None | expand

Commit Message

Tim Orling Dec. 9, 2023, 2:02 a.m. UTC
Add the new python_maturin PEP-517 backend

Add selftest for 'pydantic-core' pypi package.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
Changes in v2:
 - drop all SRC_URI checksums except sha256sum (Peter's change)
   * requires "[PATCH v2] recipetool: pypi: do not clobber SRC_URI checksums"
 - drop SRC_URI (Julien's change)
 - add "inherit pypi" (Julien's change)

 meta/lib/oeqa/selftest/cases/recipetool.py    | 29 +++++++++++++++++++
 .../lib/recipetool/create_buildsys_python.py  |  1 +
 2 files changed, 30 insertions(+)

Comments

Alexandre Belloni Dec. 9, 2023, 11:59 a.m. UTC | #1
On 09/12/2023 12:29:50+0100, Alexandre Belloni via lists.openembedded.org wrote:
> Hello,
> 
> maturin is not reproducible:
> 
> https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20231208-rfbproj4/packages/diff-html/


Probably related:

WARNING: python3-maturin-1.3.2-r0 do_package_qa: QA Issue: File /usr/bin/.debug/maturin in package python3-maturin-dbg contains reference to TMPDIR
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8267/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6018/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/8141/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/5453/steps/11/logs/stdio


> 
> On 08/12/2023 18:02:24-0800, Tim Orling wrote:
> > Add the new python_maturin PEP-517 backend
> > 
> > Add selftest for 'pydantic-core' pypi package.
> > 
> > Signed-off-by: Tim Orling <tim.orling@konsulko.com>
> > ---
> > Changes in v2:
> >  - drop all SRC_URI checksums except sha256sum (Peter's change)
> >    * requires "[PATCH v2] recipetool: pypi: do not clobber SRC_URI checksums"
> >  - drop SRC_URI (Julien's change)
> >  - add "inherit pypi" (Julien's change)
> > 
> >  meta/lib/oeqa/selftest/cases/recipetool.py    | 29 +++++++++++++++++++
> >  .../lib/recipetool/create_buildsys_python.py  |  1 +
> >  2 files changed, 30 insertions(+)
> > 
> > diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
> > index d10d61bc5b0..8d39f639acf 100644
> > --- a/meta/lib/oeqa/selftest/cases/recipetool.py
> > +++ b/meta/lib/oeqa/selftest/cases/recipetool.py
> > @@ -663,6 +663,35 @@ 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[sha256sum]'] = '6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71'
> > +        inherits = ['python_maturin', 'pypi']
> > +
> > +        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 a2af41fdda8..60c59034504 100644
> > --- a/scripts/lib/recipetool/create_buildsys_python.py
> > +++ b/scripts/lib/recipetool/create_buildsys_python.py
> > @@ -735,6 +735,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
> > 
> 
> > 
> > 
> > 
> 
> 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#192097): https://lists.openembedded.org/g/openembedded-core/message/192097
> Mute This Topic: https://lists.openembedded.org/mt/103071823/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Tim Orling Dec. 14, 2023, 12:28 a.m. UTC | #2
On Sat, Dec 9, 2023 at 3:59 AM Alexandre Belloni <
alexandre.belloni@bootlin.com> wrote:

> On 09/12/2023 12:29:50+0100, Alexandre Belloni via lists.openembedded.org
> wrote:
> > Hello,
> >
> > maturin is not reproducible:
> >
> >
> https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20231208-rfbproj4/packages/diff-html/
>
>
> Probably related:
>
> WARNING: python3-maturin-1.3.2-r0 do_package_qa: QA Issue: File
> /usr/bin/.debug/maturin in package python3-maturin-dbg contains reference
> to TMPDIR
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8267/steps/14/logs/stdio
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6018/steps/12/logs/stdio
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/8141/steps/11/logs/stdio
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/5453/steps/11/logs/stdio
>
> I think at least this part is sorted:
https://github.com/alexcrichton/bzip2-rs/pull/101

Thank you to khem for making me realize the options passed to the ‘cc’
crate were the issue in this case. (The Makefile is not used, nor are
CFLAGS from the environment)

The reordering bits might be a different problem. If anybody has any
thoughts on that I’m all ears.

>
> >
> > On 08/12/2023 18:02:24-0800, Tim Orling wrote:
> > > Add the new python_maturin PEP-517 backend
> > >
> > > Add selftest for 'pydantic-core' pypi package.
> > >
> > > Signed-off-by: Tim Orling <tim.orling@konsulko.com>
> > > ---
> > > Changes in v2:
> > >  - drop all SRC_URI checksums except sha256sum (Peter's change)
> > >    * requires "[PATCH v2] recipetool: pypi: do not clobber SRC_URI
> checksums"
> > >  - drop SRC_URI (Julien's change)
> > >  - add "inherit pypi" (Julien's change)
> > >
> > >  meta/lib/oeqa/selftest/cases/recipetool.py    | 29 +++++++++++++++++++
> > >  .../lib/recipetool/create_buildsys_python.py  |  1 +
> > >  2 files changed, 30 insertions(+)
> > >
> > > diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py
> b/meta/lib/oeqa/selftest/cases/recipetool.py
> > > index d10d61bc5b0..8d39f639acf 100644
> > > --- a/meta/lib/oeqa/selftest/cases/recipetool.py
> > > +++ b/meta/lib/oeqa/selftest/cases/recipetool.py
> > > @@ -663,6 +663,35 @@ 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[sha256sum]'] =
> '6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71'
> > > +        inherits = ['python_maturin', 'pypi']
> > > +
> > > +        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 a2af41fdda8..60c59034504 100644
> > > --- a/scripts/lib/recipetool/create_buildsys_python.py
> > > +++ b/scripts/lib/recipetool/create_buildsys_python.py
> > > @@ -735,6 +735,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
> > >
> >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Alexandre Belloni, co-owner and COO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
>
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#192097):
> https://lists.openembedded.org/g/openembedded-core/message/192097
> > Mute This Topic: https://lists.openembedded.org/mt/103071823/3617179
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alexandre.belloni@bootlin.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index d10d61bc5b0..8d39f639acf 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -663,6 +663,35 @@  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[sha256sum]'] = '6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71'
+        inherits = ['python_maturin', 'pypi']
+
+        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 a2af41fdda8..60c59034504 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -735,6 +735,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