Skip to content

[BUG] Shebangs replaced by non working ones on install #4934

Open
@AlexisTM

Description

@AlexisTM

setuptools version

setuptools==78.1.0

Python version

python 3.10

OS

Ubuntu 22.04 ARM64

Additional environment information

I am building rosmaster

It creates a package then calls setup(...) for the install part.

Source: https://github.com/ros/ros_comm/tree/noetic-devel/tools/rosmaster

Description

The shebangs #!/usr/bin/env python are being replaced by #!python making the scripts non working.

This seems to be related to

if shebang_match:
log.info("copying and adjusting %s -> %s", script, self.build_dir)
if not self.dry_run:
post_interp = shebang_match.group(1) or ''
shebang = f"#!python{post_interp}\n"
self._validate_shebang(shebang, f.encoding)
with open(outfile, "w", encoding=f.encoding) as outf:
outf.write(shebang)
outf.writelines(f.readlines())

Expected behavior

The shebangs are not modified

How to Reproduce

pip install rosinstall_generator

rosinstall_generator --rosdistro noetic --deps --tar \
    rosmaster    > rosmaster.rosinstall && \
    mkdir -p src && \
    vcs import src < rosmaster.rosinstall 

ROS_VERSION=1 ./src/catkin/bin/catkin_make_isolated --install \
      -DCMAKE_BUILD_TYPE=Release \
      -DPYTHON_EXECUTABLE=/usr/bin/python3

Output

$ cat install_isolated/bin/rosmaster
#!python
[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions