hi Alex, as far as I know, universal_newlines=True is always required when executing commands which produce text. I'll send an updated commit, but it's already used a lot in the code-base, so I didn't think it needed an explanation. See this example:
>>> p = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) >>> stdout, stderr = p.communicate() >>> print(stdout) b'total 32\ndrwxrwxr-x 2 ecordonnier ecordonnier 4096 Sep 19 13:43 classes\ndrwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 conf\n-rw-rw-r-- 1 ecordonnier ecordonnier 1023 Jun 23 2022 COPYING.MIT\n-rw-rw-r-- 1 ecordonnier ecordonnier 1946 Sep 19 13:43 README\ndrwxrwxr-x 5 ecordonnier ecordonnier 4096 Jun 23 2022 recipes-core\ndrwxrwxr-x 13 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-devtools\ndrwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-extended\ndrwxrwxr-x 5 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-support\n' >>> p = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) >>> stdout, stderr = p.communicate() >>> print(stdout) total 32 drwxrwxr-x 2 ecordonnier ecordonnier 4096 Sep 19 13:43 classes drwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 conf -rw-rw-r-- 1 ecordonnier ecordonnier 1023 Jun 23 2022 COPYING.MIT -rw-rw-r-- 1 ecordonnier ecordonnier 1946 Sep 19 13:43 README drwxrwxr-x 5 ecordonnier ecordonnier 4096 Jun 23 2022 recipes-core drwxrwxr-x 13 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-devtools drwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-extended drwxrwxr-x 5 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-support On Fri, Jan 12, 2024 at 3:06 PM Alexander Kanavin <alex.kana...@gmail.com> wrote: > The universal_newlines=True changes need to be explained in the commit > message. Why are they added? > > The need for hostos.startswith("darwin") is easier to guess, but that > too, needs an explanation. > > Alex > > On Fri, 12 Jan 2024 at 14:53, Etienne Cordonnier via > lists.openembedded.org <ecordonnier=snap....@lists.openembedded.org> > wrote: > > > > From: Etienne Cordonnier <ecordonn...@snap.com> > > > > Signed-off-by: Dominik Schnitzer <domi...@snap.com> > > Signed-off-by: Etienne Cordonnier <ecordonn...@snap.com> > > --- > > meta/lib/oe/package.py | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py > > index 9a465eaa09..635efc9763 100644 > > --- a/meta/lib/oe/package.py > > +++ b/meta/lib/oe/package.py > > @@ -1615,7 +1615,7 @@ def process_shlibs(pkgfiles, d): > > sonames.add(prov) > > if file.endswith('.dylib') or file.endswith('.so'): > > rpath = [] > > - p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), > '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) > > + p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), > '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, > universal_newlines=True) > > out, err = p.communicate() > > # If returned successfully, process stdout for results > > if p.returncode == 0: > > @@ -1624,7 +1624,7 @@ def process_shlibs(pkgfiles, d): > > if l.startswith('path '): > > rpath.append(l.split()[1]) > > > > - p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', > file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) > > + p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', > file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, > universal_newlines=True) > > out, err = p.communicate() > > # If returned successfully, process stdout for results > > if p.returncode == 0: > > @@ -1686,7 +1686,7 @@ def process_shlibs(pkgfiles, d): > > soname = None > > if cpath.islink(file): > > continue > > - if hostos == "darwin" or hostos == "darwin8": > > + if hostos.startswith("darwin"): > > darwin_so(file, needed, sonames, renames, pkgver) > > elif hostos.startswith("mingw"): > > mingw_dll(file, needed, sonames, renames, pkgver) > > -- > > 2.36.1.vfs.0.0 > > > > > > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#193585): https://lists.openembedded.org/g/openembedded-core/message/193585 Mute This Topic: https://lists.openembedded.org/mt/103682827/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-