WithSecureLabs/drozer

python setup.py bdist_wheel raises `TypeError: expected string or bytes-like object`

c4nd1e opened this issue · 4 comments

I'm running on python3.8.10 and other softwares are latest version

/usr/lib/python3/dist-packages/setuptools/dist.py:481: UserWarning: The version specified (<src.drozer.meta.Version object at 0x7f37bbd37fa0>) is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  warnings.warn(
running bdist_wheel
Traceback (most recent call last):
  File "setup.py", line 125, in <module>
    setuptools.setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 984, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 129, in finalize_options
    self.data_dir = self.wheel_dist_name + '.data'
  File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 164, in wheel_dist_name
    safer_version(self.distribution.get_version()))
  File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 43, in safer_version
    return safe_version(version).replace('-', '_')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1332, in safe_version
    return str(packaging.version.Version(version))
  File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py", line 200, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object

what OS you running? so we can build a VM with the same environment?

Could you try replacing this line of setup.py

drozer/setup.py

Line 127 in 9737ce2

version = meta.version,

with
version = str(meta.version),

Looks to be a difference with how ancient Python versions handle type mismatches.

If that doesn't help, then yeah, please tell us about your environment so we can rebuild it on our end.

Heads-up: there's probably gonna be more bugs affecting Python 3.8, and it's officially going out of extended support later this year. It might be easier for you to update (and for us to bump the minimum required version)

closing issue due to no response

Nah, let's keep that one open. We'll get this fixed as part of the build process overhaul, but my comment above should be a fair workaround in the meantime