Skip to content

Commit 96b4fb5

Browse files
authored
Merge pull request #630 from hx2A/fixbuild
Fix build
2 parents 3482ed7 + afd38ef commit 96b4fb5

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

generate_py5.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import re
2424
import shutil
25+
import tempfile
2526
from pathlib import Path
2627

2728
import matplotlib as mpl
@@ -90,7 +91,7 @@ def find_jar(jar_name):
9091
logger.critical(msg)
9192
raise RuntimeError(msg)
9293

93-
core_jar_path = find_jar("library/core")
94+
core_jar_path = find_jar("library/core*")
9495
svg_jar_path = find_jar("svg")
9596
dxf_jar_path = find_jar("dxf")
9697
pdf_jar_path = find_jar("pdf")
@@ -301,24 +302,36 @@ def build_signatures(v):
301302
)
302303

303304
# add the jars
304-
def copy_jars(jar_dir, dest):
305+
def copy_jars(jar_dir, dest, *, match_regex=None):
306+
regex = re.compile(match_regex) if match_regex else None
307+
version_regex = re.compile(r"-\d\.\d\.\d")
305308
dest.mkdir(parents=True, exist_ok=True)
306309
for jar in jar_dir.glob("*.jar"):
307-
shutil.copy(jar, dest)
310+
if regex and not regex.match(jar.name):
311+
continue
312+
shutil.copy(jar, dest / version_regex.sub("", jar.name))
308313

309-
copy_jars(core_jar_path.parent, build_dir / "py5" / "jars")
314+
copy_jars(
315+
core_jar_path.parent,
316+
build_dir / "py5" / "jars",
317+
match_regex=f"(core|gluegen|jogl)(?!.*natives).*$",
318+
)
310319
copy_jars(svg_jar_path.parent, build_dir / "py5" / "jars" / "svg")
311320
copy_jars(dxf_jar_path.parent, build_dir / "py5" / "jars" / "dxf")
312321
copy_jars(pdf_jar_path.parent, build_dir / "py5" / "jars" / "pdf")
313322
shutil.copy(py5_jar_path, build_dir / "py5" / "jars")
314323

315324
# add the native libraries
325+
temp_dir = tempfile.TemporaryDirectory()
326+
native_lib_temp_dir = Path(temp_dir.name)
327+
native_lib_temp_dir.mkdir(parents=True, exist_ok=True)
328+
for jar in core_jar_path.parent.glob("*natives*.jar"):
329+
os.system(f"cd {native_lib_temp_dir} && jar xf {jar.absolute()}")
316330
shutil.copytree(
317-
core_jar_path.parent,
331+
native_lib_temp_dir / "natives",
318332
build_dir / "py5" / "natives",
319-
ignore=lambda _, names: [n for n in names if Path(n).suffix == ".jar"],
320-
dirs_exist_ok=True,
321333
)
334+
temp_dir.cleanup()
322335

323336
build_dir.touch()
324337

py5_docs/Reference/api_en/Py5Shape_get_vertex_count.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ processing_name = getVertexCount
88

99
@@ signatures
1010
get_vertex_count() -> int
11+
get_vertex_count(include_children: bool, /) -> int
12+
13+
@@ variables
14+
include_children: bool - include vertices in the shape's children
1115

1216
@@ description
1317
The `get_vertex_count()` method returns the number of vertices that make up a `Py5Shape`. In the example, the value 4 is returned by the `get_vertex_count()` method because 4 vertices are defined in `setup()`.
1418

19+
Use the `include_children` parameter to include the shape's children if the shape happens to be a `GROUP` shape. By default, a shape's children will not be included in the count.
20+
1521
@@ example
1622
def setup():
1723
global s

py5_jar/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<mkdir dir="${project.bin}"/>
1919
<javac release="17" debug="true" includeantruntime="false" srcdir="${project.src}" destdir="${project.bin}">
2020
<classpath>
21-
<fileset dir="${processing_dir}/core/library/">
21+
<fileset dir="${processing_dir}/lib/app/resources">
2222
<include name="**/*.jar"/>
2323
</fileset>
2424
</classpath>

0 commit comments

Comments
 (0)