[bitbake-devel,v2,1.32] fetch2: fix import error for Python 3.6.5

Submitted by Changhyeok Bae on July 26, 2018, 12:26 a.m. | Patch ID: 152974

Details

Message ID 1532564810-2025-1-git-send-email-changhyeok.bae@gmail.com
State New
Headers show

Commit Message

Changhyeok Bae July 26, 2018, 12:26 a.m.
From: Tzu Hsiang Lin <t9360341@ntut.org.tw>

When running bitbake command with Python 3.6.5 always result in
import error causing by the change of distutils module.
This patch replaces the method to search executable in PATH by
"/usr/bin/env <command>".

Signed-off-by: Tzu Hsiang Lin <t9360341@ntut.org.tw>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
---
 lib/bb/fetch2/clearcase.py | 3 +--
 lib/bb/fetch2/npm.py       | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/fetch2/clearcase.py b/lib/bb/fetch2/clearcase.py
index 70e280a..41cd46f 100644
--- a/lib/bb/fetch2/clearcase.py
+++ b/lib/bb/fetch2/clearcase.py
@@ -70,7 +70,6 @@  from   bb.fetch2 import FetchMethod
 from   bb.fetch2 import FetchError
 from   bb.fetch2 import runfetchcmd
 from   bb.fetch2 import logger
-from   distutils import spawn
 
 class ClearCase(FetchMethod):
     """Class to fetch urls via 'clearcase'"""
@@ -108,7 +107,7 @@  class ClearCase(FetchMethod):
         else:
             ud.module = ""
 
-        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or spawn.find_executable("cleartool") or spawn.find_executable("rcleartool")
+        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or "/usr/bin/env cleartool || rcleartool"
 
         if data.getVar("SRCREV", d, True) == "INVALID":
           raise FetchError("Set a valid SRCREV for the clearcase fetcher in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your choice.")
diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 699ae72..7ccaba9 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -33,7 +33,6 @@  from   bb.fetch2 import runfetchcmd
 from   bb.fetch2 import logger
 from   bb.fetch2 import UnpackError
 from   bb.fetch2 import ParameterError
-from   distutils import spawn
 
 def subprocess_setup():
     # Python installs a SIGPIPE handler by default. This is usually not what

Comments

Christopher Larson July 26, 2018, 2:28 a.m.
subprocess searches PATH by default, /usr/bin/env is redundant anywhere but
in a #! line of an executable script, as far as I know.

On Wed, Jul 25, 2018 at 5:27 PM Changhyeok Bae <changhyeok.bae@gmail.com>
wrote:

