Skip to content

Build fails with CleanCommand super()-call #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
menschel-d opened this issue Feb 29, 2020 · 6 comments · Fixed by #226
Closed

Build fails with CleanCommand super()-call #224

menschel-d opened this issue Feb 29, 2020 · 6 comments · Fixed by #226
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results Infra All about infrastructure (GitHub Action, project build etc.)

Comments

@menschel-d
Copy link
Contributor

While trying to upgrade the BitBake recipes for python-semver (Python 2 and Python 3) from version 2.8.1 to 2.9.1, I've encountered the following error which seems to have been introduced by commit 017e296#diff-2eeaed663bd0d25b7e608891384b7298L39-R39.

Here is the relevant BitBake log for Python 3.7:

ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/temp/run.do_configure.28554' failed with exit code 1:
running clean
Traceback (most recent call last):
  File "setup.py", line 101, in <module>
    entry_points={"console_scripts": ["pysemver = semver:main"]},
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 41, in run
    super(CleanCommand, self).run()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/cmd.py", line 176, in run
    % self.__class__)
RuntimeError: abstract method -- subclass <class '__main__.Clean'> must override
WARNING: exit code 1 from a shell command.

And here is the corresponding log for Python 2.7:

ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/temp/run.do_configure.32044' failed with exit code 1:
running clean
Traceback (most recent call last):
  File "setup.py", line 101, in <module>
    entry_points={"console_scripts": ["pysemver = semver:main"]},
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 41, in run
    super(CleanCommand, self).run()
TypeError: super() argument 1 must be type, not classobj
WARNING: exit code 1 from a shell command.

Looking at the documentation for super() in Python 3 and Python 2 makes me wonder if super(CleanCommand, self).run() might be a typo and should have been super(Clean, self).run().

Changing super(CleanCommand, self).run() to super(Clean, self).run() apparently solves the problem for Python 3. For Python 2, the error message stays more or less the same:

ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/temp/run.do_configure.2883' failed with exit code 1:
running clean
Traceback (most recent call last):
  File "setup.py", line 101, in <module>
    entry_points={"console_scripts": ["pysemver = semver:main"]},
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 41, in run
    super(Clean, self).run()
TypeError: super() argument 1 must be type, not classobj
WARNING: exit code 1 from a shell command.
@tomschr tomschr added the Bug Error, flaw or fault to produce incorrect or unexpected results label Feb 29, 2020
@tomschr
Copy link
Member

tomschr commented Feb 29, 2020

@menschel-d Thanks Dennis for this detailed report! 👍 Much appreciated.

Of course, such an exception shouldn't happen. I haven't looked into the details yet, but I assume this has something to do with the difference of classes in Python 2. In Python 3, all classes are derived from object. However, in Python 2 there is this distinction between "old style" and "new style" classes. Only new style classes are derived from object.

My guess would be, that the underlying setuptools module is mostly "old style". It had (and still has) to support a lot of Python versions. Unfortunately, with old style classes, you can't use super().

Could you test one thing for me, please? Can you change the line from super(CleanCommand, self).run() to CleanCommand.run() and see what happens?


Apart from the above error, IMHO I think the setup.py should be cleaned up. From what I see, setup.py isn't declarative, but can contain all sorts of different functions. Maybe we need to make it more declarative... 🤔

@menschel-d
Copy link
Contributor Author

@tomschr Thanks for the quick reply, Tom!

After changing super(CleanCommand, self).run() to CleanCommand.run(), I receive the following error from BitBake for Python 3:

ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/temp/run.do_configure.8309' failed with exit code 1:
running clean
Traceback (most recent call last):
  File "setup.py", line 101, in <module>
    entry_points={"console_scripts": ["pysemver = semver:main"]},
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 41, in run
    CleanCommand.run()
TypeError: run() missing 1 required positional argument: 'self'
WARNING: exit code 1 from a shell command.

And this is the corresponding output for Python 2:

ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/temp/run.do_configure.6197' failed with exit code 1:
running clean
Traceback (most recent call last):
  File "setup.py", line 101, in <module>
    entry_points={"console_scripts": ["pysemver = semver:main"]},
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python-semver/2.9.1-r0/recipe-sysroot-native/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 41, in run
    CleanCommand.run()
TypeError: unbound method run() must be called with clean instance as first argument (got nothing instead)
WARNING: exit code 1 from a shell command.

@tomschr
Copy link
Member

tomschr commented Feb 29, 2020

@menschel-d

Thanks for the quick reply, Tom!

You're welcome. 😄

After changing super(CleanCommand, self).run() to CleanCommand.run(), I receive the following error from BitBake for Python 3:

Ohh, I'm stupid, it should be CleanCommand.run(self). When I change it, I can successfully execute ./setup.py clean both with Python2 and Python3. However, I can't test it with BitBake ATM.

Does it help?

tomschr added a commit to tomschr/python-semver that referenced this issue Feb 29, 2020
In class clean, replace super(CleanCommand, self).run() with CleanCommand.run(self)

Co-authored-by: Dennis Menschel <menschel-d>
tomschr added a commit to tomschr/python-semver that referenced this issue Feb 29, 2020
In class clean, replace super(CleanCommand, self).run() with CleanCommand.run(self)

Co-authored-by: Dennis Menschel <menschel-d@users.noreply.github.com>
@menschel-d
Copy link
Contributor Author

After applying CleanCommand.run(self) from #226, BitBake is able to build python-semver again. 😃

Below is the identical output of BitBake for both Python 2 and 3:

DEBUG: Executing shell function do_configure
running clean
semver.egg-info/ removed ...
DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
DEBUG: Python function do_qa_configure finished

s-celles pushed a commit that referenced this issue Feb 29, 2020
In class clean, replace super(CleanCommand, self).run() with CleanCommand.run(self)

Co-authored-by: Dennis Menschel <menschel-d@users.noreply.github.com>

Co-authored-by: Dennis Menschel <menschel-d@posteo.de>
@s-celles
Copy link
Member

Thanks @menschel-d for reporting this issue and @tomschr for fixing it!

@tomschr
Copy link
Member

tomschr commented Feb 29, 2020

@menschel-d Cool! 👍 Thanks to @scls19fr for the quick merge! 👍

@tomschr tomschr added the Infra All about infrastructure (GitHub Action, project build etc.) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results Infra All about infrastructure (GitHub Action, project build etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants