首页 > 解决方案 > pip install git repo 仅构建

问题描述

我正在尝试为我的包构建 setup.py。pip install . --user从克隆的回购中效果很好。该软件包已构建并安装。

如果pip install git+ssh://git@github.com/Me/MyPackage.git@installation --user被执行,pip 只构建包。它不安装。我该怎么做才能使 pip 也安装软件包?

为了完成这里是我的 setup.py。它有一个自定义安装,可以按应有的方式编译 c 代码。install.run(self)似乎没有被执行或什么的。

from setuptools import setup, Extension, find_packages
from setuptools.command.install import install
import subprocess
import os
from mypackage import __version__

def find_executables():
    folder = 'mypackage/bin'
    a =  [f'{folder}/{e}' for e in os.listdir(folder) if os.path.isfile(f'{folder}/{e}') and not '__' in e]
    return a

class CustomInstall(install):
    def run(self):
        import sys
        commandPullSubmodules = 'git submodule update --init --recursive'
        process = subprocess.Popen(commandPullSubmodules, shell=True, cwd="./")
        process.wait()

        #COMPILE C-CODE
        version = f'{sys.version_info[0]}.{sys.version_info[1]}'
        commandInstall = f'python{version} compile.py --target all'
        process = subprocess.Popen(commandInstall, shell=True, cwd="mypackage/mypackageC")
        process.wait()

        install.run(self)

setup(
    name='mypackage',
    version=__version__,
    packages=find_packages(),
    author='Me',
    author_email='me@gmail.com',
    url='https://github.com/Me/MyPackage.git',
    install_requires=['lxml', 'PyFFTW', 'scipy', 'boost', 'numpy'],
    extras_require={
        'gpu': ['cupy'],
        'gui': ['PyQt5', 'pyqtgraph'],
        'all': ['cupy', 'PyQt5', 'pyqtgraph']},
    cmdclass={'install': CustomInstall},
    include_package_data=True,
    scripts=find_executables(),
    test_suite='nose.collector',
    tests_require=['nose'])

标签: gitinstallationpip

解决方案


推荐阅读