> From: Tzu Hsiang Lin <t9360341@ntut.org.tw>
>
> When running bitbake command with Python 3.6.5 always result in
> import error causing by the change of distutils module.
> This patch replaces the method to search executable in PATH by
> "/usr/bin/env <command>".
>
> Signed-off-by: Tzu Hsiang Lin <t9360341@ntut.org.tw>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
> ---
>  lib/bb/fetch2/clearcase.py | 3 +--
>  lib/bb/fetch2/npm.py       | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/bb/fetch2/clearcase.py b/lib/bb/fetch2/clearcase.py
> index 70e280a..41cd46f 100644
> --- a/lib/bb/fetch2/clearcase.py
> +++ b/lib/bb/fetch2/clearcase.py
> @@ -70,7 +70,6 @@ from   bb.fetch2 import FetchMethod
>  from   bb.fetch2 import FetchError
>  from   bb.fetch2 import runfetchcmd
>  from   bb.fetch2 import logger
> -from   distutils import spawn
>
>  class ClearCase(FetchMethod):
>      """Class to fetch urls via 'clearcase'"""
> @@ -108,7 +107,7 @@ class ClearCase(FetchMethod):
>          else:
>              ud.module = ""
>
> -        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or
> spawn.find_executable("cleartool") or spawn.find_executable("rcleartool")
> +        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or "/usr/bin/env
> cleartool || rcleartool"
>
>          if data.getVar("SRCREV", d, True) == "INVALID":
>            raise FetchError("Set a valid SRCREV for the clearcase fetcher
> in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your
> choice.")
> diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
> index 699ae72..7ccaba9 100644
> --- a/lib/bb/fetch2/npm.py
> +++ b/lib/bb/fetch2/npm.py
> @@ -33,7 +33,6 @@ from   bb.fetch2 import runfetchcmd
>  from   bb.fetch2 import logger
>  from   bb.fetch2 import UnpackError
>  from   bb.fetch2 import ParameterError
> -from   distutils import spawn
>
>  def subprocess_setup():
>      # Python installs a SIGPIPE handler by default. This is usually not
> what
> --
> 2.7.4
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
Martin Jansa July 26, 2018, 6:48 a.m.
Chris: you're right, but it was already merged in this form to master,
1.38, 1.36, 1.34 branches, so it would be better to keep the same for 1.32.

On Thu, Jul 26, 2018 at 4:30 AM Christopher Larson <kergoth@gmail.com>
wrote:

> subprocess searches PATH by default, /usr/bin/env is redundant anywhere
> but in a #! line of an executable script, as far as I know.
>
> On Wed, Jul 25, 2018 at 5:27 PM Changhyeok Bae <changhyeok.bae@gmail.com>
> wrote:
>
>> From: Tzu Hsiang Lin <t9360341@ntut.org.tw>
>>
>> When running bitbake command with Python 3.6.5 always result in
>> import error causing by the change of distutils module.
>> This patch replaces the method to search executable in PATH by
>> "/usr/bin/env <command>".
>>
>> Signed-off-by: Tzu Hsiang Lin <t9360341@ntut.org.tw>
>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
>> ---
>>  lib/bb/fetch2/clearcase.py | 3 +--
>>  lib/bb/fetch2/npm.py       | 1 -
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/lib/bb/fetch2/clearcase.py b/lib/bb/fetch2/clearcase.py
>> index 70e280a..41cd46f 100644
>> --- a/lib/bb/fetch2/clearcase.py
>> +++ b/lib/bb/fetch2/clearcase.py
>> @@ -70,7 +70,6 @@ from   bb.fetch2 import FetchMethod
>>  from   bb.fetch2 import FetchError
>>  from   bb.fetch2 import runfetchcmd
>>  from   bb.fetch2 import logger
>> -from   distutils import spawn
>>
>>  class ClearCase(FetchMethod):
>>      """Class to fetch urls via 'clearcase'"""
>> @@ -108,7 +107,7 @@ class ClearCase(FetchMethod):
>>          else:
>>              ud.module = ""
>>
>> -        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or
>> spawn.find_executable("cleartool") or spawn.find_executable("rcleartool")
>> +        ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or "/usr/bin/env
>> cleartool || rcleartool"
>>
>>          if data.getVar("SRCREV", d, True) == "INVALID":
>>            raise FetchError("Set a valid SRCREV for the clearcase fetcher
>> in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your
>> choice.")
>> diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
>> index 699ae72..7ccaba9 100644
>> --- a/lib/bb/fetch2/npm.py
>> +++ b/lib/bb/fetch2/npm.py
>> @@ -33,7 +33,6 @@ from   bb.fetch2 import runfetchcmd
>>  from   bb.fetch2 import logger
>>  from   bb.fetch2 import UnpackError
>>  from   bb.fetch2 import ParameterError
>> -from   distutils import spawn
>>
>>  def subprocess_setup():
>>      # Python installs a SIGPIPE handler by default. This is usually not
>> what
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> bitbake-devel mailing list
>> bitbake-devel@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>>
>
>
> --
> Christopher Larson
> kergoth at gmail dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Senior Software Engineer, Mentor Graphics
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
Richard Purdie July 26, 2018, 12:51 p.m.
On Thu, 2018-07-26 at 08:48 +0200, Martin Jansa wrote:
> Chris: you're right, but it was already merged in this form to
> master, 1.38, 1.36, 1.34 branches, so it would be better to keep the
> same for 1.32.

Agreed, we should have made a better patch and we should really improve
master...

Cheers,

Richard