python setuptools 从我的脚本中删除了 shebang

python setuptools removed shebang from my script

我有这样的脚本

from setuptools import setup

setup(
    name='my package',
    version='1.0',
    description='Bla',
    author='Me',
    url='http://www.google.com',
    packages=find_packages(),
    scripts=['bin/python_script_1', 'bin/python_script2'],
)

但是 python 脚本 python_script_1python_script_2 最终都错过了 shebang并变得破碎

来源:

#!/bin/env python

"""
This script does things
"""

输出:

#!

"""
This script does things
"""

我阅读了

的文档 (https://docs.python.org/3/distutils/setupscript.html#installing-scripts)

The only clever feature is that if the first line of the script starts with #! and contains the word “python”, the Distutils will adjust the first line to refer to the current interpreter location.

这真是令人困惑,为什么我的解释器是空的?我如何解决它?我可以设置一些属性或环境变量来修复此行为吗?

我们在其他地方的脚本中发现了代码缺陷,这是导致问题的原因。我们的 setup.cfg 已损坏并提供空 build.executable