Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions renpybuild/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,40 @@ def compile(self, src : str|Path):
flags = f'-b {flags}'

self.run(command, flags=flags, src=src)

def clone(
self,
url: str,
options: str = "",
*,
directory: str = "",
minimal: bool = True,
submodules: bool = False,
):
"""
Clones the repository at `url` into the current directory.

`options`
Options to pass to git clone.

`directory`
The directory to clone into.

`minimal`
If true, automatically applies options to minimize download size.

`submodules`
If true, also clones submodules recursively.
"""

url = self.expand(url)
options = self.expand(options)
directory = self.expand(directory)

if minimal:
options = f"--depth 1 --no-tags --single-branch --shallow-submodules {options}"

if submodules:
options = f"--recurse-submodules {options}"

self.run(f"git clone {options} {url} {directory}")
14 changes: 2 additions & 12 deletions tasks/aom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@
from renpybuild.task import task

@task(kind="host", platforms="all")
def download(c : Context):

if c.path("{{ tmp }}/source/aom").exists():
c.chdir("{{ tmp }}/source/aom")
c.run("git checkout master")
c.run("git pull")
c.run("git checkout v3.5.0")
return

def download(c: Context):
c.clean("{{ tmp }}/source/aom")
c.chdir("{{ tmp }}/source")

c.run("git clone https://aomedia.googlesource.com/aom")
c.chdir("{{ tmp }}/source/aom")
c.run("git checkout v3.5.0")
c.clone("https://aomedia.googlesource.com/aom", "--branch v3.5.0")

@task(platforms="all")
def build(c : Context):
Expand Down
2 changes: 1 addition & 1 deletion tasks/assimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def download(c : Context):
c.clean("{{ tmp }}/source/assimp")
c.chdir("{{ tmp }}/source")

c.run("git clone --depth 1 --branch v5.4.3 https://github.com/assimp/assimp")
c.clone("https://github.com/assimp/assimp", "--branch v5.4.3")

c.chdir("assimp")
c.patch("assimp.diff")
Expand Down
4 changes: 2 additions & 2 deletions tasks/libavif.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from renpybuild.task import task

@task(kind="host", platforms="all")
def download(c : Context):
def download(c: Context):
c.clean("{{ tmp }}/source/libavif")
c.chdir("{{ tmp }}/source")

c.run("git clone --branch v0.11.1 https://github.com/AOMediaCodec/libavif")
c.clone("https://github.com/AOMediaCodec/libavif", "--branch v0.11.1")

@task(platforms="all")
def build(c : Context):
Expand Down
6 changes: 2 additions & 4 deletions tasks/libyuv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from renpybuild.task import task

@task(kind="host", platforms="all")
def download(c : Context):

def download(c: Context):
c.var("commit", "331c361581896292fb46c8c6905e41262b7ca95f")

if c.path("{{ tmp }}/source/libyuv").exists():
Expand All @@ -14,11 +13,10 @@ def download(c : Context):
c.run("git checkout {{ commit }}")

else:

c.clean("{{ tmp }}/source/libyuv")
c.chdir("{{ tmp }}/source")

c.run("git clone https://chromium.googlesource.com/libyuv/libyuv")
c.clone("https://chromium.googlesource.com/libyuv/libyuv", minimal=False)
c.chdir("{{ tmp }}/source/libyuv")
c.run("git checkout {{ commit }}")

Expand Down
9 changes: 4 additions & 5 deletions tasks/pyobjus.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ def unpack(c: Context):
c.clean()

c.var("commit", commit)
c.run("git clone https://github.com/kivy/pyobjus pyobjus")
c.clone("https://github.com/kivy/pyobjus", minimal=False)
c.chdir("pyobjus")

c.run("git checkout {{commit}}")
c.run("git checkout {{ commit }}")
c.patch("pyobjus/ffi-h.diff")


@task(kind="host-python")
def host_unpack(c: Context):

c.clean()

c.var("commit", commit)
c.run("git clone https://github.com/kivy/pyobjus pyobjus")
c.clone("https://github.com/kivy/pyobjus", minimal=False)
c.chdir("pyobjus")

c.run("git checkout {{commit}}")
c.run("git checkout {{ commit }}")
c.patch("pyobjus/ffi-h.diff")


Expand Down
7 changes: 3 additions & 4 deletions tasks/python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def unpack_windows(c: Context):
c.var("version", win_version)

if (c.root / "unpacked" / "cpython-mingw").exists():
c.run("git clone {{ c.root }}/unpacked/cpython-mingw")
c.var("repo", "{{ c.root }}/unpacked/cpython-mingw")
else:
c.run("git clone https://github.com/msys2-contrib/cpython-mingw")
c.var("repo", "https://github.com/msys2-contrib/cpython-mingw")

c.chdir("cpython-mingw")
c.run("git checkout mingw-v{{ version }}")
c.clone("{{ repo }}", "--branch mingw-v{{ version }}")

@task(kind="python", pythons="3", platforms="linux,mac,ios")
def patch_posix(c: Context):
Expand Down
3 changes: 2 additions & 1 deletion tasks/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def emsdk(c: Context):
c.var("emsdk_version", "3.1.67")

c.clean("{{ cross }}")
c.run("git clone https://github.com/emscripten-core/emsdk/ {{cross}}")
c.clone("https://github.com/emscripten-core/emsdk/", directory="{{ cross }}")

c.chdir("{{ cross }}")
c.run("./emsdk install {{ emsdk_version }}")
c.run("./emsdk activate {{ emsdk_version }}")
Expand Down