python - 仅在开发模式下排除 setup.py 中的文件
问题描述
我想在运行时排除文件,pip install mypackage
但在使用pip install -e mypackage
.
我设法做到了,但不仅仅是为了开发安装。这是我的setup.py
:
import fnmatch
from setuptools import find_packages
from setuptools import setup
from setuptools.command.build_py import build_py as build_py_orig
excluded_files = ["myfiles.."]
class build_py(build_py_orig):
def find_package_modules(self, package, package_dir):
modules = super().find_package_modules(package, package_dir)
return [
(pkg, mod, file)
for (pkg, mod, file) in modules
if not any(fnmatch.fnmatchcase(file, pat=pattern) for pattern in excluded_files)
]
setup(
name="tvmodels",
packages=find_packages(),
cmdclass={'build_py': build_py},
install_requires=["myrequirements"],
description="...",
)
知道我该怎么做吗?
解决方案
推荐阅读
- java - 为什么 ClassDiagram 中没有连接两个类?
- swift - Codable 中单个数据的多个编码键
- c# - 当 swagger.json 由 localhost 提供时,Autorest 无法针对文件解析 swagger.json
- smtp - 通过 AWS WorkMail 的 SMTP 传输器
- javascript - 反应 POST DATA TO 对象
- detox - 是否有任何拖放测试?
- c++ - 如何在显示包含文件夹的同时让 CMake 构建我的项目?
- node.js - NodeJS Express HTTP POST 在一个请求中上传多个文件与多个请求(一个请求一个文件)以提高性能
- python - 在 PyCharm IDE 中使用 Python 的 Flask 框架创建 Web 应用程序时,如何创建模板来存储我的 HTML 文件?
- spring - 具有多线程的弹簧批处理作业不起作用