阅读 setup.py 中的“--plat-name”参数
reading "--plat-name" argument in setup.py
setuptools bdist_wheel
/bdist_egg
命令有一个 --plat-name
参数,允许覆盖主机平台名称。该值附加到生成的文件的名称上,例如 mypackage-1.2.3-py2.py3-none-manylinux1_x86_64.whl
.
如何在 setup.py
中读取此值?请注意,我 不是 询问脚本 运行 所在的主机平台,例如 platform.system()
。我想要 setuptools 使用的平台名称。
在 bdist_egg
中(并且只有它;bdist_wheel
只运行 bdist_egg
)--plat-name
参数存储在 self.plat_name
中。所以你可以用你的自定义 class 覆盖 bdist_egg
并使用 self.plat_name
:
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
from setuptools import setup
class bdist_egg(_bdist_egg):
def run(self):
# Use self.plat_name before building an egg…
_bdist_egg.run(self)
# …or after
setup(
…
cmdclass={
'bdist_egg': bdist_egg,
},
…
)
setuptools bdist_wheel
/bdist_egg
命令有一个 --plat-name
参数,允许覆盖主机平台名称。该值附加到生成的文件的名称上,例如 mypackage-1.2.3-py2.py3-none-manylinux1_x86_64.whl
.
如何在 setup.py
中读取此值?请注意,我 不是 询问脚本 运行 所在的主机平台,例如 platform.system()
。我想要 setuptools 使用的平台名称。
在 bdist_egg
中(并且只有它;bdist_wheel
只运行 bdist_egg
)--plat-name
参数存储在 self.plat_name
中。所以你可以用你的自定义 class 覆盖 bdist_egg
并使用 self.plat_name
:
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
from setuptools import setup
class bdist_egg(_bdist_egg):
def run(self):
# Use self.plat_name before building an egg…
_bdist_egg.run(self)
# …or after
setup(
…
cmdclass={
'bdist_egg': bdist_egg,
},
…
)