1 Star 0 Fork 0

qpython-android/qpython3-toolchain

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
patch.py 884 Bytes
一键复制 编辑 原始数据 按行查看 历史
River 提交于 2018-03-09 09:47 +08:00 . New QPython3 core build scripts update
import os.path
class Patch:
def __init__(self, name: str, strip: int=1) -> None:
self.name = name
self.strip = strip
def apply_file(self, patch, source):
patch_path = str(patch)
if not patch.exists():
patch_path += '.patch'
source.run_in_source_dir([
'patch', '--fuzz=0', f'--strip={self.strip}', '--input', patch_path])
class LocalPatch(Patch):
def apply(self, source):
self.apply_file(self.package.filesdir / self.name, self.package.source)
class RemotePatch(Patch):
def __init__(self, url: str, *args, **kwargs) -> None:
self.url = url
name, _ = os.path.splitext(os.path.basename(url))
super(RemotePatch, self).__init__(name, *args, **kwargs)
def apply(self, source):
self.apply_file(self.package.source.src_prefix / self.name, self.package.source)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/qpython-android/qpython3-toolchain.git
git@gitee.com:qpython-android/qpython3-toolchain.git
qpython-android
qpython3-toolchain
qpython3-toolchain
master

搜索帮助