相关疑难解决方法(0)

在 pip install 上运行 Makefile

我有一些协议缓冲区定义需要作为pip install过程的一部分构建到 Python 源代码中。我已经对setuptools.command.install命令进行了子类化,setup.py但我认为它会在安装包后尝试运行 Makefile,因此无法识别源。

我找不到有关 pip 安装期间发生的情况的信息。任何人都可以发光吗?

设置.py:

import subprocess
import sys

from setuptools import setup
from setuptools.command.install import install

class Install(install):
    """Customized setuptools install command - builds protos on install."""
    def run(self):
        protoc_command = ["make", "python"]
        if subprocess.call(protoc_command) != 0:
            sys.exit(-1)
        install.run(self)


setup(
    name='myprotos',
    version='0.0.1',
    description='Protocol Buffers.',
    install_requires=[],
    cmdclass={
        'install': Install,
    }
)
Run Code Online (Sandbox Code Playgroud)

的输出$ pip install -vvv .

Processing /path/to/myprotos
  Running setup.py (path:/private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-jpgCby-build/setup.py) egg_info for package from file:///path/to/myprotos
    Running command …
Run Code Online (Sandbox Code Playgroud)

python makefile pip

6
推荐指数
1
解决办法
7025
查看次数

标签 统计

makefile ×1

pip ×1

python ×1