Skip to contentSkip to conversation

patman: ImportError

DISCUSSION Stefan Bosch 2 participants 6 messages May 16, 2020 – May 26, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

recently, I updated my local repository (U-Boot master). Last commit is c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
4df3578119b043d76b86b50077b06898fc2a4f62 (Date: Wed Dec 18 18:25:42
2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
File "./tools/patman/patman", line 21, in <module>
from patman import checkpatch
File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 10, in <module>
from patman import command
File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
line 8, in <module>
from patman import tools
File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
line 13, in <module>
from patman import command
ImportError: cannot import name 'command'

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

Regards
Stefan Bosch

#1 lore raw

Hi Stefan,

Quoted 26 lines · Stefan Bosch

Hello,

recently, I updated my local repository (U-Boot master). Last commit is c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
4df3578119b043d76b86b50077b06898fc2a4f62 (Date: Wed Dec 18 18:25:42
2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
File "./tools/patman/patman", line 21, in <module>
from patman import checkpatch
File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 10, in <module>
from patman import command
File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
line 8, in <module>
from patman import tools
File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
line 13, in <module>
from patman import command
ImportError: cannot import name 'command'

Quoted 6 lines

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

The circular dependency has been there for some time, but perhaps in Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.

I sent a patch to break the circular dependency. Can you please try it and see if it helps?

Regards,
Simon

#2 lore raw

Hi Simon,

Am 17.05.20 um 01:03 schrieb Simon Glass:

Quoted 36 lines

Hi Stefan,

Quoted 26 lines · Stefan Bosch

Hello,

recently, I updated my local repository (U-Boot master). Last commit is c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
4df3578119b043d76b86b50077b06898fc2a4f62 (Date: Wed Dec 18 18:25:42
2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
File "./tools/patman/patman", line 21, in <module>
from patman import checkpatch
File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 10, in <module>
from patman import command
File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
line 8, in <module>
from patman import tools
File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
line 13, in <module>
from patman import command
ImportError: cannot import name 'command'

Quoted 6 lines

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

Quoted 9 lines

The circular dependency has been there for some time, but perhaps in Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.

I sent a patch to break the circular dependency. Can you please try it and see if it helps?

Regards,
Simon

Thanks for your quick reply. I tried your patch, the good news is that the ImportError for 'command' has been gone. The bad news is that the same occurs for 'checkpatch' now:

$ ./tools/patman/patman --help
Traceback (most recent call last):
   File "./tools/patman/patman", line 21, in <module>
     from patman import checkpatch
   File 
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 
11, in <module>
     from patman import gitutil
   File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py", 
line 10, in <module>
     from patman import checkpatch
ImportError: cannot import name 'checkpatch'

Regards,
Stefan

#3 lore raw

Hi Stefan,

Quoted 54 lines · Stefan Bosch

Hi Simon,

Am 17.05.20 um 01:03 schrieb Simon Glass:

Quoted 36 lines

Hi Stefan,

Quoted 26 lines · Stefan Bosch

Hello,

recently, I updated my local repository (U-Boot master). Last commit is c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
4df3578119b043d76b86b50077b06898fc2a4f62 (Date: Wed Dec 18 18:25:42
2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
File "./tools/patman/patman", line 21, in <module>
from patman import checkpatch
File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 10, in <module>
from patman import command
File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
line 8, in <module>
from patman import tools
File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
line 13, in <module>
from patman import command
ImportError: cannot import name 'command'

Quoted 6 lines

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

Quoted 9 lines

The circular dependency has been there for some time, but perhaps in Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.

I sent a patch to break the circular dependency. Can you please try it and see if it helps?

Regards,
Simon

Thanks for your quick reply. I tried your patch, the good news is that the ImportError for 'command' has been gone. The bad news is that the same occurs for 'checkpatch' now:

Quoted 12 lines
$ ./tools/patman/patman --help
Traceback (most recent call last):
   File "./tools/patman/patman", line 21, in <module>
     from patman import checkpatch
   File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line
11, in <module>
     from patman import gitutil
   File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py",
line 10, in <module>
     from patman import checkpatch
ImportError: cannot import name 'checkpatch'

OK I will try a new patch.

Which distribution are you using?

Regards,
Simon

#4 lore raw

Hi Simon,

Am 20.05.20 um 02:52 schrieb Simon Glass:

Quoted 70 lines

Hi Stefan,

Quoted 54 lines · Stefan Bosch

Hi Simon,

Am 17.05.20 um 01:03 schrieb Simon Glass:

Quoted 36 lines

Hi Stefan,

Quoted 26 lines · Stefan Bosch

Hello,

recently, I updated my local repository (U-Boot master). Last commit is c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
4df3578119b043d76b86b50077b06898fc2a4f62 (Date: Wed Dec 18 18:25:42
2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
File "./tools/patman/patman", line 21, in <module>
from patman import checkpatch
File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 10, in <module>
from patman import command
File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
line 8, in <module>
from patman import tools
File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
line 13, in <module>
from patman import command
ImportError: cannot import name 'command'

Quoted 6 lines

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

Quoted 9 lines

The circular dependency has been there for some time, but perhaps in Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.

I sent a patch to break the circular dependency. Can you please try it and see if it helps?

Regards,
Simon

Thanks for your quick reply. I tried your patch, the good news is that the ImportError for 'command' has been gone. The bad news is that the same occurs for 'checkpatch' now:

Quoted 12 lines
$ ./tools/patman/patman --help
Traceback (most recent call last):
    File "./tools/patman/patman", line 21, in <module>
      from patman import checkpatch
    File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line
11, in <module>
      from patman import gitutil
    File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py",
line 10, in <module>
      from patman import checkpatch
ImportError: cannot import name 'checkpatch'
Quoted 7 lines

OK I will try a new patch.

Which distribution are you using?

Regards,
Simon

I am using Ubuntu 14.04 (Kernel "3.13.0-170-generic").

Thanks for the new patch. Unfortunately I get the following ImportError now:

$ ./tools/patman/patman --help
Traceback (most recent call last):
   File "./tools/patman/patman", line 21, in <module>
     from patman import checkpatch
   File 
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 
11, in <module>
     from patman import gitutil
   File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py", 
line 12, in <module>
     from patman import series
   File "/home/stefan/u-boot_master/tools/patman/../patman/series.py", 
line 8, in <module>
     from patman import get_maintainer
   File 
"/home/stefan/u-boot_master/tools/patman/../patman/get_maintainer.py", 
line 8, in <module>
     from patman import gitutil
ImportError: cannot import name 'gitutil'

Regards
Stefan

#5 lore raw

Hi Simon,

Am 20.05.20 um 18:07 schrieb Stefan Bosch:

Quoted 111 lines

Hi Simon,

Am 20.05.20 um 02:52 schrieb Simon Glass:

Quoted 75 lines

Hi Stefan,

Quoted 59 lines · Stefan Bosch

Hi Simon,

Am 17.05.20 um 01:03 schrieb Simon Glass:

Quoted 41 lines

Hi Stefan,

Quoted 30 lines · Stefan Bosch

Hello,

recently, I updated my local repository (U-Boot master). Last commit is
c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been 4df3578119b043d76b86b50077b06898fc2a4f62 (Date:?? Wed Dec 18 18:25:42 2019 +0100).

Now I get an "ImportError" if I call patman:

u-boot_master$ ./tools/patman/patman --help
Traceback (most recent call last):
???? File "./tools/patman/patman", line 21, in <module> ?????? from patman import checkpatch
???? File "/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line
10, in <module>
?????? from patman import command
???? File "/home/stefan/u-boot_master/tools/patman/../patman/command.py", line 8, in <module>
?????? from patman import tools
???? File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py", line 13, in <module>
?????? from patman import command
ImportError: cannot import name 'command'

Quoted 7 lines

Cause of this 'ImportError' is probably that "from patman import command" has already been done before in checkpatch.py (circular dependency). I think the error has to do with your your commit bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).

My Python version is 3.4.3.

Quoted 9 lines

The circular dependency has been there for some time, but perhaps in Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.

I sent a patch to break the circular dependency. Can you please try it and see if it helps?

Regards,
Simon

Thanks for your quick reply. I tried your patch, the good news is that the ImportError for 'command' has been gone. The bad news is that the same occurs for 'checkpatch' now:

Quoted 12 lines
$ ./tools/patman/patman --help
Traceback (most recent call last):
??? File "./tools/patman/patman", line 21, in <module>
????? from patman import checkpatch
??? File
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line
11, in <module>
????? from patman import gitutil
??? File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py",
line 10, in <module>
????? from patman import checkpatch
ImportError: cannot import name 'checkpatch'
Quoted 7 lines

OK I will try a new patch.

Which distribution are you using?

Regards,
Simon

I am using Ubuntu 14.04 (Kernel "3.13.0-170-generic").

Thanks for the new patch. Unfortunately I get the following ImportError now:

$ ./tools/patman/patman --help
Traceback (most recent call last):
 ? File "./tools/patman/patman", line 21, in <module>
 ??? from patman import checkpatch
 ? File 
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 
11, in <module>
 ??? from patman import gitutil
 ? File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py", 
line 12, in <module>
 ??? from patman import series
 ? File "/home/stefan/u-boot_master/tools/patman/../patman/series.py", 
line 8, in <module>
 ??? from patman import get_maintainer
 ? File 
"/home/stefan/u-boot_master/tools/patman/../patman/get_maintainer.py", 
line 8, in <module>
 ??? from patman import gitutil
ImportError: cannot import name 'gitutil'
Quoted 2 lines

Regards
Stefan

Patman itself is working now with Patch-series v3, thanks a lot for your efforts. Unfortunately I still have an ImportError when building certain boards, e.g.

$ make axm_defconfig
$ make -j4 ARCH=arm 
CROSS_COMPILE=/opt/gcc-linaro-6.4.1-2018.05-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

causes the following error:

...

   DTOC C  spl/dts/dt-platdata.c
   LDS     spl/u-boot-spl.lds
   DTOC H  include/generated/dt-structs-gen.h

Traceback (most recent call last):
File "./tools/dtoc/dtoc", line 43, in <module>
from patman import test_util
File "/home/stefan/u-boot_master/tools/dtoc/../patman/test_util.py",
line 14, in <module>
from patman import test_util
ImportError: cannot import name 'test_util'
Traceback (most recent call last):
File "./tools/dtoc/dtoc", line 43, in <module>
from patman import test_util
File "/home/stefan/u-boot_master/tools/dtoc/../patman/test_util.py",
line 14, in <module>
from patman import test_util
ImportError: cannot import name 'test_util' scripts/Makefile.spl:324: recipe for target 'include/generated/dt-structs-gen.h' failed
make[1]: *** [include/generated/dt-structs-gen.h] Error 1 make[1]: *** Waiting for unfinished jobs.... scripts/Makefile.spl:327: recipe for target 'spl/dts/dt-platdata.c' failed make[1]: *** [spl/dts/dt-platdata.c] Error 1
Makefile:1934: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

If I remove "from patman import test_util" in tools/patman/test_util.py there is no error anymore (at least for the axm board). I think this is a Bug becuase it is not necessary to import test_util inside itself?!

Regards
Stefan