diff --git a/colcon_python_setup_py/package_identification/python_setup_py.py b/colcon_python_setup_py/package_identification/python_setup_py.py index 0a93105..16274f6 100644 --- a/colcon_python_setup_py/package_identification/python_setup_py.py +++ b/colcon_python_setup_py/package_identification/python_setup_py.py @@ -277,25 +277,6 @@ def _get_setup_information(setup_py, *, env=None): 'dist = run_setup(' " 'setup.py', script_args=('--dry-run',), stop_after='config')", - "skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata')", - 'data = {' - ' key: value for key, value in dist.__dict__.items() ' - ' if (' - # skip private properties - " not key.startswith('_') and " - # skip methods - ' not callable(value) and ' - # skip objects whose representation can't be evaluated - ' key not in skip_keys and ' - # skip display options since they have no value, using metadata instead - ' key not in dist.display_option_names' - ' )' - '}', - "data['metadata'] = {" - ' k: v for k, v in dist.metadata.__dict__.items() ' - # skip values with custom type OrderedSet - " if k not in ('license_files', 'provides_extras')}", - 'pickle.dump(data, sys.stdout.buffer)'] # invoke distutils.core.run_setup() in a separate interpreter @@ -305,5 +286,9 @@ def _get_setup_information(setup_py, *, env=None): cmd, stdout=subprocess.PIPE, cwd=os.path.abspath(str(setup_py.parent)), check=True, env=env) output = result.stdout + dist = pickle.loads(output) - return pickle.loads(output) + # turn into a dict for backwards compatibility + dist_dict = dist.__dict__.copy() + dist_dict['metadata'] = dist.metadata.__dict__ + return dist_dict diff --git a/setup.cfg b/setup.cfg index c7b2f4d..740e2c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,7 +27,8 @@ keywords = colcon [options] install_requires = colcon-core>=0.3.10 - setuptools + # DistributionMetadata not picklable in these versions https://github.com/pypa/setuptools/issues/1888 + setuptools !=42.*,!=43.*,!=44.*,!=45.* packages = find: tests_require = flake8>=3.6.0 diff --git a/test/spell_check.words b/test/spell_check.words index 75c65a6..d4d0cc5 100644 --- a/test/spell_check.words +++ b/test/spell_check.words @@ -1,7 +1,6 @@ apache chdir colcon -distclass hashable iterdir lstrip