From 8de70e46840c65383d5a0791cade5b932ffe999c Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 28 Jun 2024 14:36:09 -0500 Subject: [PATCH] Migrate from 'scripts' to 'entry_points.console_scripts' (#186) Modern Python projects use 'entry_points.console_scripts' over the installation of pre-made 'scripts'. Importantly, this makes the executables usable on Windows. --- setup.py | 23 ++++++++++--------- src/rosdistro/cli/__init__.py | 0 .../rosdistro/cli/rosdistro.py | 0 .../rosdistro/cli/rosdistro_build_cache.py | 0 .../rosdistro/cli/rosdistro_convert.py | 0 .../rosdistro/cli/rosdistro_freeze_source.py | 0 .../rosdistro/cli/rosdistro_generate_cache.py | 0 .../cli/rosdistro_migrate_to_rep_141.py | 0 .../cli/rosdistro_migrate_to_rep_143.py | 0 .../rosdistro/cli/rosdistro_reformat.py | 0 10 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 src/rosdistro/cli/__init__.py rename scripts/rosdistro => src/rosdistro/cli/rosdistro.py (100%) rename scripts/rosdistro_build_cache => src/rosdistro/cli/rosdistro_build_cache.py (100%) rename scripts/rosdistro_convert => src/rosdistro/cli/rosdistro_convert.py (100%) rename scripts/rosdistro_freeze_source => src/rosdistro/cli/rosdistro_freeze_source.py (100%) rename scripts/rosdistro_generate_cache => src/rosdistro/cli/rosdistro_generate_cache.py (100%) rename scripts/rosdistro_migrate_to_rep_141 => src/rosdistro/cli/rosdistro_migrate_to_rep_141.py (100%) rename scripts/rosdistro_migrate_to_rep_143 => src/rosdistro/cli/rosdistro_migrate_to_rep_143.py (100%) rename scripts/rosdistro_reformat => src/rosdistro/cli/rosdistro_reformat.py (100%) diff --git a/setup.py b/setup.py index cbcda9f1c..7b11553ee 100755 --- a/setup.py +++ b/setup.py @@ -14,16 +14,17 @@ 'python_requires': '>=3.6', 'packages': find_packages('src'), 'package_dir': {'': 'src'}, - 'scripts': [ - # 'scripts/rosdistro', - 'scripts/rosdistro_build_cache', - 'scripts/rosdistro_freeze_source', - # 'scripts/rosdistro_convert', - # 'scripts/rosdistro_generate_cache', - 'scripts/rosdistro_migrate_to_rep_141', - 'scripts/rosdistro_migrate_to_rep_143', - 'scripts/rosdistro_reformat' - ], + 'entry_points': { + 'console_scripts': [ + # 'rosdistro = rosdistro.cli.rosdistro:main', + 'rosdistro_build_cache = rosdistro.cli.rosdistro_build_cache:main', + 'rosdistro_freeze_source = rosdistro.cli.rosdistro_freeze_source:main', + # 'rosdistro_convert = rosdistro.cli.rosdistro_convert:main', + # 'rosdistro_generate_cache = rosdistro.cli.rosdistro_generate_cache:main', + 'rosdistro_migrate_to_rep_141 = rosdistro.cli.rosdistro_migrate_to_rep_141:main', + 'rosdistro_migrate_to_rep_143 = rosdistro.cli.rosdistro_migrate_to_rep_143:main', + 'rosdistro_reformat = rosdistro.cli.rosdistro_reformat:main' + ]}, 'extras_require': { 'test': [ 'pytest', @@ -53,7 +54,7 @@ kwargs['package_dir'] = {} elif 'SKIP_PYTHON_SCRIPTS' in os.environ: kwargs['name'] += '_modules' - kwargs['scripts'] = [] + kwargs['entry_points'] = [] else: kwargs['install_requires'] += ['catkin_pkg', 'rospkg'] diff --git a/src/rosdistro/cli/__init__.py b/src/rosdistro/cli/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/rosdistro b/src/rosdistro/cli/rosdistro.py similarity index 100% rename from scripts/rosdistro rename to src/rosdistro/cli/rosdistro.py diff --git a/scripts/rosdistro_build_cache b/src/rosdistro/cli/rosdistro_build_cache.py similarity index 100% rename from scripts/rosdistro_build_cache rename to src/rosdistro/cli/rosdistro_build_cache.py diff --git a/scripts/rosdistro_convert b/src/rosdistro/cli/rosdistro_convert.py similarity index 100% rename from scripts/rosdistro_convert rename to src/rosdistro/cli/rosdistro_convert.py diff --git a/scripts/rosdistro_freeze_source b/src/rosdistro/cli/rosdistro_freeze_source.py similarity index 100% rename from scripts/rosdistro_freeze_source rename to src/rosdistro/cli/rosdistro_freeze_source.py diff --git a/scripts/rosdistro_generate_cache b/src/rosdistro/cli/rosdistro_generate_cache.py similarity index 100% rename from scripts/rosdistro_generate_cache rename to src/rosdistro/cli/rosdistro_generate_cache.py diff --git a/scripts/rosdistro_migrate_to_rep_141 b/src/rosdistro/cli/rosdistro_migrate_to_rep_141.py similarity index 100% rename from scripts/rosdistro_migrate_to_rep_141 rename to src/rosdistro/cli/rosdistro_migrate_to_rep_141.py diff --git a/scripts/rosdistro_migrate_to_rep_143 b/src/rosdistro/cli/rosdistro_migrate_to_rep_143.py similarity index 100% rename from scripts/rosdistro_migrate_to_rep_143 rename to src/rosdistro/cli/rosdistro_migrate_to_rep_143.py diff --git a/scripts/rosdistro_reformat b/src/rosdistro/cli/rosdistro_reformat.py similarity index 100% rename from scripts/rosdistro_reformat rename to src/rosdistro/cli/rosdistro_reformat.py