如何在setup.py安装函数中包含git repo,该函数从源代码处编译,但前提是尚未安装包
我有来自这个instalation manual的shell命令。我可以使用OS module
运行这些命令,但是如何使pip3安装命令健壮?如果用户重命名了pip3-->;皮普?那么我的实现就不再有效了
FENICS_VERSION=$(python3 -c"import ffc; print(ffc.__version__)")
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/mshr
mkdir dolfin/build && cd dolfin/build && cmake .. && make install && cd ../..
mkdir mshr/build && cd mshr/build && cmake .. && make install && cd ../..
cd dolfin/python && pip3 install . && cd ../..
cd mshr/python && pip3 install . && cd ../..
背景
This和 this问题/答案提供了一种方法,通过带有run方法的类将自定义安装命令引入setup.py中的setup函数。我假设在下面的代码中,自定义安装脚本是在检查install_requires
中的依赖项之后运行的
from setuptools import setup
from setuptools.command.install import install as _install
import subprocess
class install(_install):
def run(self):
install.run(self)
## do the magic for the installation of mshr and dolfin
setup(name='myProject',
.......
install_requires=['fenics-ffc >= 2018.1.0'],
setup(cmdclass={'install': install}))
目前没有回答
相关问题 更多 >
编程相关推荐